mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +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;
|
int16_t xtime = xtimer.time;
|
||||||
#ifdef USE_SUNRISE
|
#ifdef USE_SUNRISE
|
||||||
if (xtimer.mode) {
|
if (xtimer.mode) {
|
||||||
if (xtime >= 12*60) xtime = 12*60 - xtime;
|
ApplyTimerOffsets(&xtimer);
|
||||||
xtime += (int16_t)SunMinutes(xtimer.mode-1);
|
xtime = xtimer.time;
|
||||||
if (xtime < 0) xtime += 24*60;
|
if (xtime==2047 && xtimer.mode==1) xtime *= -1; // Sun always has already rises
|
||||||
if (xtime >= 24*60) xtime -= 24*60;
|
if (xtime==2046 && xtimer.mode==2) xtime *= -1; // Sun always has already set
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return xtime;
|
return xtime;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user