From 2d75526395237e8fb78e9063a6588b31c86a3cce Mon Sep 17 00:00:00 2001 From: cschwinne Date: Mon, 24 Feb 2020 19:36:25 +0100 Subject: [PATCH] Fix brightness transition updating too often --- wled00/FX.h | 3 +++ wled00/FX_fcn.cpp | 5 +---- wled00/wled00.ino | 3 +-- wled00/wled01_eeprom.ino | 4 ++-- wled00/wled08_led.ino | 7 ------- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/wled00/FX.h b/wled00/FX.h index eec42990..a518317f 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -56,6 +56,9 @@ #define MAX_SEGMENT_DATA 8192 #endif +#define LED_SKIP_AMOUNT 1 +#define MIN_SHOW_DELAY 15 + #define NUM_COLORS 3 /* number of colors per segment */ #define SEGMENT _segments[_segment_index] #define SEGCOLOR(x) gamma32(_segments[_segment_index].colors[x]) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 0707392d..b495de64 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -27,9 +27,6 @@ #include "FX.h" #include "palettes.h" -#define LED_SKIP_AMOUNT 1 -#define MIN_SHOW_DELAY 15 - void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst) { if (supportWhite == _useRgbw && countPixels == _length) return; @@ -380,7 +377,7 @@ void WS2812FX::setBrightness(uint8_t b) { if (_brightness == b) return; _brightness = (gammaCorrectBri) ? gamma8(b) : b; _segment_index = 0; - if (SEGENV.next_time > millis() + 22) show();//apply brightness change immediately if no refresh soon + if (SEGENV.next_time > millis() + 22 && millis() - _lastShow > MIN_SHOW_DELAY) show();//apply brightness change immediately if no refresh soon } uint8_t WS2812FX::getMode(void) { diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 445406b9..66a17eea 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -119,7 +119,7 @@ DMXESPSerial dmx; #endif //version code in format yymmddb (b = daily build) -#define VERSION 2002242 +#define VERSION 2002243 char versionString[] = "0.9.1"; @@ -167,7 +167,6 @@ byte nightlightDelayMins = 60; bool nightlightFade = true; //if enabled, light will gradually dim towards the target bri. Otherwise, it will instantly set after delay over bool nightlightColorFade = false; //if enabled, light will gradually fade color from primary to secondary color. bool fadeTransition = true; //enable crossfading color transition -bool enableSecTransition = true; //also enable transition for secondary color uint16_t transitionDelay = 750; //default crossfade duration in ms bool skipFirstLed = false; //ignore first LED in strip (useful if you need the LED as signal repeater) diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index 0ff9497f..703785c1 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -159,7 +159,7 @@ void saveSettingsToEEPROM() EEPROM.write(396, (utcOffsetSecs<0)); //is negative EEPROM.write(397, syncToggleReceive); EEPROM.write(398, (ledCount >> 8) & 0xFF); - EEPROM.write(399, !enableSecTransition); + //EEPROM.write(399, was !enableSecTransition); //favorite setting (preset) memory (25 slots/ each 20byte) //400 - 940 reserved @@ -527,7 +527,7 @@ void loadSettingsFromEEPROM(bool first) wifiLock = EEPROM.read(393); utcOffsetSecs = EEPROM.read(394) + ((EEPROM.read(395) << 8) & 0xFF00); if (EEPROM.read(396)) utcOffsetSecs = -utcOffsetSecs; //negative - enableSecTransition = !EEPROM.read(399); + //!EEPROM.read(399); was enableSecTransition //favorite setting (preset) memory (25 slots/ each 20byte) //400 - 899 reserved diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino index 3764a57c..93642fc2 100644 --- a/wled00/wled08_led.ino +++ b/wled00/wled08_led.ino @@ -40,13 +40,6 @@ void setAllLeds() { if (val > 255) val = 255; strip.setBrightness(val); } - if (!enableSecTransition) - { - for (byte i = 0; i<4; i++) - { - colSecT[i] = colSec[i]; - } - } if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) { colorRGBtoRGBW(colT);