Correct sun rise (#713)

This commit is contained in:
Def3nder 2020-02-24 17:27:59 +01:00 committed by GitHub
parent 89f60a0422
commit 2e77dcc660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
byte bootPreset = 0; //save preset to load after power-up
byte col[] {255, 160, 0, 0}; //default RGB(W) color
byte colSec[] {0, 0, 0, 0}; //default RGB(W) secondary 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}; //current RGB(W) secondary color
byte briS = 128; //default brightness
byte nightlightTargetBri = 0; //brightness after nightlight is over
@ -282,7 +282,7 @@ bool wasConnected = false;
//color
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 colSecT[] {0, 0, 0, 0};
byte colSecOld[] {0, 0, 0, 0};

View File

@ -227,15 +227,15 @@ void handleNightlight()
nightlightDelayMs = (int)(nightlightDelayMins*60000);
nightlightActiveOld = true;
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);
if (nightlightFade)
{
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);
}