From 516d4c66add56efd263ecf567ccf14f76fec69c9 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 2 Aug 2024 14:42:13 +0200 Subject: [PATCH 1/2] Fix clock initialization missing --- src/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 2ae8792f..e572335c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -201,6 +201,19 @@ void load_eeprom() { EEPROM.end(); } +/********************************************************************* +** Function: init_clock +** Clock initialisation for propper display in menu +*********************************************************************/ +void init_clock() { + #if defined(STICK_C_PLUS) || defined(STICK_C_PLUS2) + RTC_TimeTypeDef _time; + cplus_RTC _rtc; + _rtc.begin(); + _rtc.GetBm8563Time(); + _rtc.GetTime(&_time); + #endif +} /********************************************************************* ** Function: setup @@ -227,6 +240,7 @@ void setup() { begin_tft(); load_eeprom(); boot_screen(); + init_clock(); if(!LittleFS.begin(true)) { LittleFS.format(), LittleFS.begin();} From 9cd2cbeb9b0443dc50dc005950260c7d6da47615 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 2 Aug 2024 16:08:31 +0200 Subject: [PATCH 2/2] Remove useless RTC begin since it's initialized in setup --- src/core/settings.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/settings.cpp b/src/core/settings.cpp index cf40b6a1..3bed2779 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -407,7 +407,6 @@ void runClockLoop() { #if defined(STICK_C_PLUS) || defined(STICK_C_PLUS2) RTC_TimeTypeDef _time; cplus_RTC _rtc; - _rtc.begin(); _rtc.GetBm8563Time(); _rtc.GetTime(&_time); #endif