3 Commits

2 changed files with 27 additions and 7 deletions

View File

@ -144,6 +144,7 @@ mission_t mission = M_NONE;
#ifdef WATCHDOG_STM #ifdef WATCHDOG_STM
bool pHeartbeat = false; bool pHeartbeat = false;
bool WD_OK = false; bool WD_OK = false;
bool WD_initialized = false;
#endif #endif
/* USER CODE END PV */ /* USER CODE END PV */
@ -190,13 +191,20 @@ int main(void)
/* USER CODE BEGIN SysInit */ /* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */ MX_GPIO_Init();
MX_CAN_Init();
#if false
/* USER CODE END SysInit */
/* Initialize all configured peripherals */ /* Initialize all configured peripherals */
MX_GPIO_Init(); MX_GPIO_Init();
MX_CAN_Init(); MX_CAN_Init();
MX_IWDG_Init(); MX_IWDG_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
#endif
// Freeze WDG when debugging
__HAL_DBGMCU_FREEZE_IWDG();
// Ensure we start with SDC disabled // Ensure we start with SDC disabled
HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_RESET);
@ -244,8 +252,19 @@ int main(void)
bool pAMC = false; bool pAMC = false;
mission_t new_mission = mission; // By default, don't change mission mission_t new_mission = mission; // By default, don't change mission
// Important to prevent bus error state while ABX is starting up // Wait 1s to prevent bus error state while ABX is starting up
HAL_Delay(1000); // 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;
while (true) { while (true) {
@ -485,7 +504,8 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
#ifdef WATCHDOG_STM #ifdef WATCHDOG_STM
if (rxData.signals.heartbeat != pHeartbeat) { if (rxData.signals.heartbeat != pHeartbeat) {
HAL_IWDG_Refresh(&hiwdg); if (WD_initialized)
HAL_IWDG_Refresh(&hiwdg);
WD_OK = true; WD_OK = true;
HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_SET);
} }

View File

@ -911,7 +911,7 @@
) )
(symbol (lib_id "Device:R") (at 142.24 88.9 180) (unit 1) (symbol (lib_id "Device:R") (at 142.24 88.9 180) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (in_bom yes) (on_board yes) (dnp yes)
(uuid 86666e00-6522-42d9-8c50-ddbe3c590e94) (uuid 86666e00-6522-42d9-8c50-ddbe3c590e94)
(property "Reference" "R3" (at 140.462 90.0684 0) (property "Reference" "R3" (at 140.462 90.0684 0)
(effects (font (size 1.27 1.27)) (justify left)) (effects (font (size 1.27 1.27)) (justify left))
@ -989,7 +989,7 @@
) )
(symbol (lib_id "Device:C") (at 148.59 93.98 90) (unit 1) (symbol (lib_id "Device:C") (at 148.59 93.98 90) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (in_bom yes) (on_board yes) (dnp yes)
(uuid e0f15250-bd20-4545-ac0d-527fe10e2cdb) (uuid e0f15250-bd20-4545-ac0d-527fe10e2cdb)
(property "Reference" "C17" (at 147.4216 91.059 0) (property "Reference" "C17" (at 147.4216 91.059 0)
(effects (font (size 1.27 1.27)) (justify left)) (effects (font (size 1.27 1.27)) (justify left))
@ -1042,7 +1042,7 @@
) )
(symbol (lib_id "Device:R") (at 142.24 99.06 180) (unit 1) (symbol (lib_id "Device:R") (at 142.24 99.06 180) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (in_bom yes) (on_board yes) (dnp yes)
(uuid fe93d30d-de39-4ca8-8ec8-dbd2cc54f863) (uuid fe93d30d-de39-4ca8-8ec8-dbd2cc54f863)
(property "Reference" "R7" (at 140.462 100.2284 0) (property "Reference" "R7" (at 140.462 100.2284 0)
(effects (font (size 1.27 1.27)) (justify left)) (effects (font (size 1.27 1.27)) (justify left))