mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-10 21:46:55 +03:00
Print startblock after NTP snyc only once (#2129)
This commit is contained in:
@@ -26,6 +26,7 @@ static std::string timeZone = "";
|
|||||||
static std::string timeServer = "undefined";
|
static std::string timeServer = "undefined";
|
||||||
static bool useNtp = true;
|
static bool useNtp = true;
|
||||||
static bool timeWasNotSetAtBoot = false;
|
static bool timeWasNotSetAtBoot = false;
|
||||||
|
static bool timeWasNotSetAtBoot_PrintStartBlock = false;
|
||||||
|
|
||||||
std::string getNtpStatusText(sntp_sync_status_t status);
|
std::string getNtpStatusText(sntp_sync_status_t status);
|
||||||
static void setTimeZone(std::string _tzstring);
|
static void setTimeZone(std::string _tzstring);
|
||||||
@@ -60,10 +61,11 @@ std::string getCurrentTimeString(const char * frm)
|
|||||||
|
|
||||||
void time_sync_notification_cb(struct timeval *tv)
|
void time_sync_notification_cb(struct timeval *tv)
|
||||||
{
|
{
|
||||||
if (timeWasNotSetAtBoot) {
|
if (timeWasNotSetAtBoot_PrintStartBlock) {
|
||||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
||||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "==================== Start ======================");
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "==================== Start ======================");
|
||||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "== Logs before time sync -> log_1970-01-01.txt ==");
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "== Logs before time sync -> log_1970-01-01.txt ==");
|
||||||
|
timeWasNotSetAtBoot_PrintStartBlock = false;
|
||||||
}
|
}
|
||||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Time is synced with NTP Server " +
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Time is synced with NTP Server " +
|
||||||
getServerName() + ": " + getCurrentTimeString("%Y-%m-%d %H:%M:%S"));
|
getServerName() + ": " + getCurrentTimeString("%Y-%m-%d %H:%M:%S"));
|
||||||
@@ -237,6 +239,7 @@ bool setupTime() {
|
|||||||
if (useNtp) {
|
if (useNtp) {
|
||||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Once the NTP server provides a time, we will switch to that one");
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Once the NTP server provides a time, we will switch to that one");
|
||||||
timeWasNotSetAtBoot = true;
|
timeWasNotSetAtBoot = true;
|
||||||
|
timeWasNotSetAtBoot_PrintStartBlock = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user