Skip to content

Commit c8a7d44

Browse files
author
gaaat
committed
Merge branch '0_15' of https://github.com/Aircoookie/WLED into audioreactive-analog
2 parents 74bc159 + a6e5361 commit c8a7d44

File tree

21 files changed

+526
-475
lines changed

21 files changed

+526
-475
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
## WLED changelog
22

3+
#### Build 240503
4+
- Using brightness in analog clock overlay (#3944 by @paspiz85)
5+
- Add Webpage shortcuts (#3945 by @w00000dy)
6+
- ArtNet Poll reply (#3892 by @askask)
7+
- Improved brightness change via long button presses (#3933 by @gaaat98)
8+
- Relay open drain output (#3920 by @Suxsem)
9+
- NEW JSON API: release info (update page, `info.release`)
10+
- update esp32 platform to arduino-esp32 v2.0.9 (#3902)
11+
- various optimisations and bugfixes (#3952, #3922, #3878, #3926, #3919, #3904 @DedeHai)
12+
313
#### Build 2404120
414
- v0.15.0-b3
515
- fix for #3896 & WS2815 current saving

pio-scripts/output_bins.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def create_release(source):
3636
def bin_rename_copy(source, target, env):
3737
_create_dirs()
3838
variant = env["PIOENV"]
39+
builddir = os.path.join(env["PROJECT_BUILD_DIR"], variant)
40+
source_map = os.path.join(builddir, env["PROGNAME"] + ".map")
3941

4042
# create string with location and file names based on variant
4143
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant)
@@ -44,7 +46,11 @@ def bin_rename_copy(source, target, env):
4446

4547
# copy firmware.map to map/<variant>.map
4648
if os.path.isfile("firmware.map"):
47-
shutil.move("firmware.map", map_file)
49+
print("Found linker mapfile firmware.map")
50+
shutil.copy("firmware.map", map_file)
51+
if os.path.isfile(source_map):
52+
print(f"Found linker mapfile {source_map}")
53+
shutil.copy(source_map, map_file)
4854

4955
def bin_gzip(source, target):
5056
# only create gzip for esp8266

platformio.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,7 @@ monitor_filters = esp32_exception_decoder
471471

472472
[env:esp32s3_4M_qspi]
473473
;; ESP32-S3, with 4MB FLASH and <= 4MB PSRAM (memory_type: qio_qspi)
474-
board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
475-
board_build.arduino.memory_type = qio_qspi ;; use with PSRAM: 2MB or 4MB
474+
board = lolin_s3_mini ;; -S3 mini, 4MB flash 2MB PSRAM
476475
platform = ${esp32s3.platform}
477476
platform_packages = ${esp32s3.platform_packages}
478477
upload_speed = 921600

usermods/audioreactive/audio_reactive.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ constexpr uint16_t samplesFFT_2 = 256; // meaningfull part of FFT resul
183183
// These are the input and output vectors. Input vectors receive computed results from FFT.
184184
static float vReal[samplesFFT] = {0.0f}; // FFT sample inputs / freq output - these are our raw result bins
185185
static float vImag[samplesFFT] = {0.0f}; // imaginary parts
186-
static float windowWeighingFactors[samplesFFT] = {0.0f};
187186

188187
// Create FFT object
189188
// lib_deps += https://github.com/kosme/arduinoFFT#develop @ 1.9.2
@@ -196,7 +195,8 @@ static float windowWeighingFactors[samplesFFT] = {0.0f};
196195

197196
#include <arduinoFFT.h>
198197

199-
static ArduinoFFT<float> FFT = ArduinoFFT<float>( vReal, vImag, samplesFFT, SAMPLE_RATE, windowWeighingFactors);
198+
/* Create FFT object with weighing factor storage */
199+
static ArduinoFFT<float> FFT = ArduinoFFT<float>( vReal, vImag, samplesFFT, SAMPLE_RATE, true);
200200

201201
// Helper functions
202202

@@ -1121,6 +1121,11 @@ class AudioReactive : public Usermod {
11211121
delay(100); // Give that poor microphone some time to setup.
11221122

11231123
useBandPassFilter = false;
1124+
1125+
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
1126+
if ((i2sckPin == I2S_PIN_NO_CHANGE) && (i2ssdPin >= 0) && (i2swsPin >= 0) && ((dmType == 1) || (dmType == 4)) ) dmType = 5; // dummy user support: SCK == -1 --means--> PDM microphone
1127+
#endif
1128+
11241129
switch (dmType) {
11251130
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
11261131
// stub cases for not-yet-supported I2S modes on other ESP32 chips

wled00/FX_2Dfcn.cpp

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ void WS2812FX::setUpMatrix() {
110110
releaseJSONBufferLock();
111111
}
112112

113-
uint16_t x, y, pix=0; //pixel
113+
unsigned x, y, pix=0; //pixel
114114
for (size_t pan = 0; pan < panel.size(); pan++) {
115115
Panel &p = panel[pan];
116-
uint16_t h = p.vertical ? p.height : p.width;
117-
uint16_t v = p.vertical ? p.width : p.height;
116+
unsigned h = p.vertical ? p.height : p.width;
117+
unsigned v = p.vertical ? p.width : p.height;
118118
for (size_t j = 0; j < v; j++){
119119
for(size_t i = 0; i < h; i++) {
120120
y = (p.vertical?p.rightStart:p.bottomStart) ? v-j-1 : j;
@@ -163,8 +163,8 @@ void WS2812FX::setUpMatrix() {
163163
// XY(x,y) - gets pixel index within current segment (often used to reference leds[] array element)
164164
uint16_t IRAM_ATTR Segment::XY(uint16_t x, uint16_t y)
165165
{
166-
uint16_t width = virtualWidth(); // segment width in logical pixels (can be 0 if segment is inactive)
167-
uint16_t height = virtualHeight(); // segment height in logical pixels (is always >= 1)
166+
unsigned width = virtualWidth(); // segment width in logical pixels (can be 0 if segment is inactive)
167+
unsigned height = virtualHeight(); // segment height in logical pixels (is always >= 1)
168168
return isActive() ? (x%width) + (y%height) * width : 0;
169169
}
170170

@@ -180,7 +180,7 @@ void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col)
180180

181181
if (reverse ) x = virtualWidth() - x - 1;
182182
if (reverse_y) y = virtualHeight() - y - 1;
183-
if (transpose) { uint16_t t = x; x = y; y = t; } // swap X & Y if segment transposed
183+
if (transpose) { unsigned t = x; x = y; y = t; } // swap X & Y if segment transposed
184184

185185
x *= groupLength(); // expand to physical pixels
186186
y *= groupLength(); // expand to physical pixels
@@ -189,7 +189,7 @@ void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col)
189189
uint32_t tmpCol = col;
190190
for (int j = 0; j < grouping; j++) { // groupping vertically
191191
for (int g = 0; g < grouping; g++) { // groupping horizontally
192-
uint16_t xX = (x+g), yY = (y+j);
192+
unsigned xX = (x+g), yY = (y+j);
193193
if (xX >= width() || yY >= height()) continue; // we have reached one dimension's end
194194

195195
#ifndef WLED_DISABLE_MODE_BLEND
@@ -221,16 +221,16 @@ void Segment::setPixelColorXY(float x, float y, uint32_t col, bool aa)
221221
if (!isActive()) return; // not active
222222
if (x<0.0f || x>1.0f || y<0.0f || y>1.0f) return; // not normalized
223223

224-
const uint16_t cols = virtualWidth();
225-
const uint16_t rows = virtualHeight();
224+
const unsigned cols = virtualWidth();
225+
const unsigned rows = virtualHeight();
226226

227227
float fX = x * (cols-1);
228228
float fY = y * (rows-1);
229229
if (aa) {
230-
uint16_t xL = roundf(fX-0.49f);
231-
uint16_t xR = roundf(fX+0.49f);
232-
uint16_t yT = roundf(fY-0.49f);
233-
uint16_t yB = roundf(fY+0.49f);
230+
unsigned xL = roundf(fX-0.49f);
231+
unsigned xR = roundf(fX+0.49f);
232+
unsigned yT = roundf(fY-0.49f);
233+
unsigned yB = roundf(fY+0.49f);
234234
float dL = (fX - xL)*(fX - xL);
235235
float dR = (xR - fX)*(xR - fX);
236236
float dT = (fY - yT)*(fY - yT);
@@ -266,7 +266,7 @@ uint32_t IRAM_ATTR Segment::getPixelColorXY(int x, int y) {
266266
if (x >= virtualWidth() || y >= virtualHeight() || x<0 || y<0) return 0; // if pixel would fall out of virtual segment just exit
267267
if (reverse ) x = virtualWidth() - x - 1;
268268
if (reverse_y) y = virtualHeight() - y - 1;
269-
if (transpose) { uint16_t t = x; x = y; y = t; } // swap X & Y if segment transposed
269+
if (transpose) { unsigned t = x; x = y; y = t; } // swap X & Y if segment transposed
270270
x *= groupLength(); // expand to physical pixels
271271
y *= groupLength(); // expand to physical pixels
272272
if (x >= width() || y >= height()) return 0;
@@ -276,8 +276,8 @@ uint32_t IRAM_ATTR Segment::getPixelColorXY(int x, int y) {
276276
// blurRow: perform a blur on a row of a rectangular matrix
277277
void Segment::blurRow(uint32_t row, fract8 blur_amount, bool smear){
278278
if (!isActive() || blur_amount == 0) return; // not active
279-
const uint_fast16_t cols = virtualWidth();
280-
const uint_fast16_t rows = virtualHeight();
279+
const unsigned cols = virtualWidth();
280+
const unsigned rows = virtualHeight();
281281

282282
if (row >= rows) return;
283283
// blur one row
@@ -309,8 +309,8 @@ void Segment::blurRow(uint32_t row, fract8 blur_amount, bool smear){
309309
// blurCol: perform a blur on a column of a rectangular matrix
310310
void Segment::blurCol(uint32_t col, fract8 blur_amount, bool smear) {
311311
if (!isActive() || blur_amount == 0) return; // not active
312-
const uint_fast16_t cols = virtualWidth();
313-
const uint_fast16_t rows = virtualHeight();
312+
const unsigned cols = virtualWidth();
313+
const unsigned rows = virtualHeight();
314314

315315
if (col >= cols) return;
316316
// blur one column
@@ -342,34 +342,34 @@ void Segment::blurCol(uint32_t col, fract8 blur_amount, bool smear) {
342342
// 1D Box blur (with added weight - blur_amount: [0=no blur, 255=max blur])
343343
void Segment::box_blur(uint16_t i, bool vertical, fract8 blur_amount) {
344344
if (!isActive() || blur_amount == 0) return; // not active
345-
const uint16_t cols = virtualWidth();
346-
const uint16_t rows = virtualHeight();
347-
const uint16_t dim1 = vertical ? rows : cols;
348-
const uint16_t dim2 = vertical ? cols : rows;
345+
const unsigned cols = virtualWidth();
346+
const unsigned rows = virtualHeight();
347+
const unsigned dim1 = vertical ? rows : cols;
348+
const unsigned dim2 = vertical ? cols : rows;
349349
if (i >= dim2) return;
350350
const float seep = blur_amount/255.f;
351351
const float keep = 3.f - 2.f*seep;
352352
// 1D box blur
353353
CRGB tmp[dim1];
354-
for (int j = 0; j < dim1; j++) {
355-
uint16_t x = vertical ? i : j;
356-
uint16_t y = vertical ? j : i;
357-
int16_t xp = vertical ? x : x-1; // "signed" to prevent underflow
358-
int16_t yp = vertical ? y-1 : y; // "signed" to prevent underflow
359-
uint16_t xn = vertical ? x : x+1;
360-
uint16_t yn = vertical ? y+1 : y;
354+
for (unsigned j = 0; j < dim1; j++) {
355+
unsigned x = vertical ? i : j;
356+
unsigned y = vertical ? j : i;
357+
int xp = vertical ? x : x-1; // "signed" to prevent underflow
358+
int yp = vertical ? y-1 : y; // "signed" to prevent underflow
359+
unsigned xn = vertical ? x : x+1;
360+
unsigned yn = vertical ? y+1 : y;
361361
CRGB curr = getPixelColorXY(x,y);
362362
CRGB prev = (xp<0 || yp<0) ? CRGB::Black : getPixelColorXY(xp,yp);
363363
CRGB next = ((vertical && yn>=dim1) || (!vertical && xn>=dim1)) ? CRGB::Black : getPixelColorXY(xn,yn);
364-
uint16_t r, g, b;
364+
unsigned r, g, b;
365365
r = (curr.r*keep + (prev.r + next.r)*seep) / 3;
366366
g = (curr.g*keep + (prev.g + next.g)*seep) / 3;
367367
b = (curr.b*keep + (prev.b + next.b)*seep) / 3;
368368
tmp[j] = CRGB(r,g,b);
369369
}
370-
for (int j = 0; j < dim1; j++) {
371-
uint16_t x = vertical ? i : j;
372-
uint16_t y = vertical ? j : i;
370+
for (unsigned j = 0; j < dim1; j++) {
371+
unsigned x = vertical ? i : j;
372+
unsigned y = vertical ? j : i;
373373
setPixelColorXY(x, y, tmp[j]);
374374
}
375375
}
@@ -389,14 +389,14 @@ void Segment::box_blur(uint16_t i, bool vertical, fract8 blur_amount) {
389389
// it can be used to (slowly) clear the LEDs to black.
390390

391391
void Segment::blur1d(fract8 blur_amount) {
392-
const uint16_t rows = virtualHeight();
392+
const unsigned rows = virtualHeight();
393393
for (unsigned y = 0; y < rows; y++) blurRow(y, blur_amount);
394394
}
395395

396396
void Segment::moveX(int8_t delta, bool wrap) {
397397
if (!isActive()) return; // not active
398-
const uint16_t cols = virtualWidth();
399-
const uint16_t rows = virtualHeight();
398+
const int cols = virtualWidth();
399+
const int rows = virtualHeight();
400400
if (!delta || abs(delta) >= cols) return;
401401
uint32_t newPxCol[cols];
402402
for (int y = 0; y < rows; y++) {
@@ -413,8 +413,8 @@ void Segment::moveX(int8_t delta, bool wrap) {
413413

414414
void Segment::moveY(int8_t delta, bool wrap) {
415415
if (!isActive()) return; // not active
416-
const uint16_t cols = virtualWidth();
417-
const uint16_t rows = virtualHeight();
416+
const int cols = virtualWidth();
417+
const int rows = virtualHeight();
418418
if (!delta || abs(delta) >= rows) return;
419419
uint32_t newPxCol[rows];
420420
for (int x = 0; x < cols; x++) {
@@ -474,36 +474,36 @@ void Segment::draw_circle(uint16_t cx, uint16_t cy, uint8_t radius, CRGB col) {
474474
// by stepko, taken from https://editor.soulmatelights.com/gallery/573-blobs
475475
void Segment::fill_circle(uint16_t cx, uint16_t cy, uint8_t radius, CRGB col) {
476476
if (!isActive() || radius == 0) return; // not active
477-
const uint16_t cols = virtualWidth();
478-
const uint16_t rows = virtualHeight();
479-
for (int16_t y = -radius; y <= radius; y++) {
480-
for (int16_t x = -radius; x <= radius; x++) {
477+
const int cols = virtualWidth();
478+
const int rows = virtualHeight();
479+
for (int y = -radius; y <= radius; y++) {
480+
for (int x = -radius; x <= radius; x++) {
481481
if (x * x + y * y <= radius * radius &&
482-
int16_t(cx)+x>=0 && int16_t(cy)+y>=0 &&
483-
int16_t(cx)+x<cols && int16_t(cy)+y<rows)
482+
int(cx)+x>=0 && int(cy)+y>=0 &&
483+
int(cx)+x<cols && int(cy)+y<rows)
484484
setPixelColorXY(cx + x, cy + y, col);
485485
}
486486
}
487487
}
488488

489489
void Segment::nscale8(uint8_t scale) {
490490
if (!isActive()) return; // not active
491-
const uint16_t cols = virtualWidth();
492-
const uint16_t rows = virtualHeight();
493-
for (int y = 0; y < rows; y++) for (int x = 0; x < cols; x++) {
491+
const unsigned cols = virtualWidth();
492+
const unsigned rows = virtualHeight();
493+
for (unsigned y = 0; y < rows; y++) for (unsigned x = 0; x < cols; x++) {
494494
setPixelColorXY(x, y, CRGB(getPixelColorXY(x, y)).nscale8(scale));
495495
}
496496
}
497497

498498
//line function
499499
void Segment::drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t c) {
500500
if (!isActive()) return; // not active
501-
const uint16_t cols = virtualWidth();
502-
const uint16_t rows = virtualHeight();
501+
const unsigned cols = virtualWidth();
502+
const unsigned rows = virtualHeight();
503503
if (x0 >= cols || x1 >= cols || y0 >= rows || y1 >= rows) return;
504-
const int16_t dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
505-
const int16_t dy = abs(y1-y0), sy = y0<y1 ? 1 : -1;
506-
int16_t err = (dx>dy ? dx : -dy)/2, e2;
504+
const int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
505+
const int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1;
506+
int err = (dx>dy ? dx : -dy)/2, e2;
507507
for (;;) {
508508
setPixelColorXY(x0,y0,c);
509509
if (x0==x1 && y0==y1) break;
@@ -525,8 +525,8 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
525525
if (!isActive()) return; // not active
526526
if (chr < 32 || chr > 126) return; // only ASCII 32-126 supported
527527
chr -= 32; // align with font table entries
528-
const uint16_t cols = virtualWidth();
529-
const uint16_t rows = virtualHeight();
528+
const int cols = virtualWidth();
529+
const int rows = virtualHeight();
530530
const int font = w*h;
531531

532532
CRGB col = CRGB(color);
@@ -565,7 +565,7 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
565565
void Segment::wu_pixel(uint32_t x, uint32_t y, CRGB c) { //awesome wu_pixel procedure by reddit u/sutaburosu
566566
if (!isActive()) return; // not active
567567
// extract the fractional parts and derive their inverses
568-
uint8_t xx = x & 0xff, yy = y & 0xff, ix = 255 - xx, iy = 255 - yy;
568+
unsigned xx = x & 0xff, yy = y & 0xff, ix = 255 - xx, iy = 255 - yy;
569569
// calculate the intensities for each affected pixel
570570
uint8_t wu[4] = {WU_WEIGHT(ix, iy), WU_WEIGHT(xx, iy),
571571
WU_WEIGHT(ix, yy), WU_WEIGHT(xx, yy)};

0 commit comments

Comments
 (0)