From 945fc9510ae451325803b6d2c1ba2ec15b014079 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 25 May 2021 08:32:59 +0200 Subject: [PATCH] Properly reload color UI on USB mass-storage Resolves #79 --- radio/src/gui/colorlcd/view_main.cpp | 5 +---- radio/src/opentx.cpp | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/radio/src/gui/colorlcd/view_main.cpp b/radio/src/gui/colorlcd/view_main.cpp index 17fd8f729..287e6439e 100644 --- a/radio/src/gui/colorlcd/view_main.cpp +++ b/radio/src/gui/colorlcd/view_main.cpp @@ -22,11 +22,7 @@ #include "menu_model.h" #include "menu_radio.h" #include "menu_screen.h" -//#include "model_select.h" -//#include "view_channels.h" -//#include "view_statistics.h" #include "topbar_impl.h" -//#include "menu.h" #include "view_main_menu.h" #include "opentx.h" @@ -48,6 +44,7 @@ ViewMain::ViewMain(): ViewMain::~ViewMain() { + _instance = nullptr; } void ViewMain::setTopbarVisible(float visible) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 710ac0a9b..ae3ede7b0 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1521,6 +1521,13 @@ void opentxClose(uint8_t shutdown) RTOS_WAIT_MS(100); +#if defined(COLORLCD) + MainWindow::instance()->deleteChildren(); + + //TODO: In fact we want only to empty the trash (private method) + MainWindow::instance()->run(); +#endif + #if defined(SDCARD) sdDone(); #endif @@ -1531,16 +1538,17 @@ void opentxResume() { TRACE("opentxResume"); -#if !defined(LIBOPENUI) - menuHandlers[0] = menuMainView; -#endif - sdMount(); storageReadAll(); #if defined(COLORLCD) - #warning "TODO call loadTheme (not sure, it has been removed in some earlier commit)" + //TODO: needs to go into storageReadAll() + TRACE("reloading theme"); loadTheme(); + + // Force redraw + ViewMain::instance()->invalidate(); + TRACE("theme reloaded & ViewMain invalidated"); #endif // removed to avoid the double warnings (throttle, switch, etc.)