Improve NTP handling (#1676)

* fix special case where number is named "default" (keep all topics in top level instead of in a sub-group)

* re-implemented SNTP usage, added way to disable NTP client, added timezone table

* minor fixes

Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
CaCO3
2022-12-23 22:45:25 +01:00
committed by GitHub
parent 66eb1e8d9a
commit 603e968ec7
15 changed files with 736 additions and 166 deletions

View File

@@ -156,6 +156,8 @@ extern "C" void app_main(void)
return; // No way to continue without SD-Card!
}
setupTime();
string versionFormated = getFwVersion() + ", Date/Time: " + std::string(BUILD_TIME) + \
", Web UI: " + getHTMLversion();
@@ -207,13 +209,6 @@ extern "C" void app_main(void)
ESP_LOGD(TAG, "main: sleep for: %ldms", (long) xDelay);
vTaskDelay( xDelay );
if (!setup_time()) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "NTP Initialization failed!");
setSystemStatusFlag(SYSTEM_STATUS_NTP_BAD);
}
setBootTime();
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "================== Main Started =================");
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
@@ -222,7 +217,7 @@ extern "C" void app_main(void)
LogFile.WriteToFile(ESP_LOG_WARN, TAG, std::string("Web UI version (") + getHTMLcommit() + ") does not match firmware version (" + std::string(GIT_REV) + ") !");
}
std::string zw = gettimestring("%Y%m%d-%H%M%S");
std::string zw = getCurrentTimeString("%Y%m%d-%H%M%S");
ESP_LOGD(TAG, "time %s", zw.c_str());
/* Check if PSRAM can be initalized */

View File

@@ -468,7 +468,7 @@ httpd_handle_t start_webserver(void)
// config.uri_match_fn = NULL;
config.uri_match_fn = httpd_uri_match_wildcard;
starttime = gettimestring("%Y%m%d-%H%M%S");
starttime = getCurrentTimeString("%Y%m%d-%H%M%S");
// Start the httpd server
ESP_LOGI(TAG, "Starting server on port: '%d'", config.server_port);