Fix bug where WDG wouldn't initialize if ASMS is turned on after SDCL bootup
This commit is contained in:
parent
3fedb7117b
commit
18d02abf9d
|
@ -254,10 +254,11 @@ int main(void)
|
|||
/* USER CODE BEGIN WHILE */
|
||||
|
||||
bool pAMC = false;
|
||||
bool pASMS = false;
|
||||
mission_t new_mission = mission; // By default, don't change mission
|
||||
|
||||
// Wait 1s to prevent bus error state while ABX is starting up
|
||||
// Wait 5s for the discharge of the DC link (so AMS can't restart)
|
||||
// Wait at least 1s to prevent bus error state while ABX is starting up
|
||||
// Wait at least 5s for the discharge of the DC link (so AMS can't restart)
|
||||
// During that time, show loading animation to show LEDs work
|
||||
while (HAL_GetTick() < 5000) {
|
||||
setMissionLED(M_MANUAL, GPIO_PIN_SET);
|
||||
|
@ -272,12 +273,6 @@ int main(void)
|
|||
|
||||
setup_done = true;
|
||||
|
||||
// TEMP: Only enable WD if in autonomous mode because EMI currently messes it up during R2D
|
||||
if (HAL_GPIO_ReadPin(ASMS_GPIO_Port, ASMS_Pin) == GPIO_PIN_RESET) {
|
||||
MX_IWDG_Init();
|
||||
WD_initialized = true;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
// Compare with RESET for signals obtained via inverting buffer
|
||||
|
@ -307,6 +302,12 @@ int main(void)
|
|||
|
||||
}
|
||||
|
||||
// TEMP: Only enable WD if in autonomous mode because EMI currently messes it up during R2D
|
||||
if (ASMS > pASMS) {
|
||||
MX_IWDG_Init();
|
||||
WD_initialized = true;
|
||||
}
|
||||
|
||||
txData = (tx_data_t) {
|
||||
.signals = {
|
||||
.asms_state = ASMS,
|
||||
|
@ -328,6 +329,7 @@ int main(void)
|
|||
|
||||
// Store previous button value to detect signal edges
|
||||
pAMC = AMC;
|
||||
pASMS = ASMS;
|
||||
|
||||
HAL_Delay(TX_UPDATE_PERIOD);
|
||||
|
||||
|
|
Loading…
Reference in New Issue