feat(main): Add SNTP configuration for time synchronization and update event wait conditions
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <esp_task_wdt.h>
|
||||
|
||||
#include "lvgl.h"
|
||||
#include <esp_netif_sntp.h>
|
||||
|
||||
// nvs storage namespaces, 15 characters max
|
||||
#define DEFAULT_STORAGE_NAMESPACE "storage"
|
||||
@@ -43,7 +44,9 @@ void init_queues(
|
||||
|
||||
void app_main(void) {
|
||||
display_chip_info();
|
||||
|
||||
// set to hkt
|
||||
setenv("TZ", "HKT-8", 1);
|
||||
tzset();
|
||||
// Initialize default event loop early - required for UI events
|
||||
esp_err_t err = esp_event_loop_create_default();
|
||||
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) {
|
||||
@@ -105,13 +108,15 @@ void app_main(void) {
|
||||
ESP_LOGI(TAG, "Waiting for system to be ready...\n");
|
||||
xEventGroupWaitBits(
|
||||
system_event_group,
|
||||
// DISPLAY_READY_BIT | STORAGE_READY_BIT | NETWORK_READY_BIT,
|
||||
DISPLAY_READY_BIT,
|
||||
DISPLAY_READY_BIT | NETWORK_READY_BIT,
|
||||
// do not clear on exit, require explicit reset
|
||||
pdFALSE,
|
||||
pdTRUE,
|
||||
portMAX_DELAY
|
||||
);
|
||||
esp_sntp_config_t config = ESP_NETIF_SNTP_DEFAULT_CONFIG("pool.ntp.org");
|
||||
esp_netif_sntp_init(&config);
|
||||
|
||||
ESP_LOGI(TAG, "System is ready. Starting main application...\n");
|
||||
|
||||
AppRegistry& app_registry = AppRegistry::instance();
|
||||
|
||||
Reference in New Issue
Block a user