diff --git a/main/main.cpp b/main/main.cpp index 9d3e900..19c2877 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -28,6 +28,7 @@ #include #include "lvgl.h" +#include // 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();