Skip to content

Commit 292c4e2

Browse files
committed
small updates
* colors.cpp: disable gamma calculation if CIE table mode is active (WLED_USE_CIE_BRIGHTNESS_TABLE) * fx.cpp: small improvement to FreqMap, and bugfix for effects that modify binNum / maxVol * pio: update for Line-In shield pins (final hardware version)
1 parent 4e8974a commit 292c4e2

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

platformio.ini

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,9 +940,16 @@ build_flags =
940940
-D SR_SQUELCH=10 -D SR_GAIN=40 -D SR_FREQ_PROF=7 ; SPM1423 specific
941941

942942
[Shield_LineIn]
943+
build_unflags =
944+
-D BTNPIN=17 ;; remove - its in conflict with on-shield rotary
945+
-D ENCODER_SW_PIN=5 ;; remove - its in conflict with on-shield rotary
946+
-D BTNPIN=0 ;; remove - its in conflict with MCLK pin
943947
build_flags =
944-
-D SR_DMTYPE=4 -D MCLK_PIN=0 -D I2S_SDPIN=25 -D I2S_WSPIN=15 -D I2S_CKPIN=14 ; for audio Line-In shield
945-
-D SR_SQUELCH=2 -D SR_GAIN=40 -D SR_FREQ_PROF=1 ; CS5343 Line-In specific
948+
-D BTNPIN=-1
949+
-D SR_DMTYPE=4 -D MCLK_PIN=0 -D I2S_SDPIN=26 -D I2S_WSPIN=25 -D I2S_CKPIN=27 ; for audio Line-In shield, final version
950+
-D SR_LINE_DETECT=34 ; line-in plug insert detection sensor (future support)
951+
-D SR_SQUELCH=8 -D SR_GAIN=40 -D SR_FREQ_PROF=1 ; CS5343 Line-In specific
952+
-D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=39 -D ENCODER_SW_PIN=17 ; on-shield rotary encoder
946953

947954
[Debug_Flags]
948955
build_flags =
@@ -1547,6 +1554,7 @@ build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_SPM1423.buil
15471554

15481555
[env:wemos_shield_esp32_4MB_LineIn_M]
15491556
extends = wemos_shield_esp32_4MB_M_base
1557+
build_unflags = ${common.build_unflags} ${Shield_LineIn.build_unflags}
15501558
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_LineIn.build_flags}
15511559
-D WLED_RELEASE_NAME=wemos_shield_esp32_4MB_LineIn_M
15521560

@@ -1602,6 +1610,7 @@ board_build.partitions = tools/WLED_ESP32_16MB.csv ;; WLED standard for
16021610

16031611
[env:wemos_shield_esp32_16MB_LineIn_M]
16041612
extends = wemos_shield_esp32_4MB_M_base
1613+
build_unflags = ${common.build_unflags} ${Shield_LineIn.build_unflags}
16051614
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_LineIn.build_flags}
16061615
-D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_LineIn_M
16071616
board = esp32_16MB

wled00/FX.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6037,6 +6037,8 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
60376037
SEGMENT.custom1 = *binNum;
60386038
SEGMENT.custom2 = *maxVol * 2;
60396039
}
6040+
if (SEGMENT.custom1 < 2) SEGMENT.custom1 = 2; // WLEDMM prevent stupid settings
6041+
if (SEGMENT.custom2 < 48) SEGMENT.custom1 = 48; // WLEDMM prevent stupid settings
60406042

60416043
*binNum = SEGMENT.custom1; // Select a bin.
60426044
*maxVol = SEGMENT.custom2 / 2; // Our volume comparator.
@@ -6598,6 +6600,8 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
65986600
SEGMENT.custom1 = *binNum;
65996601
SEGMENT.custom2 = *maxVol * 2;
66006602
}
6603+
if (SEGMENT.custom1 < 2) SEGMENT.custom1 = 2; // WLEDMM prevent stupid settings
6604+
if (SEGMENT.custom2 < 48) SEGMENT.custom1 = 48; // WLEDMM prevent stupid settings
66016605

66026606
*binNum = SEGMENT.custom1; // Select a bin.
66036607
*maxVol = SEGMENT.custom2 / 2; // Our volume comparator.
@@ -6794,9 +6798,17 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
67946798
uint16_t pixCol = (log10f(FFT_MajorPeak) - 1.78f) * 255.0f/(MAX_FREQ_LOG10 - 1.78f); // Scale log10 of frequency values to the 255 colour index.
67956799
if (FFT_MajorPeak < 61.0f) pixCol = 0; // handle underflow
67966800

6801+
#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
6802+
uint16_t bright = (int) (sqrtf(my_magnitude)*16.0f); // WLEDMM sqrt scaling, to make peaks more prominent
6803+
#else
67976804
uint16_t bright = (int)my_magnitude;
6805+
#endif
67986806

67996807
SEGMENT.setPixelColor(locn, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(SEGMENT.intensity+pixCol, false, PALETTE_SOLID_WRAP, 0), bright));
6808+
if (SEGMENT.speed > 228) { // WLEDMM looks nice in 2D
6809+
SEGMENT.blur(5*(SEGMENT.speed - 224));
6810+
SEGMENT.setPixelColor(locn, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(SEGMENT.intensity+pixCol, false, PALETTE_SOLID_WRAP, 0), bright));
6811+
}
68006812

68016813
return FRAMETIME;
68026814
} // mode_freqmap()
@@ -7110,6 +7122,9 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
71107122
SEGMENT.custom2 = *maxVol * 2;
71117123
}
71127124

7125+
if (SEGMENT.custom1 < 2) SEGMENT.custom1 = 2; // WLEDMM prevent stupid settings
7126+
if (SEGMENT.custom2 < 48) SEGMENT.custom1 = 48; // WLEDMM prevent stupid settings
7127+
71137128
*binNum = SEGMENT.custom1; // Select a bin.
71147129
*maxVol = SEGMENT.custom2 / 2; // Our volume comparator.
71157130

wled00/colors.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ static byte gammaT[256] = {
326326
// https://github.com/Aircoookie/WLED/issues/2767#issuecomment-1310961308
327327
// unfortunately NepixelsBu has its own internal table, that kills low brightness values similar to the original WLED table.
328328
// see https://github.com/Makuna/NeoPixelBus/blob/master/src/internal/NeoGamma.h
329-
static byte gammaT[256] = {
329+
static const byte gammaT[256] = {
330330
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
331331
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
332332
4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
@@ -354,9 +354,11 @@ uint8_t gamma8_cal(uint8_t b, float gamma)
354354
// re-calculates & fills gamma table
355355
void calcGammaTable(float gamma)
356356
{
357+
#if !defined(WLED_USE_CIE_BRIGHTNESS_TABLE) // WLEDMM not possible when using the CIE table
357358
for (uint16_t i = 0; i < 256; i++) {
358359
gammaT[i] = gamma8_cal(i, gamma);
359360
}
361+
#endif
360362
}
361363

362364
// used for individual channel or brightness gamma correction

wled00/wled.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
// version code in format yymmddb (b = daily build)
11-
#define VERSION 2303300
11+
#define VERSION 2303310
1212

1313
//uncomment this if you have a "my_config.h" file you'd like to use
1414
//#define WLED_USE_MY_CONFIG

0 commit comments

Comments
 (0)