Few Cronixie fixes

This commit is contained in:
cschwinne 2020-01-01 01:04:54 +01:00
parent 51fb981d24
commit 4dfc1631af
3 changed files with 14 additions and 11 deletions

View File

@ -622,6 +622,10 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
//cronixie
#ifndef WLED_DISABLE_CRONIXIE
//mode, 1 countdown
pos = req.indexOf("NM=");
if (pos > 0) countdownMode = (req.charAt(pos+3) != '0');
pos = req.indexOf("NX="); //sets digits to code
if (pos > 0) {
strlcpy(cronixieDisplay, req.substring(pos + 3, pos + 9).c_str(), 6);
@ -636,9 +640,6 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
overlayRefreshedTime = 0;
}
#endif
//mode, 1 countdown
pos = req.indexOf("NM=");
if (pos > 0) countdownMode = (req.charAt(pos+3) != '0');
pos = req.indexOf("U0="); //user var 0
if (pos > 0) {

View File

@ -163,13 +163,16 @@ void setCountdown()
//returns true if countdown just over
bool checkCountdown()
{
long diff = countdownTime - now();
local = abs(diff);
if (diff <0 && !countdownOverTriggered)
{
if (macroCountdown != 0) applyMacro(macroCountdown);
countdownOverTriggered = true;
return true;
unsigned long n = now();
local = countdownTime - n;
if (n > countdownTime) {
local = n - countdownTime;
if (!countdownOverTriggered)
{
if (macroCountdown != 0) applyMacro(macroCountdown);
countdownOverTriggered = true;
return true;
}
}
return false;
}

View File

@ -147,7 +147,6 @@ void _overlayCronixie()
{
if (countdownMode) checkCountdown();
#ifndef WLED_DISABLE_CRONIXIE
byte h = hour(local);
byte h0 = h;
byte m = minute(local);