mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 23:07:17 +00:00
Deduplicate xdrv_09_timers.ino also
Turns out even TimerGetTimeOfDay was duplicate code from ApplyTimerOffsets Did add a fix for the permanent day/night situation
This commit is contained in:
parent
0eebdf8620
commit
a47f6baf2f
@ -253,10 +253,10 @@ uint16_t TimerGetTimeOfDay(uint8_t index)
|
||||
int16_t xtime = xtimer.time;
|
||||
#ifdef USE_SUNRISE
|
||||
if (xtimer.mode) {
|
||||
if (xtime >= 12*60) xtime = 12*60 - xtime;
|
||||
xtime += (int16_t)SunMinutes(xtimer.mode-1);
|
||||
if (xtime < 0) xtime += 24*60;
|
||||
if (xtime >= 24*60) xtime -= 24*60;
|
||||
ApplyTimerOffsets(&xtimer);
|
||||
xtime = xtimer.time;
|
||||
if (xtime==2047 && xtimer.mode==1) xtime *= -1; // Sun always has already rises
|
||||
if (xtime==2046 && xtimer.mode==2) xtime *= -1; // Sun always has already set
|
||||
}
|
||||
#endif
|
||||
return xtime;
|
||||
|
Loading…
x
Reference in New Issue
Block a user