From a68c0cf58a219991b13f20b7ac3526059b48b317 Mon Sep 17 00:00:00 2001 From: Matthias Hryniszak Date: Sun, 15 Jan 2023 03:02:03 +0100 Subject: [PATCH] feat(diags): Red LED before RTC data, blue LED after (#3006) * Added turning the red LED before RTC data and blue LED afterwards With the LED turned RED if the RTC data retrieval fails it will stay red. This will at least be an indication that the RTC startup encountered a problem. For now there is no indication that this problem occurred. * GH-3005 Moved LED manipulation to conditionally compiled when RTC operation happens --- radio/src/targets/horus/board.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/radio/src/targets/horus/board.cpp b/radio/src/targets/horus/board.cpp index 53c879fe1..8145cd368 100644 --- a/radio/src/targets/horus/board.cpp +++ b/radio/src/targets/horus/board.cpp @@ -236,11 +236,12 @@ void boardInit() sportUpdateInit(); #endif - ledBlue(); - #if defined(RTCLOCK) && !defined(COPROCESSOR) + ledRed(); rtcInit(); // RTC must be initialized before rambackupRestore() is called #endif + + ledBlue(); } void boardOff() @@ -276,8 +277,8 @@ void boardOff() RTC->BKP0R = SHUTDOWN_REQUEST; pwrOff(); - - // We reach here only in forced power situations, such as hw-debugging with external power + + // We reach here only in forced power situations, such as hw-debugging with external power // Enter STM32 stop mode / deep-sleep // Code snippet from ST Nucleo PWR_EnterStopMode example #define PDMode 0x00000000U @@ -291,7 +292,7 @@ void boardOff() /* Set SLEEPDEEP bit of Cortex System Control Register */ SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); - + // To avoid HardFault at return address, end in an endless loop while (1) {