3 Commits

Author SHA1 Message Date
1e4e5a91aa Only close SDC if watchdog is OK 2023-08-03 16:40:42 +02:00
34611dac20 Reduce startup delay
The 5s discharge is managed via ABX/PDU
2023-08-03 16:11:09 +02:00
d1c2cc5d80 Fix mission LEDs 2023-08-03 16:05:40 +02:00

View File

@ -135,9 +135,9 @@ IWDG_HandleTypeDef hiwdg;
/* USER CODE BEGIN PV */ /* USER CODE BEGIN PV */
// Mission Maps: NONE ACCEL SKIDPAD TRACKDRIVE EBSTEST INSPECTION AUTOX MANUAL // Mission Maps: NONE ACCEL SKIDPAD AUTOX EBSTEST INSPECTION TRACKDRIVE MANUAL
const uint16_t mission2led[] = {0 , AMI_ACCEL_Pin , AMI_SKIDPAD_Pin , AMI_TRACKDRIVE_Pin, AMI_EBSTEST_Pin , AMI_INSPECTION_Pin, AMI_AUTOX_Pin , AMI_MANUAL_Pin}; const uint16_t mission2led[] = {0 , AMI_ACCEL_Pin , AMI_SKIDPAD_Pin , AMI_AUTOX_Pin , AMI_TRACKDRIVE_Pin, AMI_EBSTEST_Pin , AMI_INSPECTION_Pin, AMI_MANUAL_Pin};
const mission_t mission2next[] = {M_MANUAL , M_SKIDPAD , M_AUTOX , M_EBSTEST , M_INSPECTION , M_MANUAL , M_TRACKDRIVE , M_ACCEL }; const mission_t mission2next[] = {M_MANUAL , M_SKIDPAD , M_AUTOX , M_EBSTEST , M_INSPECTION , M_MANUAL , M_TRACKDRIVE , M_ACCEL };
mission_t mission = M_NONE; mission_t mission = M_NONE;
@ -256,9 +256,8 @@ int main(void)
mission_t new_mission = mission; // By default, don't change mission mission_t new_mission = mission; // By default, don't change mission
// Wait at least 1s to prevent bus error state while ABX is starting up // 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 // During that time, show loading animation to show LEDs work
while (HAL_GetTick() < 5000) { while (HAL_GetTick() < 1000) {
setMissionLED(M_MANUAL, GPIO_PIN_SET); setMissionLED(M_MANUAL, GPIO_PIN_SET);
HAL_Delay(150); HAL_Delay(150);
setMissionLED(M_MANUAL, GPIO_PIN_RESET); setMissionLED(M_MANUAL, GPIO_PIN_RESET);
@ -521,7 +520,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
} }
pHeartbeat = rxData.signals.heartbeat; pHeartbeat = rxData.signals.heartbeat;
bool close_sdc = setup_done && rxData.signals.as_close_sdc; bool close_sdc = setup_done && rxData.signals.as_close_sdc && WD_OK;
#endif #endif