From 8985b7aff5e5f7780c6534638844b538519f2b68 Mon Sep 17 00:00:00 2001 From: lumapu Date: Thu, 17 Aug 2023 01:01:01 +0200 Subject: [PATCH] 0.7.34 * fix scheduled reboot #1097 * added vector graphic logo `/doc/logo.svg` --- src/CHANGES.md | 2 ++ src/app.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/CHANGES.md b/src/CHANGES.md index 8e7d5d3d..4a99ba72 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -8,6 +8,8 @@ * fix MI chrashes * fix some lost debug messages * merged PR #1095, MI fixes for 0.7.x versions +* fix scheduled reboot #1097 +* added vector graphic logo `/doc/logo.svg` ## 0.7.33 - 2023-08-15 * add alarms overview to WebGui #608 diff --git a/src/app.cpp b/src/app.cpp index 4e8af53e..179e3ba3 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -281,6 +281,14 @@ void app::updateNtp(void) { uint32_t midTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86400); // next midnight local time onceAt(std::bind(&app::tickMidnight, this), midTrig, "midNi"); } + if (mConfig->sys.schedReboot) { + uint32_t localTime = gTimezone.toLocal(mTimestamp); + uint32_t rebootTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86410); // reboot 10 secs after midnght + if (rebootTrig <= mTimestamp) { //necessary for times other than midnight to prevent reboot loop + rebootTrig += 86400; + } + onceAt(std::bind(&app::tickReboot, this), rebootTrig, "midRe"); + } } if ((mSunrise == 0) && (mConfig->sun.lat) && (mConfig->sun.lon)) {