@@ -88,7 +88,7 @@ void DisplayUI::setup() {
8888 mode = DISPLAY_MODE::PACKETMONITOR;
8989 });
9090
91- addMenuNode (&mainMenu, D_CLOCK, [this ]() { // PACKET MONITOR
91+ addMenuNode (&mainMenu, D_CLOCK, [this ]() { // CLOCK
9292 mode = DISPLAY_MODE::CLOCK;
9393 display.setFont (ArialMT_Plain_24);
9494 display.setTextAlignment (TEXT_ALIGN_CENTER);
@@ -523,7 +523,7 @@ void DisplayUI::setupButtons() {
523523 else currentMenu->selected = currentMenu->list ->size () - 1 ;
524524 } else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
525525 scan.setChannel (wifi_channel + 1 );
526- } else if (mode == DISPLAY_MODE::CLOCK) {
526+ } else if (mode == DISPLAY_MODE::CLOCK) { // when in clock, change time
527527 setTime (clockHour, clockMinute + 1 , clockSecond);
528528 }
529529 }
@@ -539,7 +539,7 @@ void DisplayUI::setupButtons() {
539539 else currentMenu->selected = currentMenu->list ->size () - 1 ;
540540 } else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
541541 scan.setChannel (wifi_channel + 1 );
542- } else if (mode == DISPLAY_MODE::CLOCK) { // when in packet monitor , change channel
542+ } else if (mode == DISPLAY_MODE::CLOCK) { // when in clock , change time
543543 setTime (clockHour, clockMinute + 10 , clockSecond);
544544 }
545545 }
@@ -662,12 +662,19 @@ void DisplayUI::draw(bool force) {
662662
663663 updatePrefix ();
664664
665- #ifndef RTC_DS3231
666- if (clockTime < currentTime - 1000 ) {
667- setTime (clockHour, clockMinute++, clockSecond + 1 );
665+ if (currentTime - clockTime >= 1000 ) {
666+ #ifdef RTC_DS3231
667+ bool h12;
668+ bool PM_time;
669+ clockHour = clock.getHour (h12, PM_time);
670+ clockMinute = clock.getMinute ();
671+ clockSecond = clock.getSecond ();
672+ #else // ifdef RTC_DS3231
673+ ++clockSecond;
674+ #endif // ifdef RTC_DS3231
675+ setTime (clockHour, clockMinute, clockSecond);
668676 clockTime += 1000 ;
669677 }
670- #endif // ifndef RTC_DS3231
671678
672679 switch (mode) {
673680 case DISPLAY_MODE::BUTTON_TEST:
0 commit comments