diff --git a/radio/src/gui/480x272/themes/default.cpp b/radio/src/gui/480x272/themes/default.cpp index 3c91aad8e..429f6ee0b 100644 --- a/radio/src/gui/480x272/themes/default.cpp +++ b/radio/src/gui/480x272/themes/default.cpp @@ -264,7 +264,7 @@ class DefaultTheme: public Theme virtual void update() const { uint32_t color = g_eeGeneral.themeData.options[1].unsignedValue; - uint32_t bg_color = g_eeGeneral.themeData.options[0].unsignedValue; + uint32_t bg_color = UNEXPECTED_SHUTDOWN() ? WHITE : g_eeGeneral.themeData.options[0].unsignedValue; lcdColorTable[TEXT_BGCOLOR_INDEX] = bg_color; lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = color; diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index 7d07af1ef..f298da4b1 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -421,7 +421,7 @@ uint32_t pwrPressedDuration(void); #if defined(SIMU) || defined(NO_UNEXPECTED_SHUTDOWN) #define UNEXPECTED_SHUTDOWN() (false) #else - #define UNEXPECTED_SHUTDOWN() (powerupReason == DIRTY_SHUTDOWN) + #define UNEXPECTED_SHUTDOWN() ((powerupReason == DIRTY_SHUTDOWN) || WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) #endif // Led driver diff --git a/radio/src/targets/horus/pwr_driver.cpp b/radio/src/targets/horus/pwr_driver.cpp index 65e60199c..e7d9fbfde 100644 --- a/radio/src/targets/horus/pwr_driver.cpp +++ b/radio/src/targets/horus/pwr_driver.cpp @@ -70,7 +70,16 @@ void pwrInit() void pwrOn() { + GPIO_InitTypeDef GPIO_InitStructure; + GPIO_InitStructure.GPIO_Pin = PWR_ON_GPIO_PIN; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; + GPIO_Init(PWR_GPIO, &GPIO_InitStructure); + GPIO_SetBits(PWR_GPIO, PWR_ON_GPIO_PIN); + shutdownRequest = NO_SHUTDOWN_REQUEST; shutdownReason = DIRTY_SHUTDOWN; } @@ -131,20 +140,16 @@ void pwrResetHandler() // powerupReason is there to cater for that, and is what is used in the firmware to decide whether we have to enter emergency mode. // This variable needs to be in a RAM section that is not initialized or zeroed, since once we exit this pwrResetHandler() function the // C runtime would otherwise overwrite it during program init. + // Only for X12, X10 power circuit causes inability to shut down on some samples. - if (shutdownRequest != SHUTDOWN_REQUEST) { - GPIO_InitTypeDef GPIO_InitStructure; - GPIO_InitStructure.GPIO_Pin = PWR_ON_GPIO_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; - GPIO_Init(PWR_GPIO, &GPIO_InitStructure); - +#if defined(PCBX12S) + if (shutdownRequest != SHUTDOWN_REQUEST || WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) { if (shutdownReason == DIRTY_SHUTDOWN) { powerupReason = DIRTY_SHUTDOWN; } - +#else + if (WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) { +#endif pwrOn(); } }