Start WD only after init period so messages are sent even if WD isn't petted
This commit is contained in:
		@ -144,6 +144,7 @@ mission_t mission = M_NONE;
 | 
			
		||||
#ifdef WATCHDOG_STM
 | 
			
		||||
bool pHeartbeat = false;
 | 
			
		||||
bool WD_OK = false;
 | 
			
		||||
bool WD_initialized = false;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* USER CODE END PV */
 | 
			
		||||
@ -192,11 +193,16 @@ int main(void)
 | 
			
		||||
 | 
			
		||||
  /* USER CODE END SysInit */
 | 
			
		||||
 | 
			
		||||
  MX_GPIO_Init();
 | 
			
		||||
  MX_CAN_Init();
 | 
			
		||||
 | 
			
		||||
#if false
 | 
			
		||||
  /* Initialize all configured peripherals */
 | 
			
		||||
  MX_GPIO_Init();
 | 
			
		||||
  MX_CAN_Init();
 | 
			
		||||
  MX_IWDG_Init();
 | 
			
		||||
  /* USER CODE BEGIN 2 */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  // Ensure we start with SDC disabled
 | 
			
		||||
  HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_RESET);
 | 
			
		||||
@ -247,6 +253,9 @@ int main(void)
 | 
			
		||||
  // Important to prevent bus error state while ABX is starting up
 | 
			
		||||
  HAL_Delay(1000);
 | 
			
		||||
 | 
			
		||||
  MX_IWDG_Init();
 | 
			
		||||
  WD_initialized = true;
 | 
			
		||||
 | 
			
		||||
  while (true) {
 | 
			
		||||
 | 
			
		||||
	bool TS_activate_MUXed	= HAL_GPIO_ReadPin(TS_activate_MUXed_GPIO_Port, TS_activate_MUXed_Pin)	== GPIO_PIN_RESET;
 | 
			
		||||
@ -485,7 +494,8 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
 | 
			
		||||
#ifdef WATCHDOG_STM
 | 
			
		||||
 | 
			
		||||
  if (rxData.signals.heartbeat != pHeartbeat) {
 | 
			
		||||
	  HAL_IWDG_Refresh(&hiwdg);
 | 
			
		||||
	  if (WD_initialized)
 | 
			
		||||
		  HAL_IWDG_Refresh(&hiwdg);
 | 
			
		||||
	  WD_OK = true;
 | 
			
		||||
  	  HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_SET);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user