Only close SDC once conditions are met
- Watchdog is initialized - Potential discharge is completed (5s) - Flag is set by ABX
This commit is contained in:
parent
1bc02e7f02
commit
460578e359
@ -503,9 +503,6 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
|
|||||||
if (rxHeader.StdId != CAN_ID_RX)
|
if (rxHeader.StdId != CAN_ID_RX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HAL_GPIO_WritePin(ASB_Error_GPIO_Port, ASB_Error_Pin, rxData.signals.asb_error);
|
|
||||||
HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, !rxData.signals.as_close_sdc);
|
|
||||||
|
|
||||||
#ifdef WATCHDOG_STM
|
#ifdef WATCHDOG_STM
|
||||||
|
|
||||||
if (rxData.signals.heartbeat != pHeartbeat) {
|
if (rxData.signals.heartbeat != pHeartbeat) {
|
||||||
@ -516,17 +513,28 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
|
|||||||
}
|
}
|
||||||
pHeartbeat = rxData.signals.heartbeat;
|
pHeartbeat = rxData.signals.heartbeat;
|
||||||
|
|
||||||
|
bool close_sdc = WD_initialized && rxData.signals.as_close_sdc;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WATCHDOG_UCC
|
#ifdef WATCHDOG_UCC
|
||||||
HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, rxData.signals.heartbeat);
|
HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, rxData.signals.heartbeat);
|
||||||
|
|
||||||
|
bool close_sdc = rxData.signals.as_close_sdc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Set whether to close the relay
|
||||||
|
// Inverted because the NAND was bodged out
|
||||||
|
HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, !close_sdc);
|
||||||
|
|
||||||
// Reset old mission LED
|
// Reset old mission LED
|
||||||
setMissionLED(mission, GPIO_PIN_RESET);
|
setMissionLED(mission, GPIO_PIN_RESET);
|
||||||
mission = rxData.signals.as_mission;
|
mission = rxData.signals.as_mission;
|
||||||
setMissionLED(mission, GPIO_PIN_SET);
|
setMissionLED(mission, GPIO_PIN_SET);
|
||||||
|
|
||||||
|
// Set ASB Error status
|
||||||
|
HAL_GPIO_WritePin(ASB_Error_GPIO_Port, ASB_Error_Pin, rxData.signals.asb_error);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE END 4 */
|
/* USER CODE END 4 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user