Disable Watchdog in manual mode

This commit is contained in:
2023-05-31 16:42:07 +02:00
parent f9256860e8
commit 3fedb7117b
2 changed files with 12 additions and 4 deletions

View File

@ -141,6 +141,8 @@ const mission_t mission2next[] = {M_MANUAL , M_SKIDPAD , M_AUTOX , M_EBSTEST
mission_t mission = M_NONE;
bool setup_done = false;
#ifdef WATCHDOG_STM
bool pHeartbeat = false;
bool WD_OK = false;
@ -268,11 +270,17 @@ int main(void)
}
}
MX_IWDG_Init();
WD_initialized = true;
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
bool TS_activate_MUXed = HAL_GPIO_ReadPin(TS_activate_MUXed_GPIO_Port, TS_activate_MUXed_Pin) == GPIO_PIN_RESET;
bool ASMS = HAL_GPIO_ReadPin(ASMS_GPIO_Port, ASMS_Pin) == GPIO_PIN_RESET;
#ifdef WATCHDOG_UCC
@ -513,7 +521,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
}
pHeartbeat = rxData.signals.heartbeat;
bool close_sdc = WD_initialized && rxData.signals.as_close_sdc;
bool close_sdc = setup_done && rxData.signals.as_close_sdc;
#endif