diff --git a/Core/Inc/compute.h b/Core/Inc/compute.h index 03e0268..269806b 100644 --- a/Core/Inc/compute.h +++ b/Core/Inc/compute.h @@ -185,7 +185,7 @@ void compute_send_segment_temp_message(acc_data_t *bmsdata); void compute_send_fault_message(uint8_t status, int16_t curr, int16_t in_dcl); -void compute_send_fault_timer_message(uint8_t start_stop, uint16_t fault_code, +void compute_send_fault_timer_message(uint8_t start_stop, int fault_code, uint16_t data_1); /** diff --git a/Core/Src/can_handler.c b/Core/Src/can_handler.c index 745dc5a..fde3ea8 100644 --- a/Core/Src/can_handler.c +++ b/Core/Src/can_handler.c @@ -98,7 +98,7 @@ void init_can_msg_config() can_msg_t fault_timer_msg; fault_timer_msg.id = FAULT_TIMER_CANID; - fault_timer_msg.len = 5; + fault_timer_msg.len = 4; // rl_data_t rl_discharge_data = { .msg_rate = 5000 }; // rl_data_t rl_charge_data = { .msg_rate = 0 }; diff --git a/Core/Src/compute.c b/Core/Src/compute.c index 17f7243..80881e0 100644 --- a/Core/Src/compute.c +++ b/Core/Src/compute.c @@ -535,17 +535,17 @@ void compute_send_fault_message(uint8_t status, int16_t curr, int16_t in_dcl) queue_can_msg(bms_can_msgs[FAULT]); } -void compute_send_fault_timer_message(uint8_t start_stop, uint16_t fault_code, +void compute_send_fault_timer_message(uint8_t start_stop, int fault_code, uint16_t data_1) { struct __attribute__((__packed__)) { uint8_t start_stop; - uint16_t fault_code; + uint8_t fault_code; int16_t data_1; } fault_timer_msg_data; fault_timer_msg_data.start_stop = start_stop; - fault_timer_msg_data.fault_code = fault_code; + fault_timer_msg_data.fault_code = log2(fault_code); fault_timer_msg_data.data_1 = data_1; endian_swap(&fault_timer_msg_data.fault_code,