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)
This commit is contained in:
Frank
2023-04-01 22:13:46 +02:00
parent 4e8974a69b
commit 292c4e25ba
4 changed files with 30 additions and 4 deletions

View File

@@ -6037,6 +6037,8 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
SEGMENT.custom1 = *binNum;
SEGMENT.custom2 = *maxVol * 2;
}
if (SEGMENT.custom1 < 2) SEGMENT.custom1 = 2; // WLEDMM prevent stupid settings
if (SEGMENT.custom2 < 48) SEGMENT.custom1 = 48; // WLEDMM prevent stupid settings
*binNum = SEGMENT.custom1; // Select a bin.
*maxVol = SEGMENT.custom2 / 2; // Our volume comparator.
@@ -6598,6 +6600,8 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
SEGMENT.custom1 = *binNum;
SEGMENT.custom2 = *maxVol * 2;
}
if (SEGMENT.custom1 < 2) SEGMENT.custom1 = 2; // WLEDMM prevent stupid settings
if (SEGMENT.custom2 < 48) SEGMENT.custom1 = 48; // WLEDMM prevent stupid settings
*binNum = SEGMENT.custom1; // Select a bin.
*maxVol = SEGMENT.custom2 / 2; // Our volume comparator.
@@ -6794,9 +6798,17 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
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.
if (FFT_MajorPeak < 61.0f) pixCol = 0; // handle underflow
#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
uint16_t bright = (int) (sqrtf(my_magnitude)*16.0f); // WLEDMM sqrt scaling, to make peaks more prominent
#else
uint16_t bright = (int)my_magnitude;
#endif
SEGMENT.setPixelColor(locn, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(SEGMENT.intensity+pixCol, false, PALETTE_SOLID_WRAP, 0), bright));
if (SEGMENT.speed > 228) { // WLEDMM looks nice in 2D
SEGMENT.blur(5*(SEGMENT.speed - 224));
SEGMENT.setPixelColor(locn, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(SEGMENT.intensity+pixCol, false, PALETTE_SOLID_WRAP, 0), bright));
}
return FRAMETIME;
} // mode_freqmap()
@@ -7110,6 +7122,9 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
SEGMENT.custom2 = *maxVol * 2;
}
if (SEGMENT.custom1 < 2) SEGMENT.custom1 = 2; // WLEDMM prevent stupid settings
if (SEGMENT.custom2 < 48) SEGMENT.custom1 = 48; // WLEDMM prevent stupid settings
*binNum = SEGMENT.custom1; // Select a bin.
*maxVol = SEGMENT.custom2 / 2; // Our volume comparator.

View File

@@ -326,7 +326,7 @@ static byte gammaT[256] = {
// https://github.com/Aircoookie/WLED/issues/2767#issuecomment-1310961308
// unfortunately NepixelsBu has its own internal table, that kills low brightness values similar to the original WLED table.
// see https://github.com/Makuna/NeoPixelBus/blob/master/src/internal/NeoGamma.h
static byte gammaT[256] = {
static const byte gammaT[256] = {
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
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)
// re-calculates & fills gamma table
void calcGammaTable(float gamma)
{
#if !defined(WLED_USE_CIE_BRIGHTNESS_TABLE) // WLEDMM not possible when using the CIE table
for (uint16_t i = 0; i < 256; i++) {
gammaT[i] = gamma8_cal(i, gamma);
}
#endif
}
// used for individual channel or brightness gamma correction

View File

@@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2303300
#define VERSION 2303310
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG