Skip to content

Commit 7410aff

Browse files
committed
user/ntp_daemon: fix task sync problem & do ota update check rather than reboot
1 parent 1378876 commit 7410aff

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

main/src/user/ntp_daemon.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "system/event.h"
1212
#include "user/gui_daemon.h"
1313
#include "user/led_daemon.h"
14+
#include "user/ota_update.h"
1415

1516
#define TAG "ntp"
1617

@@ -73,10 +74,7 @@ void ntp_daemon(void *pvParameter)
7374
time(&now);
7475
localtime_r(&now, &timeinfo);
7576
if (timeinfo.tm_hour == 0 && timeinfo.tm_min == 0) {
76-
ESP_LOGW(TAG, "scheduled reboot...");
77-
gui_show_image(4);
78-
vTaskDelay(2000 / portTICK_RATE_MS);
79-
esp_restart();
77+
ota_check_update();
8078
}
8179
}
8280
}
@@ -85,10 +83,12 @@ void ntp_sync_time(void)
8583
{
8684
EventBits_t uxBits = xEventGroupGetBits(daemon_event_group);
8785
if ((uxBits & NTP_DAEMON_FINISH_BIT) == 0) {
88-
xEventGroupSync(
86+
xEventGroupSetBits(daemon_event_group, NTP_DAEMON_READY_BIT);
87+
xEventGroupWaitBits(
8988
daemon_event_group,
90-
NTP_DAEMON_READY_BIT,
9189
NTP_DAEMON_FINISH_BIT,
90+
pdFALSE,
91+
pdFALSE,
9292
portMAX_DELAY
9393
);
9494
}

0 commit comments

Comments
 (0)