Bootup animation for LED debugging + Freeze WDG when debugging

This commit is contained in:
Oskar Winkels 2023-05-19 22:04:33 +02:00
parent e46a75f99f
commit 86f688c0f7
Signed by: o.winkels
GPG Key ID: E7484A06E99DAEF1
1 changed files with 14 additions and 4 deletions

View File

@ -191,12 +191,11 @@ int main(void)
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
MX_GPIO_Init();
MX_CAN_Init();
#if false
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_CAN_Init();
@ -204,6 +203,9 @@ int main(void)
/* USER CODE BEGIN 2 */
#endif
// Freeze WDG when debugging
__HAL_DBGMCU_FREEZE_IWDG();
// Ensure we start with SDC disabled
HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_RESET);
@ -250,8 +252,16 @@ int main(void)
bool pAMC = false;
mission_t new_mission = mission; // By default, don't change mission
// Important to prevent bus error state while ABX is starting up
HAL_Delay(1000);
// Wait 1s to prevent bus error state while ABX is starting up
// During that time, show loading animation to show LEDs work
setMissionLED(M_MANUAL, GPIO_PIN_SET);
HAL_Delay(150);
setMissionLED(M_MANUAL, GPIO_PIN_RESET);
for (mission_t m = M_ACCEL; m != M_MANUAL; m = mission2next[m]) {
setMissionLED(m, GPIO_PIN_SET);
HAL_Delay(150);
setMissionLED(m, GPIO_PIN_RESET);
}
MX_IWDG_Init();
WD_initialized = true;