This commit is contained in:
cschwinne 2020-02-24 19:08:35 +01:00
commit 3589adcb78
2 changed files with 6 additions and 6 deletions

View File

@ -150,8 +150,8 @@ bool useRGBW = false; //SK6812 strips can contain an ext
bool turnOnAtBoot = true; //turn on LEDs at power-up bool turnOnAtBoot = true; //turn on LEDs at power-up
byte bootPreset = 0; //save preset to load after power-up byte bootPreset = 0; //save preset to load after power-up
byte col[] {255, 160, 0, 0}; //default RGB(W) color byte col[] {255, 160, 0, 0}; //current RGB(W) primary color. col[] should be updated if you want to change the color.
byte colSec[] {0, 0, 0, 0}; //default RGB(W) secondary color byte colSec[] {0, 0, 0, 0}; //current RGB(W) secondary color
byte briS = 128; //default brightness byte briS = 128; //default brightness
byte nightlightTargetBri = 0; //brightness after nightlight is over byte nightlightTargetBri = 0; //brightness after nightlight is over
@ -282,7 +282,7 @@ bool wasConnected = false;
//color //color
byte colOld[] {0, 0, 0, 0}; //color before transition byte colOld[] {0, 0, 0, 0}; //color before transition
byte colT[] {0, 0, 0, 0}; //current color byte colT[] {0, 0, 0, 0}; //color that is currently displayed on the LEDs
byte colIT[] {0, 0, 0, 0}; //color that was last sent to LEDs byte colIT[] {0, 0, 0, 0}; //color that was last sent to LEDs
byte colSecT[] {0, 0, 0, 0}; byte colSecT[] {0, 0, 0, 0};
byte colSecOld[] {0, 0, 0, 0}; byte colSecOld[] {0, 0, 0, 0};

View File

@ -227,15 +227,15 @@ void handleNightlight()
nightlightDelayMs = (int)(nightlightDelayMins*60000); nightlightDelayMs = (int)(nightlightDelayMins*60000);
nightlightActiveOld = true; nightlightActiveOld = true;
briNlT = bri; briNlT = bri;
for (byte i=0; i<4; i++) colNlT[i] = colT[i]; // remember starting color for (byte i=0; i<4; i++) colNlT[i] = col[i]; // remember starting color
} }
float nper = (millis() - nightlightStartTime)/((float)nightlightDelayMs); float nper = (millis() - nightlightStartTime)/((float)nightlightDelayMs);
if (nightlightFade) if (nightlightFade)
{ {
bri = briNlT + ((nightlightTargetBri - briNlT)*nper); bri = briNlT + ((nightlightTargetBri - briNlT)*nper);
if (nightlightColorFade) // color fading only is enabled with "NF=2" if (nightlightColorFade) // color fading only is enabled with "NF=2"
{ {
for (byte i=0; i<4; i++) colT[i] = colNlT[i]+ ((colSecT[i] - colNlT[i])*nper); // fading from actual color to secondary color for (byte i=0; i<4; i++) col[i] = colNlT[i]+ ((colSec[i] - colNlT[i])*nper); // fading from actual color to secondary color
} }
colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY); colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY);
} }