Skip to content

Commit 4bd56ff

Browse files
author
Spacehuhn
committed
Fixed clock going out of sync
1 parent 8c289ba commit 4bd56ff

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

esp8266_deauther/DisplayUI.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -672,19 +672,18 @@ void DisplayUI::draw(bool force) {
672672

673673
updatePrefix();
674674

675-
if (currentTime - clockTime >= 1000) {
676675
#ifdef RTC_DS3231
677-
bool h12;
678-
bool PM_time;
679-
clockHour = clock.getHour(h12, PM_time);
680-
clockMinute = clock.getMinute();
681-
clockSecond = clock.getSecond();
676+
bool h12;
677+
bool PM_time;
678+
clockHour = clock.getHour(h12, PM_time);
679+
clockMinute = clock.getMinute();
680+
clockSecond = clock.getSecond();
682681
#else // ifdef RTC_DS3231
683-
++clockSecond;
684-
#endif // ifdef RTC_DS3231
685-
setTime(clockHour, clockMinute, clockSecond);
682+
if (currentTime - clockTime >= 1000) {
683+
setTime(clockHour, clockMinute, ++clockSecond);
686684
clockTime += 1000;
687685
}
686+
#endif // ifdef RTC_DS3231
688687

689688
switch (mode) {
690689
case DISPLAY_MODE::BUTTON_TEST:

0 commit comments

Comments
 (0)