From 9afae09f315f4910c92bcf93662c5ded6961c5ef Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Fri, 7 Jan 2022 13:40:50 +0100 Subject: [PATCH] Load radio settings before power on delay is evaluated Resolves #1366 --- radio/src/opentx.cpp | 8 +++++++- radio/src/storage/sdcard_common.h | 2 ++ radio/src/storage/sdcard_yaml.cpp | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index d3bc7d787..6dc880929 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1778,8 +1778,14 @@ void opentxInit() menuHandlers[1] = menuModelSelect; #endif -#if defined(EEPROM) +#if defined(STARTUP_ANIMATION) + lcdRefreshWait(); + lcdClear(); + lcdRefresh(); + lcdRefreshWait(); + bool radioSettingsValid = storageReadRadioSettings(false); + (void)radioSettingsValid; #endif BACKLIGHT_ENABLE(); // we start the backlight during the startup animation diff --git a/radio/src/storage/sdcard_common.h b/radio/src/storage/sdcard_common.h index 2606fab91..4f74303b0 100644 --- a/radio/src/storage/sdcard_common.h +++ b/radio/src/storage/sdcard_common.h @@ -76,6 +76,8 @@ uint8_t findEmptyModel(uint8_t id, bool down); #endif +bool storageReadRadioSettings(bool checks); + const char * loadRadioSettings(); const char * writeGeneralSettings(); diff --git a/radio/src/storage/sdcard_yaml.cpp b/radio/src/storage/sdcard_yaml.cpp index bbc28cddc..04c7e69af 100644 --- a/radio/src/storage/sdcard_yaml.cpp +++ b/radio/src/storage/sdcard_yaml.cpp @@ -475,3 +475,9 @@ const char * restoreModel(uint8_t idx, char *model_name) } #endif + +bool storageReadRadioSettings(bool checks) +{ + if (!sdMounted()) sdInit(); + return loadRadioSettingsYaml() == nullptr; +}