diff --git a/Core/Src/main.c b/Core/Src/main.c index ce4504c..4f48e00 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -209,15 +209,16 @@ int main(void) { /* USER CODE BEGIN 3 */ update_status_leds(); - afe_measure(); - tmp144_read_temps(); - if (HAL_GetTick() - main_loop_start > ERROR_CHECK_START) { - check_error_conditions(); - } fan_ctrl_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) { + afe_measure(); + tmp144_read_temps(); + if (HAL_GetTick() - main_loop_start > ERROR_CHECK_START) { + check_error_conditions(); + } ams_can_send_heartbeat(); } delay_period();