From 1f588e9bc2b81090c282c15f170678433e77bc37 Mon Sep 17 00:00:00 2001 From: Scott A <89099102+Sabramz@users.noreply.github.com> Date: Sat, 10 Aug 2024 17:06:54 -0400 Subject: [PATCH] 190 consolidate TSMS logic, timers for data collection, fix can overflow error --- Core/Inc/can_handler.h | 13 +++ Core/Inc/monitor.h | 23 ++++- Core/Inc/processing.h | 14 --- Core/Inc/queues.h | 4 - Core/Src/can_handler.c | 15 +-- Core/Src/cerb_utils.c | 3 +- Core/Src/main.c | 41 ++++---- Core/Src/monitor.c | 206 +++++++++++++++++++++----------------- Core/Src/processing.c | 67 +------------ Core/Src/serial_monitor.c | 8 +- Core/Src/state_machine.c | 4 - 11 files changed, 182 insertions(+), 216 deletions(-) diff --git a/Core/Inc/can_handler.h b/Core/Inc/can_handler.h index 9a40b72..904fc06 100644 --- a/Core/Inc/can_handler.h +++ b/Core/Inc/can_handler.h @@ -18,6 +18,11 @@ #include "cmsis_os.h" #include "dti.h" +/** + * @brief Callback to be called when a message is received on CAN line 1. + * + * @param hcan Pointer to struct representing CAN hardware. + */ void can1_callback(CAN_HandleTypeDef *hcan); /** @@ -27,10 +32,18 @@ void can1_callback(CAN_HandleTypeDef *hcan); * @return int8_t Error code. */ int8_t queue_can_msg(can_msg_t msg); + +/** + * @brief Initialize CAN line 1. + * + * @param hcan Pointer to struct representing CAN hardware. + */ void init_can1(CAN_HandleTypeDef *hcan); /** * @brief Task for sending CAN messages. + * + * @param pv_params CAN_HandleTypeDef for the CAN line that messages will be sent out on. */ void vCanDispatch(void *pv_params); extern osThreadId_t can_dispatch_handle; diff --git a/Core/Inc/monitor.h b/Core/Inc/monitor.h index 87a89f0..ab4cd7a 100644 --- a/Core/Inc/monitor.h +++ b/Core/Inc/monitor.h @@ -14,9 +14,29 @@ typedef struct { } pedals_t; pedals_t get_pedal_data(); + bool get_brake_state(); -bool get_tsms_reading(); +/** + * @brief Read the open cell voltage of the LV batteries and send a CAN message with the result. + * + * @param arg Pointer to mpu_t. + */ +void read_lv_sense(void *arg); + +/** + * @brief Read data from the fuse monitor GPIO expander on the PDU. + * + * @param pdu Pointer to pdu_t. + */ +void read_fuse_data(void *arg); + +/** + * @brief Get the debounced TSMS reading. + * + * @return State of TSMS. + */ +bool get_tsms(); /* Defining Temperature Monitor Task */ void vTempMonitor(void *pv_params); @@ -45,7 +65,6 @@ extern const osThreadAttr_t shutdown_monitor_attributes; /* Arguments for the data collection thread */ typedef struct { - mpu_t *mpu; pdu_t *pdu; steeringio_t *wheel; } data_collection_args_t; diff --git a/Core/Inc/processing.h b/Core/Inc/processing.h index aa28922..a4b34a1 100644 --- a/Core/Inc/processing.h +++ b/Core/Inc/processing.h @@ -33,20 +33,6 @@ void increase_torque_limit(); */ void decrease_torque_limit(); -/** - * @brief Get the debounced TSMS reading. - * - * @return State of TSMS. - */ -bool get_tsms(); - -/** - * @brief Task for processing data from the TSMS. - */ -void vProcessTSMS(void *pv_params); -extern osThreadId_t process_tsms_thread_id; -extern const osThreadAttr_t process_tsms_attributes; - typedef struct { dti_t *mc; pdu_t *pdu; diff --git a/Core/Inc/queues.h b/Core/Inc/queues.h index 80795f1..d6c5abc 100644 --- a/Core/Inc/queues.h +++ b/Core/Inc/queues.h @@ -5,9 +5,7 @@ #include "cmsis_os.h" #define ONBOARD_TEMP_QUEUE_SIZE 8 -#define PEDAL_DATA_QUEUE_SIZE 1 #define IMU_QUEUE_SIZE 8 -#define TSMS_QUEUE_SIZE 1 typedef struct { uint16_t accel_x; @@ -20,6 +18,4 @@ typedef struct { extern osMessageQueueId_t imu_queue; -extern osMessageQueueId_t tsms_data_queue; - #endif // QUEUES_H diff --git a/Core/Src/can_handler.c b/Core/Src/can_handler.c index e68214b..ee8c24e 100644 --- a/Core/Src/can_handler.c +++ b/Core/Src/can_handler.c @@ -33,9 +33,7 @@ static osMessageQueueId_t can_inbound_queue; can_t *can1; /* Relevant Info for Initializing CAN 1 */ -static uint32_t id_list[] = { DTI_CANID_ERPM, DTI_CANID_CURRENTS, - DTI_CANID_TEMPS_FAULT, DTI_CANID_ID_IQ, - DTI_CANID_SIGNALS, BMS_DCL_MSG }; +static uint32_t id_list[] = { DTI_CANID_ERPM, DTI_CANID_CURRENTS, BMS_DCL_MSG }; void init_can1(CAN_HandleTypeDef *hcan) { @@ -107,12 +105,19 @@ void vCanDispatch(void *pv_params) can_msg_t msg_from_queue; HAL_StatusTypeDef msg_status; + CAN_HandleTypeDef *hcan = (CAN_HandleTypeDef *)pv_params; + for (;;) { osThreadFlagsWait(CAN_DISPATCH_FLAG, osFlagsWaitAny, osWaitForever); /* Send CAN message */ while (osMessageQueueGet(can_outbound_queue, &msg_from_queue, NULL, 0U) == osOK) { + /* Wait if CAN outbound queue is full */ + while (HAL_CAN_GetTxMailboxesFreeLevel(hcan) == 0) { + osDelay(1); + } + msg_status = can_send_msg(can1, &msg_from_queue); if (msg_status == HAL_ERROR) { @@ -149,10 +154,6 @@ void vCanReceive(void *pv_params) case DTI_CANID_ERPM: dti_record_rpm(mc, msg); break; - // case DTI_CANID_CURRENTS: - // case DTI_CANID_TEMPS_FAULT: - // case DTI_CANID_ID_IQ: - // case DTI_CANID_SIGNALS: case BMS_DCL_MSG: handle_dcl_msg(); break; diff --git a/Core/Src/cerb_utils.c b/Core/Src/cerb_utils.c index 70b09c5..efecae4 100644 --- a/Core/Src/cerb_utils.c +++ b/Core/Src/cerb_utils.c @@ -25,6 +25,7 @@ void debounce(bool input, osTimerAttr_t *timer, uint32_t period) osStatus_t queue_and_set_flag(osMessageQueueId_t queue, const void *msg_ptr, osThreadId_t thread_id, uint32_t flags) { + osStatus_t status = osMessageQueuePut(queue, msg_ptr, 0U, 0U); osThreadFlagsSet(thread_id, flags); - return osMessageQueuePut(queue, msg_ptr, 0U, 0U); + return status; } \ No newline at end of file diff --git a/Core/Src/main.c b/Core/Src/main.c index b9387c0..bd65bb3 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -50,6 +50,8 @@ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ +/* One second with a tick rate of 1000 Hz */ +#define ONE_SECOND 1000 /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ @@ -81,9 +83,9 @@ const osThreadAttr_t defaultTask_attributes = { }; /* USER CODE BEGIN PV */ osMessageQueueId_t imu_queue; -osMessageQueueId_t dti_router_queue; -osMessageQueueId_t tsms_data_queue; +osTimerId_t lv_sense_timer; +osTimerId_t fuse_timer; /* USER CODE END PV */ @@ -201,12 +203,6 @@ int main(void) /* USER CODE END RTOS_TIMERS */ /* USER CODE BEGIN RTOS_QUEUES */ - imu_queue = osMessageQueueNew(IMU_QUEUE_SIZE, sizeof(imu_data_t), NULL); - assert(imu_queue); - dti_router_queue = osMessageQueueNew(DTI_QUEUE_SIZE, sizeof(can_msg_t), NULL); - assert(dti_router_queue); - tsms_data_queue = osMessageQueueNew(TSMS_QUEUE_SIZE, sizeof(bool), NULL); - assert(tsms_data_queue); /* USER CODE END RTOS_QUEUES */ /* Create the thread(s) */ @@ -218,26 +214,26 @@ int main(void) /* Monitors */ pedals_monitor_handle = osThreadNew(vPedalsMonitor, mpu, &pedals_monitor_attributes); assert(pedals_monitor_handle); - // temp_monitor_handle = osThreadNew(vTempMonitor, mpu, &temp_monitor_attributes); - // assert(temp_monitor_handle); - //imu_monitor_handle = osThreadNew(vIMUMonitor, mpu, &imu_monitor_attributes); - //assert(imu_monitor_handle); - // shutdown_monitor_handle = osThreadNew(vShutdownMonitor, pdu, &shutdown_monitor_attributes); - // assert(shutdown_monitor_handle); + + lv_sense_timer = osTimerNew(&read_lv_sense, osTimerPeriodic, mpu, NULL); + osTimerStart(lv_sense_timer, ONE_SECOND); + fuse_timer = osTimerNew(&read_fuse_data, osTimerPeriodic, pdu, NULL); + osTimerStart(fuse_timer, ONE_SECOND); data_collection_args_t* data_args = malloc(sizeof(data_collection_args_t)); - data_args->mpu = mpu; data_args->pdu = pdu; data_args->wheel = wheel; data_collection_thread = osThreadNew(vDataCollection, data_args, &data_collection_attributes); assert(data_collection_thread); - - /* Data Processing */ - process_tsms_thread_id = osThreadNew(vProcessTSMS, NULL, &process_tsms_attributes); - assert(process_tsms_thread_id); + // temp_monitor_handle = osThreadNew(vTempMonitor, mpu, &temp_monitor_attributes); + // assert(temp_monitor_handle); + //imu_monitor_handle = osThreadNew(vIMUMonitor, mpu, &imu_monitor_attributes); + //assert(imu_monitor_handle); + // shutdown_monitor_handle = osThreadNew(vShutdownMonitor, pdu, &shutdown_monitor_attributes); + // assert(shutdown_monitor_handle); /* Messaging */ - can_dispatch_handle = osThreadNew(vCanDispatch, NULL, &can_dispatch_attributes); + can_dispatch_handle = osThreadNew(vCanDispatch, &hcan1, &can_dispatch_attributes); assert(can_dispatch_handle); can_receive_thread = osThreadNew(vCanReceive, mc, &can_receive_attributes); assert(can_receive_thread); @@ -245,13 +241,14 @@ int main(void) assert(serial_monitor_handle); /* Control Logic */ + fault_handle = osThreadNew(vFaultHandler, NULL, &fault_handle_attributes); + assert(fault_handle); + process_pedals_args_t *proc_pedal_args = malloc(sizeof(process_pedals_args_t)); proc_pedal_args->mc = mc; proc_pedal_args->pdu = pdu; process_pedals_thread = osThreadNew(vProcessPedals, proc_pedal_args, &torque_calc_attributes); assert(process_pedals_thread); - fault_handle = osThreadNew(vFaultHandler, NULL, &fault_handle_attributes); - assert(fault_handle); sm_director_args_t *sm_args = malloc(sizeof(sm_director_args_t)); sm_args->pdu = pdu; diff --git a/Core/Src/monitor.c b/Core/Src/monitor.c index 6ed3bba..bcb4d45 100644 --- a/Core/Src/monitor.c +++ b/Core/Src/monitor.c @@ -29,11 +29,84 @@ static pedals_t pedal_data = {}; osMutexId_t pedals_mutex; -static bool tsms_reading = false; -osMutexId_t tsms_reading_mutex; +#define TSMS_DEBOUNCE_PERIOD 500 /* ms */ + +static bool tsms = false; +osMutexId_t tsms_mutex; enum { ACCELPIN_2, ACCELPIN_1, BRAKEPIN_1, BRAKEPIN_2 }; +void read_lv_sense(void *arg) +{ + mpu_t *mpu = (mpu_t *)arg; + fault_data_t fault_data = { .id = LV_MONITOR_FAULT, + .severity = DEFCON5 }; + can_msg_t msg = { .id = CANID_LV_MONITOR, .len = 4, .data = { 0 } }; + + uint32_t v_int; + + read_lv_voltage(mpu, &v_int); + + /* Convert from raw ADC reading to voltage level */ + + // scale up then truncate + // convert to out of 24 volts + // since 12 bits / 4096 + // Magic number bc idk the resistors on the voltage divider + float v_dec = v_int * 8.967; + + // get final voltage + v_int = (uint32_t)(v_dec * 10.0); + + memcpy(msg.data, &v_int, msg.len); + if (queue_can_msg(msg)) { + fault_data.diag = + "Failed to send steering LV monitor CAN message"; + queue_fault(&fault_data); + } +} + +void read_fuse_data(void *arg) +{ + pdu_t *pdu = (pdu_t *)arg; + fault_data_t fault_data = { .id = FUSE_MONITOR_FAULT, + .severity = DEFCON5 }; + can_msg_t fuse_msg = { .id = CANID_FUSE, .len = 2, .data = { 0 } }; + uint16_t fuse_buf; + bool fuses[MAX_FUSES] = { 0 }; + + struct __attribute__((__packed__)) { + uint8_t fuse_1; + uint8_t fuse_2; + } fuse_data; + + fuse_buf = 0; + + if (read_fuses(pdu, fuses)) { + fault_data.diag = "Failed to read fuses"; + queue_fault(&fault_data); + } + + for (fuse_t fuse = 0; fuse < MAX_FUSES; fuse++) { + fuse_buf |= + fuses[fuse] + << fuse; /* Sets the bit at position `fuse` to the state of the fuse */ + } + + fuse_data.fuse_1 = fuse_buf & 0xFF; + fuse_data.fuse_2 = (fuse_buf >> 8) & 0xFF; + + // reverse the bit order + fuse_data.fuse_1 = reverse_bits(fuse_data.fuse_1); + fuse_data.fuse_2 = reverse_bits(fuse_data.fuse_2); + + memcpy(fuse_msg.data, &fuse_data, fuse_msg.len); + if (queue_can_msg(fuse_msg)) { + fault_data.diag = "Failed to send CAN message"; + queue_fault(&fault_data); + } +} + void set_pedal_data(uint16_t accel_val, uint16_t brake_val) { osMutexAcquire(pedals_mutex, osWaitForever); @@ -190,97 +263,53 @@ void vPedalsMonitor(void *pv_params) } } -void read_lv_sense(mpu_t *mpu) -{ - fault_data_t fault_data = { .id = LV_MONITOR_FAULT, - .severity = DEFCON5 }; - can_msg_t msg = { .id = CANID_LV_MONITOR, .len = 4, .data = { 0 } }; - - uint32_t v_int; - - read_lv_voltage(mpu, &v_int); - - /* Convert from raw ADC reading to voltage level */ - - // scale up then truncate - // convert to out of 24 volts - // since 12 bits / 4096 - // Magic number bc idk the resistors on the voltage divider - float v_dec = v_int * 8.967; - - // get final voltage - v_int = (uint32_t)(v_dec * 10.0); - - memcpy(msg.data, &v_int, msg.len); - if (queue_can_msg(msg)) { - fault_data.diag = - "Failed to send steering LV monitor CAN message"; - queue_fault(&fault_data); - } -} - -bool get_tsms_reading() +bool get_tsms() { bool temp; - osMutexAcquire(tsms_reading_mutex, osWaitForever); - temp = tsms_reading; - osMutexRelease(tsms_reading_mutex); + osMutexAcquire(tsms_mutex, osWaitForever); + temp = tsms; + osMutexRelease(tsms_mutex); return temp; } -void read_tsms(pdu_t *pdu) +void tsms_debounce_cb(void *arg) { - fault_data_t fault_data = { .id = FUSE_MONITOR_FAULT, - .severity = DEFCON5 }; - static bool tsms_reading = false; - - /* If the TSMS reading throws an error, queue TSMS fault */ - osMutexAcquire(tsms_reading_mutex, osWaitForever); - if (read_tsms_sense(pdu, &tsms_reading)) { - queue_fault(&fault_data); - } else { - osThreadFlagsSet(process_tsms_thread_id, TSMS_UPDATE_FLAG); - } - osMutexRelease(tsms_reading_mutex); + /* Set TSMS state to new debounced value */ + osMutexAcquire(tsms_mutex, osWaitForever); + tsms = *((bool *)arg); + osMutexRelease(tsms_mutex); + /* Tell NERO allaboutit */ + send_nero_msg(); } -void read_fuse_data(pdu_t *pdu) +/** + * @brief Read the TSMS signal and debounce it. + * + * @param pdu Pointer to struct representing the PDU. + * @param tsms_debounce_timer Timer for debouncing the TSMS. + * @param tsms_reading Pointer to raw TSMS reading. + */ +void read_tsms(pdu_t *pdu, osTimerId_t tsms_debounce_timer, bool *tsms_reading) { fault_data_t fault_data = { .id = FUSE_MONITOR_FAULT, .severity = DEFCON5 }; - can_msg_t fuse_msg = { .id = CANID_FUSE, .len = 2, .data = { 0 } }; - uint16_t fuse_buf; - bool fuses[MAX_FUSES] = { 0 }; - - struct __attribute__((__packed__)) { - uint8_t fuse_1; - uint8_t fuse_2; - } fuse_data; - - fuse_buf = 0; - if (read_fuses(pdu, fuses)) { - fault_data.diag = "Failed to read fuses"; + /* If the TSMS reading throws an error, queue TSMS fault */ + if (read_tsms_sense(pdu, tsms_reading)) { queue_fault(&fault_data); } - for (fuse_t fuse = 0; fuse < MAX_FUSES; fuse++) { - fuse_buf |= - fuses[fuse] - << fuse; /* Sets the bit at position `fuse` to the state of the fuse */ - } - - fuse_data.fuse_1 = fuse_buf & 0xFF; - fuse_data.fuse_2 = (fuse_buf >> 8) & 0xFF; - - // reverse the bit order - fuse_data.fuse_1 = reverse_bits(fuse_data.fuse_1); - fuse_data.fuse_2 = reverse_bits(fuse_data.fuse_2); - - memcpy(fuse_msg.data, &fuse_data, fuse_msg.len); - if (queue_can_msg(fuse_msg)) { - fault_data.diag = "Failed to send CAN message"; - queue_fault(&fault_data); + /* Debounce tsms reading */ + if (*tsms_reading) + debounce(tsms_reading, tsms_debounce_timer, + TSMS_DEBOUNCE_PERIOD); + else + /* Since debounce only debounces logic high signals, the reading must be inverted if it is low. Think of this as debouncing a "TSMS off is active" debounce. */ + debounce(!tsms_reading, tsms_debounce_timer, + TSMS_DEBOUNCE_PERIOD); + + if (get_active() && get_tsms() == false) { + set_home_mode(); } } @@ -324,33 +353,28 @@ const osThreadAttr_t data_collection_attributes = { void vDataCollection(void *pv_params) { data_collection_args_t *args = (data_collection_args_t *)pv_params; - mpu_t *mpu = args->mpu; pdu_t *pdu = args->pdu; steeringio_t *wheel = args->wheel; free(args); static const uint8_t delay = 20; - tsms_reading_mutex = osMutexNew(NULL); + tsms_mutex = osMutexNew(NULL); + bool tsms_reading; + /* When the callback is called, the TSMS state will be set to the new reading in tsms_reading */ + osTimerId_t tsms_debounce_timer = + osTimerNew(&tsms_debounce_cb, osTimerOnce, &tsms_reading, NULL); for (;;) { - read_lv_sense(mpu); - osThreadYield(); - osDelay(delay); - - read_tsms(pdu); - osThreadYield(); - osDelay(delay); - - read_fuse_data(pdu); - osThreadYield(); + read_tsms(pdu, tsms_debounce_timer, &tsms_reading); osDelay(delay); steeringio_monitor(wheel); - osThreadYield(); osDelay(delay); } } +/* Unused -----------------------------------------------*/ + osThreadId_t temp_monitor_handle; const osThreadAttr_t temp_monitor_attributes = { .name = "TempMonitor", diff --git a/Core/Src/processing.c b/Core/Src/processing.c index c1527d0..919b109 100644 --- a/Core/Src/processing.c +++ b/Core/Src/processing.c @@ -34,69 +34,6 @@ static float torque_limit_percentage = 1.0; -#define TSMS_DEBOUNCE_PERIOD 500 /* ms */ - -static bool tsms = false; -osMutexId_t tsms_mutex; - -bool get_tsms() -{ - bool temp; - osMutexAcquire(tsms_mutex, osWaitForever); - temp = tsms; - osMutexRelease(tsms_mutex); - return temp; -} - -void tsms_debounce_cb(void *arg) -{ - /* Set TSMS state to new debounced value */ - osMutexAcquire(tsms_mutex, osWaitForever); - tsms = *((bool *)arg); - osMutexRelease(tsms_mutex); - /* Tell NERO allaboutit */ - send_nero_msg(); -} - -osThreadId_t process_tsms_thread_id; -const osThreadAttr_t process_tsms_attributes = { - .name = "ProcessTSMS", - .stack_size = 32 * 8, - .priority = (osPriority_t)osPriorityHigh, -}; - -void vProcessTSMS(void *pv_params) -{ - bool tsms_reading; - tsms_mutex = osMutexNew(NULL); - - /* When the callback is called, the TSMS state will be set to the new reading in tsms_reading */ - osTimerId_t tsms_debounce_timer = - osTimerNew(&tsms_debounce_cb, osTimerOnce, &tsms_reading, NULL); - - for (;;) { - osThreadFlagsWait(TSMS_UPDATE_FLAG, osFlagsWaitAny, - osWaitForever); - - /* Get raw TSMS reading */ - tsms_reading = get_tsms_reading(); - - /* Debounce tsms reading */ - if (tsms_reading) - debounce(tsms_reading, tsms_debounce_timer, - TSMS_DEBOUNCE_PERIOD); - else - /* Since debounce only debounces logic high signals, the reading must be inverted if it is low. Think of this as debouncing a "TSMS off is active" debounce. */ - debounce(!tsms_reading, tsms_debounce_timer, - TSMS_DEBOUNCE_PERIOD); - - if (get_active() && get_tsms() == false) { - //TODO: make task notification to check if car should shut off if TSMS goes off, however this works for now - set_home_mode(); - } - } -} - static void linear_accel_to_torque(float accel) { /* Sometimes, the pedal travel jumps to 1% even if it is not pressed. */ @@ -325,8 +262,8 @@ void vProcessPedals(void *pv_params) fault_data_t fault_data = { .id = BSPD_PREFAULT, .severity = DEFCON5, .diag = "BSPD prefault triggered" }; - /* 600 is an arbitrary threshold to consider the brakes mechanically activated */ - if (brake_value > 700 && (accelerator_value) > 0.25) { + /* BSPD braking theshold is arbitrary */ + if (brake_value > 700 && accelerator_value > 0.25) { printf("\n\n\n\rENTER MOTOR DISABLED\r\n\n\n"); motor_disabled = true; queue_fault(&fault_data); diff --git a/Core/Src/serial_monitor.c b/Core/Src/serial_monitor.c index 9127c99..41ee62a 100644 --- a/Core/Src/serial_monitor.c +++ b/Core/Src/serial_monitor.c @@ -54,7 +54,6 @@ int serial_print(const char *format, ...) void vSerialMonitor(void *pv_params) { char *message; - osStatus_t status; printf_queue = osMessageQueueNew(PRINTF_QUEUE_SIZE, sizeof(char *), NULL); @@ -64,13 +63,10 @@ void vSerialMonitor(void *pv_params) osWaitForever); /* Get message to print */ - status = osMessageQueueGet(printf_queue, &message, NULL, - osWaitForever); - while (status == osOK) { + while (osMessageQueueGet(printf_queue, &message, NULL, 0U) == + osOK) { printf(message); free(message); - status = osMessageQueueGet(printf_queue, &message, NULL, - 0U); } } } diff --git a/Core/Src/state_machine.c b/Core/Src/state_machine.c index 295f4a4..9b2a1e7 100644 --- a/Core/Src/state_machine.c +++ b/Core/Src/state_machine.c @@ -21,8 +21,6 @@ static state_t cerberus_state; extern IWDG_HandleTypeDef hiwdg; -osTimerId fault_timer; - typedef struct { enum { FUNCTIONAL, NERO } id; union { @@ -105,8 +103,6 @@ static int transition_functional_state(func_state_t new_state, pdu_t *pdu, // write_fan_battbox(pdu, true); write_pump(pdu, false); write_fault(pdu, false); - // DO NOT CHANGE WITHOUT CHECKING the bms fault timer, as if BMS timer is later could result in a fault/unfault/fault flicker. - osTimerStart(fault_timer, 5000); HAL_IWDG_Refresh(&hiwdg); cerberus_state.nero = (nero_state_t){ .nero_index = OFF, .home_mode = false };