Merge pull request #1078 from garyd9/global-local-to-localTime
rename global var "local" to "localTime"
This commit is contained in:
commit
230e3ef842
@ -142,24 +142,24 @@ bool checkNTPResponse()
|
|||||||
void updateLocalTime()
|
void updateLocalTime()
|
||||||
{
|
{
|
||||||
unsigned long tmc = now()+ utcOffsetSecs;
|
unsigned long tmc = now()+ utcOffsetSecs;
|
||||||
local = timezones[currentTimezone]->toLocal(tmc);
|
localTime = timezones[currentTimezone]->toLocal(tmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void getTimeString(char* out)
|
void getTimeString(char* out)
|
||||||
{
|
{
|
||||||
updateLocalTime();
|
updateLocalTime();
|
||||||
byte hr = hour(local);
|
byte hr = hour(localTime);
|
||||||
if (useAMPM)
|
if (useAMPM)
|
||||||
{
|
{
|
||||||
if (hr > 11) hr -= 12;
|
if (hr > 11) hr -= 12;
|
||||||
if (hr == 0) hr = 12;
|
if (hr == 0) hr = 12;
|
||||||
}
|
}
|
||||||
sprintf(out,"%i-%i-%i, %i:%s%i:%s%i",year(local), month(local), day(local),
|
sprintf(out,"%i-%i-%i, %i:%s%i:%s%i",year(localTime), month(localTime), day(localTime),
|
||||||
hr,(minute(local)<10)?"0":"",minute(local),
|
hr,(minute(localTime)<10)?"0":"",minute(localTime),
|
||||||
(second(local)<10)?"0":"",second(local));
|
(second(localTime)<10)?"0":"",second(localTime));
|
||||||
if (useAMPM)
|
if (useAMPM)
|
||||||
{
|
{
|
||||||
strcat(out,(hour(local) > 11)? " PM":" AM");
|
strcat(out,(hour(localTime) > 11)? " PM":" AM");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,9 +173,9 @@ void setCountdown()
|
|||||||
bool checkCountdown()
|
bool checkCountdown()
|
||||||
{
|
{
|
||||||
unsigned long n = now();
|
unsigned long n = now();
|
||||||
if (countdownMode) local = countdownTime - n + utcOffsetSecs;
|
if (countdownMode) localTime = countdownTime - n + utcOffsetSecs;
|
||||||
if (n > countdownTime) {
|
if (n > countdownTime) {
|
||||||
if (countdownMode) local = n - countdownTime + utcOffsetSecs;
|
if (countdownMode) localTime = n - countdownTime + utcOffsetSecs;
|
||||||
if (!countdownOverTriggered)
|
if (!countdownOverTriggered)
|
||||||
{
|
{
|
||||||
if (macroCountdown != 0) applyMacro(macroCountdown);
|
if (macroCountdown != 0) applyMacro(macroCountdown);
|
||||||
@ -188,21 +188,21 @@ bool checkCountdown()
|
|||||||
|
|
||||||
byte weekdayMondayFirst()
|
byte weekdayMondayFirst()
|
||||||
{
|
{
|
||||||
byte wd = weekday(local) -1;
|
byte wd = weekday(localTime) -1;
|
||||||
if (wd == 0) wd = 7;
|
if (wd == 0) wd = 7;
|
||||||
return wd;
|
return wd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkTimers()
|
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++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (timerMacro[i] != 0
|
if (timerMacro[i] != 0
|
||||||
&& (timerHours[i] == hour(local) || timerHours[i] == 24) //if hour is set to 24, activate every hour
|
&& (timerHours[i] == hour(localTime) || timerHours[i] == 24) //if hour is set to 24, activate every hour
|
||||||
&& timerMinutes[i] == minute(local)
|
&& timerMinutes[i] == minute(localTime)
|
||||||
&& (timerWeekday[i] & 0x01) //timer is enabled
|
&& (timerWeekday[i] & 0x01) //timer is enabled
|
||||||
&& timerWeekday[i] >> weekdayMondayFirst() & 0x01) //timer should activate at current day of week
|
&& timerWeekday[i] >> weekdayMondayFirst() & 0x01) //timer should activate at current day of week
|
||||||
{
|
{
|
||||||
|
@ -40,10 +40,10 @@ void _overlayAnalogClock()
|
|||||||
{
|
{
|
||||||
_overlayAnalogCountdown(); return;
|
_overlayAnalogCountdown(); return;
|
||||||
}
|
}
|
||||||
double hourP = ((double)(hour(local)%12))/12;
|
double hourP = ((double)(hour(localTime)%12))/12;
|
||||||
double minuteP = ((double)minute(local))/60;
|
double minuteP = ((double)minute(localTime))/60;
|
||||||
hourP = hourP + minuteP/12;
|
hourP = hourP + minuteP/12;
|
||||||
double secondP = ((double)second(local))/60;
|
double secondP = ((double)second(localTime))/60;
|
||||||
int hourPixel = floor(analogClock12pixel + overlaySize*hourP);
|
int hourPixel = floor(analogClock12pixel + overlaySize*hourP);
|
||||||
if (hourPixel > overlayMax) hourPixel = overlayMin -1 + hourPixel - overlayMax;
|
if (hourPixel > overlayMax) hourPixel = overlayMin -1 + hourPixel - overlayMax;
|
||||||
int minutePixel = floor(analogClock12pixel + overlaySize*minuteP);
|
int minutePixel = floor(analogClock12pixel + overlaySize*minuteP);
|
||||||
@ -279,13 +279,13 @@ void setCronixie()
|
|||||||
|
|
||||||
void _overlayCronixie()
|
void _overlayCronixie()
|
||||||
{
|
{
|
||||||
byte h = hour(local);
|
byte h = hour(localTime);
|
||||||
byte h0 = h;
|
byte h0 = h;
|
||||||
byte m = minute(local);
|
byte m = minute(localTime);
|
||||||
byte s = second(local);
|
byte s = second(localTime);
|
||||||
byte d = day(local);
|
byte d = day(localTime);
|
||||||
byte mi = month(local);
|
byte mi = month(localTime);
|
||||||
int y = year(local);
|
int y = year(localTime);
|
||||||
//this has to be changed in time for 22nd century
|
//this has to be changed in time for 22nd century
|
||||||
y -= 2000; if (y<0) y += 30; //makes countdown work
|
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 24: _digitOut[i] = m/10; break; //M
|
||||||
case 30: _digitOut[i] = s/10; break; //S
|
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 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 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
|
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 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 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 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 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
|
case 87: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //yy
|
||||||
|
@ -455,7 +455,7 @@ WLED_GLOBAL DNSServer dnsServer;
|
|||||||
|
|
||||||
// network time
|
// network time
|
||||||
WLED_GLOBAL bool ntpConnected _INIT(false);
|
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 ntpLastSyncTime _INIT(999000000L);
|
||||||
WLED_GLOBAL unsigned long ntpPacketSentTime _INIT(999000000L);
|
WLED_GLOBAL unsigned long ntpPacketSentTime _INIT(999000000L);
|
||||||
WLED_GLOBAL IPAddress ntpServerIP;
|
WLED_GLOBAL IPAddress ntpServerIP;
|
||||||
|
Loading…
Reference in New Issue
Block a user