From ba08b852252b80f8420d0e97e20cebedf9c45e96 Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Sat, 10 Dec 2022 09:45:45 +0100 Subject: [PATCH] log NTP server name (#1497) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * log NTP server name * . * . * replace calls to /wasserzaehler.html with calls to /value (#1469) Co-authored-by: CaCO3 * Fix cookie usage, use correct http response codes, add 404 page (#1495) * replaced some HTTP response code with better matching codes * add custom 404 page, add log entry for debugging * fix cookie * replace non-necessary whitespace * . Co-authored-by: CaCO3 * Don't autofail if NTP server can't be reached during initalization (#1498) This fixes an issue with a restricted network without internet access, where the hardcoded ntp server can't be reached and thus the esp resets, as it's not able to finish initalization. * Update Changelog.md * Update Changelog.md for release * Fix for securing wlan.ini (#1509) * Fix for securing wlan.ini * Fixing error with ' instead of " * Changing to errorcode 403 * maybe strcmp instead of regular == Co-authored-by: Pär Hedberg * Update Web-Installer * solves #1530 (#1531) * Refactor JSON (#1518) * use correct log level * corrected logging * typo * refactored JSON generagion: removed unused parameters, consolidated into singel function, added "pre" * Wrapped 'rate' into double quotes, like all other JSON values Co-authored-by: CaCO3 * Various corrections (#1519) * use correct log level * corrected logging * typo * add release to webinstaller * changed logs, added INFO log of raw, value, error * . Co-authored-by: CaCO3 * Prevent auto restart on cam framebuffer init error (#1522) * use correct log level * revert autorestart on camera framebuffer init error * . Co-authored-by: CaCO3 * #1524 - ensure the recognized digit is less than 10 (#1525) * fix kernel panic (vector out of range) in getReadoutRawString * fix key of caches * fix key of caches * fix key caches * fix cache keys * fix cache keys * move set variables to top * debug * fix key * testing * try fix changelog * test * Update Changelog.md for release * Revert "Update Changelog.md for release" This reverts commit 4f51ec79620734cac44c02025ded4a8171016814. * remove testing * fix release creation * testing * Update Changelog.md for release * test * Revert "Merge branch 'master' of https://github.com/haverland/AI-on-the-edge-device" This reverts commit f68695a4c0bda6a7ee563511040c0c89f1fed0c6, reversing changes made to a096cf718223ca13b781fbf570e5fcbfb5689049. * Revert "test" This reverts commit a096cf718223ca13b781fbf570e5fcbfb5689049. * revert testing * #1524 - ensure the result of ZeigerEvalHybridNeu is <10 * Fix late digit transition #1503 Co-authored-by: github-actions * only use sntp_getservername() after init sntp * set default NTP server on dnew installations Co-authored-by: CaCO3 Co-authored-by: Ralf Rachinger Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com> Co-authored-by: github-actions Co-authored-by: parhedberg Co-authored-by: Pär Hedberg Co-authored-by: Christopher Fenner <9592452+CFenner@users.noreply.github.com> Co-authored-by: Frank Haverland --- .../jomjol_flowcontroll/ClassFlowPostProcessing.cpp | 1 + code/components/jomjol_time_sntp/time_sntp.cpp | 10 +++++----- sd-card/config/config.ini | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index 7d75d061d..a1712b5d5 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -874,6 +874,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) UpdatePreValueINI = true; string _zw = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText; + ESP_LOGD(TAG, "%s", zw.c_str()); LogFile.WriteToFile(ESP_LOG_INFO, TAG, _zw); WriteDataLog(j); } diff --git a/code/components/jomjol_time_sntp/time_sntp.cpp b/code/components/jomjol_time_sntp/time_sntp.cpp index 6240e6877..cc687d6c7 100644 --- a/code/components/jomjol_time_sntp/time_sntp.cpp +++ b/code/components/jomjol_time_sntp/time_sntp.cpp @@ -63,8 +63,8 @@ bool setup_time() // Is time set? If not, tm_year will be (1970 - 1900). if (!getTimeIsSet()) { - ESP_LOGI(TAG, "Time is not set yet. Getting time over NTP."); initialize_sntp(); + LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Time is not set yet. Getting time over NTP server " + std::string(sntp_getservername(0))); if (!obtain_time()) { success = false; } @@ -103,9 +103,9 @@ static bool obtain_time(void) bool success = true; time(&now); - localtime_r(&now, &timeinfo); + localtime_r(&now, &timeinfo); - ESP_LOGI(TAG, "Waiting until we get a time from the NTP server..."); + LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Waiting until we get a time from the NTP server " + std::string(sntp_getservername(0))); while (true) { retry++; @@ -118,7 +118,7 @@ static bool obtain_time(void) sntp_sync_status_t status = sntp_get_sync_status(); logNtpStatus(status); if (status == SNTP_SYNC_STATUS_COMPLETED) { - ESP_LOGI(TAG, "Time is synced with NTP Server"); + LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Time is synced with NTP Server " + std::string(sntp_getservername(0))); break; } @@ -146,10 +146,10 @@ void logNtpStatus(sntp_sync_status_t status) { void reset_servername(std::string _servername) { - ESP_LOGD(TAG, "Set SNTP-Server: %s", _servername.c_str()); sntp_stop(); sntp_setoperatingmode(SNTP_OPMODE_POLL); sntp_setservername(0, _servername.c_str()); + LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Set SNTP-Server to " + std::string(sntp_getservername(0))); sntp_init(); obtain_time(); std::string zw = gettimestring("%Y%m%d-%H%M%S"); diff --git a/sd-card/config/config.ini b/sd-card/config/config.ini index 68b9fbc0f..8670fd0cd 100644 --- a/sd-card/config/config.ini +++ b/sd-card/config/config.ini @@ -94,7 +94,7 @@ LogfileRetentionInDays = 3 [System] TimeZone = CET-1CEST,M3.5.0,M10.5.0/3 -;TimeServer = undefined +;TimeServer = pool.ntp.org ;AutoAdjustSummertime = false ;Hostname = undefined SetupMode = true