Correct SunRise/NightLight with Color Fade (#710)

This commit is contained in:
Def3nder 2020-02-23 22:21:32 +01:00 committed by GitHub
parent 392277100c
commit 513bc2c0ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,15 +231,15 @@ void handleNightlight()
nightlightDelayMs = (int)(nightlightDelayMins*60000);
nightlightActiveOld = true;
briNlT = bri;
for (byte i=0; i<4; i++) colNlT[i] = col[i]; // remember starting color
for (byte i=0; i<4; i++) colNlT[i] = colT[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++) col[i] = colNlT[i]+ ((colSec[i] - colNlT[i])*nper); // fading from actual color to secondary color
for (byte i=0; i<4; i++) colT[i] = colNlT[i]+ ((colSecT[i] - colNlT[i])*nper); // fading from actual color to secondary color
}
colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY);
}