Fix brightness transition updating too often

This commit is contained in:
cschwinne 2020-02-24 19:36:25 +01:00
parent cd618a43d4
commit 2d75526395
5 changed files with 7 additions and 15 deletions

View File

@ -56,6 +56,9 @@
#define MAX_SEGMENT_DATA 8192 #define MAX_SEGMENT_DATA 8192
#endif #endif
#define LED_SKIP_AMOUNT 1
#define MIN_SHOW_DELAY 15
#define NUM_COLORS 3 /* number of colors per segment */ #define NUM_COLORS 3 /* number of colors per segment */
#define SEGMENT _segments[_segment_index] #define SEGMENT _segments[_segment_index]
#define SEGCOLOR(x) gamma32(_segments[_segment_index].colors[x]) #define SEGCOLOR(x) gamma32(_segments[_segment_index].colors[x])

View File

@ -27,9 +27,6 @@
#include "FX.h" #include "FX.h"
#include "palettes.h" #include "palettes.h"
#define LED_SKIP_AMOUNT 1
#define MIN_SHOW_DELAY 15
void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst) void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
{ {
if (supportWhite == _useRgbw && countPixels == _length) return; if (supportWhite == _useRgbw && countPixels == _length) return;
@ -380,7 +377,7 @@ void WS2812FX::setBrightness(uint8_t b) {
if (_brightness == b) return; if (_brightness == b) return;
_brightness = (gammaCorrectBri) ? gamma8(b) : b; _brightness = (gammaCorrectBri) ? gamma8(b) : b;
_segment_index = 0; _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) { uint8_t WS2812FX::getMode(void) {

View File

@ -119,7 +119,7 @@ DMXESPSerial dmx;
#endif #endif
//version code in format yymmddb (b = daily build) //version code in format yymmddb (b = daily build)
#define VERSION 2002242 #define VERSION 2002243
char versionString[] = "0.9.1"; 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 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 nightlightColorFade = false; //if enabled, light will gradually fade color from primary to secondary color.
bool fadeTransition = true; //enable crossfading color transition 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 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) bool skipFirstLed = false; //ignore first LED in strip (useful if you need the LED as signal repeater)

View File

@ -159,7 +159,7 @@ void saveSettingsToEEPROM()
EEPROM.write(396, (utcOffsetSecs<0)); //is negative EEPROM.write(396, (utcOffsetSecs<0)); //is negative
EEPROM.write(397, syncToggleReceive); EEPROM.write(397, syncToggleReceive);
EEPROM.write(398, (ledCount >> 8) & 0xFF); EEPROM.write(398, (ledCount >> 8) & 0xFF);
EEPROM.write(399, !enableSecTransition); //EEPROM.write(399, was !enableSecTransition);
//favorite setting (preset) memory (25 slots/ each 20byte) //favorite setting (preset) memory (25 slots/ each 20byte)
//400 - 940 reserved //400 - 940 reserved
@ -527,7 +527,7 @@ void loadSettingsFromEEPROM(bool first)
wifiLock = EEPROM.read(393); wifiLock = EEPROM.read(393);
utcOffsetSecs = EEPROM.read(394) + ((EEPROM.read(395) << 8) & 0xFF00); utcOffsetSecs = EEPROM.read(394) + ((EEPROM.read(395) << 8) & 0xFF00);
if (EEPROM.read(396)) utcOffsetSecs = -utcOffsetSecs; //negative if (EEPROM.read(396)) utcOffsetSecs = -utcOffsetSecs; //negative
enableSecTransition = !EEPROM.read(399); //!EEPROM.read(399); was enableSecTransition
//favorite setting (preset) memory (25 slots/ each 20byte) //favorite setting (preset) memory (25 slots/ each 20byte)
//400 - 899 reserved //400 - 899 reserved

View File

@ -40,13 +40,6 @@ void setAllLeds() {
if (val > 255) val = 255; if (val > 255) val = 255;
strip.setBrightness(val); strip.setBrightness(val);
} }
if (!enableSecTransition)
{
for (byte i = 0; i<4; i++)
{
colSecT[i] = colSec[i];
}
}
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY)
{ {
colorRGBtoRGBW(colT); colorRGBtoRGBW(colT);