From 2635a3edd08c58779fdf574e2b28f136933631f5 Mon Sep 17 00:00:00 2001 From: garyd9 Date: Tue, 4 Aug 2020 09:32:54 -0400 Subject: [PATCH] rename global var "local" to "localTime" --- wled00/ntp.cpp | 26 +++++++++++++------------- wled00/overlay.cpp | 22 +++++++++++----------- wled00/wled.h | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/wled00/ntp.cpp b/wled00/ntp.cpp index 4836ed34..5a796296 100644 --- a/wled00/ntp.cpp +++ b/wled00/ntp.cpp @@ -142,24 +142,24 @@ bool checkNTPResponse() void updateLocalTime() { unsigned long tmc = now()+ utcOffsetSecs; - local = timezones[currentTimezone]->toLocal(tmc); + localTime = timezones[currentTimezone]->toLocal(tmc); } void getTimeString(char* out) { updateLocalTime(); - byte hr = hour(local); + byte hr = hour(localTime); if (useAMPM) { if (hr > 11) hr -= 12; if (hr == 0) hr = 12; } - sprintf(out,"%i-%i-%i, %i:%s%i:%s%i",year(local), month(local), day(local), - hr,(minute(local)<10)?"0":"",minute(local), - (second(local)<10)?"0":"",second(local)); + sprintf(out,"%i-%i-%i, %i:%s%i:%s%i",year(localTime), month(localTime), day(localTime), + hr,(minute(localTime)<10)?"0":"",minute(localTime), + (second(localTime)<10)?"0":"",second(localTime)); if (useAMPM) { - strcat(out,(hour(local) > 11)? " PM":" AM"); + strcat(out,(hour(localTime) > 11)? " PM":" AM"); } } @@ -173,9 +173,9 @@ void setCountdown() bool checkCountdown() { unsigned long n = now(); - if (countdownMode) local = countdownTime - n + utcOffsetSecs; + if (countdownMode) localTime = countdownTime - n + utcOffsetSecs; if (n > countdownTime) { - if (countdownMode) local = n - countdownTime + utcOffsetSecs; + if (countdownMode) localTime = n - countdownTime + utcOffsetSecs; if (!countdownOverTriggered) { if (macroCountdown != 0) applyMacro(macroCountdown); @@ -188,21 +188,21 @@ bool checkCountdown() byte weekdayMondayFirst() { - byte wd = weekday(local) -1; + byte wd = weekday(localTime) -1; if (wd == 0) wd = 7; return wd; } void checkTimers() { - if (lastTimerMinute != minute(local)) //only check once a new minute begins + if (lastTimerMinute != minute(localTime)) //only check once a new minute begins { - lastTimerMinute = minute(local); + lastTimerMinute = minute(localTime); for (uint8_t i = 0; i < 8; i++) { if (timerMacro[i] != 0 - && (timerHours[i] == hour(local) || timerHours[i] == 24) //if hour is set to 24, activate every hour - && timerMinutes[i] == minute(local) + && (timerHours[i] == hour(localTime) || timerHours[i] == 24) //if hour is set to 24, activate every hour + && timerMinutes[i] == minute(localTime) && (timerWeekday[i] & 0x01) //timer is enabled && timerWeekday[i] >> weekdayMondayFirst() & 0x01) //timer should activate at current day of week { diff --git a/wled00/overlay.cpp b/wled00/overlay.cpp index ceb6fc20..cbb94c01 100644 --- a/wled00/overlay.cpp +++ b/wled00/overlay.cpp @@ -40,10 +40,10 @@ void _overlayAnalogClock() { _overlayAnalogCountdown(); return; } - double hourP = ((double)(hour(local)%12))/12; - double minuteP = ((double)minute(local))/60; + double hourP = ((double)(hour(localTime)%12))/12; + double minuteP = ((double)minute(localTime))/60; hourP = hourP + minuteP/12; - double secondP = ((double)second(local))/60; + double secondP = ((double)second(localTime))/60; int hourPixel = floor(analogClock12pixel + overlaySize*hourP); if (hourPixel > overlayMax) hourPixel = overlayMin -1 + hourPixel - overlayMax; int minutePixel = floor(analogClock12pixel + overlaySize*minuteP); @@ -279,13 +279,13 @@ void setCronixie() void _overlayCronixie() { - byte h = hour(local); + byte h = hour(localTime); byte h0 = h; - byte m = minute(local); - byte s = second(local); - byte d = day(local); - byte mi = month(local); - int y = year(local); + byte m = minute(localTime); + byte s = second(localTime); + byte d = day(localTime); + byte mi = month(localTime); + int y = year(localTime); //this has to be changed in time for 22nd century y -= 2000; if (y<0) y += 30; //makes countdown work @@ -310,7 +310,7 @@ void _overlayCronixie() case 24: _digitOut[i] = m/10; break; //M case 30: _digitOut[i] = s/10; break; //S - case 43: _digitOut[i] = weekday(local); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //D + case 43: _digitOut[i] = weekday(localTime); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //D case 44: _digitOut[i] = d/10; _digitOut[i+1] = d- _digitOut[i]*10; i++; break; //DD case 40: _digitOut[i] = mi/10; _digitOut[i+1] = mi- _digitOut[i]*10; i++; break; //II case 37: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //YY @@ -331,7 +331,7 @@ void _overlayCronixie() //case 65: _digitOut[i+1] = (h0>17 || (h0>5 && h0<12))?1:10; i++; //bb case 64: _digitOut[i] = (h0>11)?1:10; break; //b - case 93: _digitOut[i] = weekday(local); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //d + case 93: _digitOut[i] = weekday(localTime); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //d case 94: _digitOut[i] = d/10; _digitOut[i+1] = d- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //dd case 90: _digitOut[i] = mi/10; _digitOut[i+1] = mi- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //ii case 87: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //yy diff --git a/wled00/wled.h b/wled00/wled.h index fbe6ab01..5e19d2de 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -455,7 +455,7 @@ WLED_GLOBAL DNSServer dnsServer; // network time WLED_GLOBAL bool ntpConnected _INIT(false); -WLED_GLOBAL time_t local _INIT(0); +WLED_GLOBAL time_t localTime _INIT(0); WLED_GLOBAL unsigned long ntpLastSyncTime _INIT(999000000L); WLED_GLOBAL unsigned long ntpPacketSentTime _INIT(999000000L); WLED_GLOBAL IPAddress ntpServerIP;