mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge branch 'tech-upgrade' of https://github.com/emsesp/EMS-ESP32 into tech-upgrade
This commit is contained in:
@@ -152,9 +152,10 @@ void WebSchedulerService::loop() {
|
|||||||
}
|
}
|
||||||
last_tm_min = 0; // startup done, now use for RTC
|
last_tm_min = 0; // startup done, now use for RTC
|
||||||
}
|
}
|
||||||
|
|
||||||
// check timer every minute, sync to EMS-ESP clock
|
// check timer every minute, sync to EMS-ESP clock
|
||||||
uint32_t uptime_min = uuid::get_uptime_sec() / 60;
|
uint32_t uptime_min = uuid::get_uptime_sec() / 60;
|
||||||
if (last_uptime_min != uptime_min || last_uptime_min == -1) {
|
if (last_uptime_min != uptime_min) {
|
||||||
for (ScheduleItem & scheduleItem : *scheduleItems) {
|
for (ScheduleItem & scheduleItem : *scheduleItems) {
|
||||||
// retry startup commands not yet executed
|
// retry startup commands not yet executed
|
||||||
if (scheduleItem.active && scheduleItem.flags == SCHEDULEFLAG_SCHEDULE_TIMER && scheduleItem.elapsed_min == 0
|
if (scheduleItem.active && scheduleItem.flags == SCHEDULEFLAG_SCHEDULE_TIMER && scheduleItem.elapsed_min == 0
|
||||||
@@ -169,11 +170,12 @@ void WebSchedulerService::loop() {
|
|||||||
}
|
}
|
||||||
last_uptime_min = uptime_min;
|
last_uptime_min = uptime_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check calender, sync to RTC, only execute if year is valid
|
// check calender, sync to RTC, only execute if year is valid
|
||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
tm * tm = localtime(&now);
|
tm * tm = localtime(&now);
|
||||||
if (tm->tm_min != last_tm_min && tm->tm_year > 120) {
|
if (tm->tm_min != last_tm_min && tm->tm_year > 120) {
|
||||||
// find the real dow and minute from NTP or RTC
|
// find the real dow and minute from RTC
|
||||||
uint8_t real_dow = 1 << tm->tm_wday; // 1 is Sunday
|
uint8_t real_dow = 1 << tm->tm_wday; // 1 is Sunday
|
||||||
uint16_t real_min = tm->tm_hour * 60 + tm->tm_min;
|
uint16_t real_min = tm->tm_hour * 60 + tm->tm_min;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user