From 58789383deb56674f6bc2fa44a0bf06c02dfee83 Mon Sep 17 00:00:00 2001 From: Hasenradball Date: Mon, 25 Nov 2024 07:36:22 +0100 Subject: [PATCH] smaall bugfix in example with DS3231 --- examples/time_DS3231_RTC/time_DS3231_RTC.ino | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/time_DS3231_RTC/time_DS3231_RTC.ino b/examples/time_DS3231_RTC/time_DS3231_RTC.ino index c50dc78..da64fe2 100644 --- a/examples/time_DS3231_RTC/time_DS3231_RTC.ino +++ b/examples/time_DS3231_RTC/time_DS3231_RTC.ino @@ -57,10 +57,10 @@ void setup() { while (!MESZ::get_timeHasBeenSynchronized()) { yield(); } - Serial.println("Time successfully synchronized!"); + Serial.println("Time successfully syncronized!"); MESZ::set_timeHasBeenSynchronized_false(); auto syncTime_ms = sntp_get_sync_interval(); - Serial.printf("\tthe sntp sync interval is set to : %ld ms / %ld s / %ld min / %ld h\n", \ + Serial.printf("\tthe sntp sync intervall is set to : %ld ms / %ld s / %ld min / %ld h\n", \ syncTime_ms, syncTime_ms/1000U, syncTime_ms/60000U, syncTime_ms/3600000U); Serial.printf("\nZeit: %s", uhr.get_asctime()); @@ -74,6 +74,9 @@ void setup() { // clock has actual time then dicconnect Wifi // to prevent from synchronizing wifi.Wifi_Disconnect(); + while(uhr.getSecond()) { + yield(); + } compareTimes(); } @@ -81,8 +84,9 @@ void loop() { unsigned int ms{millis()}; static unsigned int last_ms {ms}; - if (ms - last_ms >= 36000000U) { + if (ms - last_ms >= 3600000U) { // print time from ESP and Time from DS3231-RTC + last_ms = ms; compareTimes(); } }