Only use BQ and TMP144 once clock is synchronized
This commit is contained in:
		@ -209,15 +209,16 @@ int main(void) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* USER CODE BEGIN 3 */
 | 
					    /* USER CODE BEGIN 3 */
 | 
				
			||||||
    update_status_leds();
 | 
					    update_status_leds();
 | 
				
			||||||
    afe_measure();
 | 
					 | 
				
			||||||
    tmp144_read_temps();
 | 
					 | 
				
			||||||
    if (HAL_GetTick() - main_loop_start > ERROR_CHECK_START) {
 | 
					 | 
				
			||||||
      check_error_conditions();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    fan_ctrl_update();
 | 
					    fan_ctrl_update();
 | 
				
			||||||
    clock_sync_update();
 | 
					    clock_sync_update();
 | 
				
			||||||
    // Only start sending CAN frames once the clock is synchronized
 | 
					    // Only use communication interfaces (BQ UART, TMP144 UARTs, CAN) once the
 | 
				
			||||||
 | 
					    // clock is synchronized
 | 
				
			||||||
    if (clock_sync_state == CLOCK_SYNC_NORMAL_OPERATION) {
 | 
					    if (clock_sync_state == CLOCK_SYNC_NORMAL_OPERATION) {
 | 
				
			||||||
 | 
					      afe_measure();
 | 
				
			||||||
 | 
					      tmp144_read_temps();
 | 
				
			||||||
 | 
					      if (HAL_GetTick() - main_loop_start > ERROR_CHECK_START) {
 | 
				
			||||||
 | 
					        check_error_conditions();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      ams_can_send_heartbeat();
 | 
					      ams_can_send_heartbeat();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    delay_period();
 | 
					    delay_period();
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user