mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 19:26:37 +00:00
Merge pull request #17016 from reimerp/deepsleepfix
fix for deepsleep first calculation #13955
This commit is contained in:
commit
18ec24b86b
@ -118,11 +118,16 @@ void DeepSleepPrepare(void)
|
|||||||
RtcSettings.deepsleep_slip = tmin(tmax(RtcSettings.deepsleep_slip, 9000), 11000);
|
RtcSettings.deepsleep_slip = tmin(tmax(RtcSettings.deepsleep_slip, 9000), 11000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("DSPrep: time %ld, next %ld, slip %ld"),
|
||||||
|
timeslip, RtcSettings.nextwakeup, RtcSettings.deepsleep_slip );
|
||||||
// It may happen that wakeup in just <5 seconds in future
|
// It may happen that wakeup in just <5 seconds in future
|
||||||
// In this case also add deepsleep to nextwakeup
|
// In this case also add deepsleep to nextwakeup
|
||||||
if (RtcSettings.nextwakeup <= (LocalTime() + DEEPSLEEP_MIN_TIME)) {
|
if (RtcSettings.nextwakeup <= (LocalTime() + DEEPSLEEP_MIN_TIME)) {
|
||||||
// ensure nextwakeup is at least in the future
|
// ensure nextwakeup is at least in the future, and add 5%
|
||||||
RtcSettings.nextwakeup += (((LocalTime() + DEEPSLEEP_MIN_TIME - RtcSettings.nextwakeup) / Settings->deepsleep) + 1) * Settings->deepsleep;
|
RtcSettings.nextwakeup += (((LocalTime() + DEEPSLEEP_MIN_TIME - RtcSettings.nextwakeup) / Settings->deepsleep) + 1) * Settings->deepsleep;
|
||||||
|
RtcSettings.nextwakeup += Settings->deepsleep * 0.05;
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("DSPrep too short: time %ld, next %ld, slip %ld"),
|
||||||
|
timeslip, RtcSettings.nextwakeup, RtcSettings.deepsleep_slip);
|
||||||
}
|
}
|
||||||
|
|
||||||
String dt = GetDT(RtcSettings.nextwakeup); // 2017-03-07T11:08:02
|
String dt = GetDT(RtcSettings.nextwakeup); // 2017-03-07T11:08:02
|
||||||
|
Loading…
x
Reference in New Issue
Block a user