From b0392acfbdacfc45cd9436d136df02e6201ee16e Mon Sep 17 00:00:00 2001 From: Federico Carbone Date: Tue, 27 Jun 2023 15:36:26 +0200 Subject: [PATCH] fix: changed dbc and returning cells in mv --- Core/Inc/L9963E_utils.h | 4 +- Core/Inc/sc22_evo_canlv.h | 282 +++++++++++++++++--- Core/Src/L9963E_utils.c | 8 +- Core/Src/can_send_timebase.c | 12 +- Core/Src/can_utils.c | 58 ++-- Core/Src/main.c | 2 +- Core/Src/ntc.c | 5 + Core/Src/sc22_evo_canlv.c | 200 +++++++++++--- openblt_f446re/STM32-for-VSCode.config.yaml | 2 +- openblt_f446re/STM32Make.make | 2 +- 10 files changed, 450 insertions(+), 125 deletions(-) diff --git a/Core/Inc/L9963E_utils.h b/Core/Inc/L9963E_utils.h index 268835e..58f4ee2 100644 --- a/Core/Inc/L9963E_utils.h +++ b/Core/Inc/L9963E_utils.h @@ -13,7 +13,7 @@ void L9963E_utils_init(void); void L9963E_utils_read_cells(uint8_t read_gpio); uint16_t const* L9963E_utils_get_gpios(uint8_t *len); uint16_t const* L9963E_utils_get_cells(uint8_t *len); -float L9963E_utils_get_cell_v(uint8_t index); -float L9963E_utils_get_batt_v(void); +float L9963E_utils_get_cell_mv(uint8_t index); +float L9963E_utils_get_batt_mv(void); #endif // L9963E_UTILS_H diff --git a/Core/Inc/sc22_evo_canlv.h b/Core/Inc/sc22_evo_canlv.h index 7fdc513..cac82ee 100644 --- a/Core/Inc/sc22_evo_canlv.h +++ b/Core/Inc/sc22_evo_canlv.h @@ -25,7 +25,7 @@ */ /** - * This file was generated by cantools version 38.0.2 Fri Jun 23 15:17:26 2023. + * This file was generated by cantools version 38.0.2 Tue Jun 27 15:29:44 2023. */ #ifndef SC22_EVO_CANLV_H @@ -46,7 +46,8 @@ extern "C" { /* Frame ids. */ #define SC22_EVO_CANLV_STEERING_RTD_FRAME_ID (0x26u) #define SC22_EVO_CANLV_STEERING_MOTOR_CONTROL_DEBUG_FRAME_ID (0x500u) -#define SC22_EVO_CANLV_BMSLV_TEMP_FRAME_ID (0x105u) +#define SC22_EVO_CANLV_BMSLV_TEMP1_FRAME_ID (0x104u) +#define SC22_EVO_CANLV_BMSLV_TEMP2_FRAME_ID (0x105u) #define SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE1_FRAME_ID (0x100u) #define SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE2_FRAME_ID (0x101u) #define SC22_EVO_CANLV_BMSLV_BATTERY_PACK_GENERAL_FRAME_ID (0x102u) @@ -69,7 +70,8 @@ extern "C" { /* Frame lengths in bytes. */ #define SC22_EVO_CANLV_STEERING_RTD_LENGTH (1u) #define SC22_EVO_CANLV_STEERING_MOTOR_CONTROL_DEBUG_LENGTH (1u) -#define SC22_EVO_CANLV_BMSLV_TEMP_LENGTH (8u) +#define SC22_EVO_CANLV_BMSLV_TEMP1_LENGTH (8u) +#define SC22_EVO_CANLV_BMSLV_TEMP2_LENGTH (8u) #define SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE1_LENGTH (8u) #define SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE2_LENGTH (6u) #define SC22_EVO_CANLV_BMSLV_BATTERY_PACK_GENERAL_LENGTH (4u) @@ -92,7 +94,8 @@ extern "C" { /* Extended or standard frame types. */ #define SC22_EVO_CANLV_STEERING_RTD_IS_EXTENDED (0) #define SC22_EVO_CANLV_STEERING_MOTOR_CONTROL_DEBUG_IS_EXTENDED (0) -#define SC22_EVO_CANLV_BMSLV_TEMP_IS_EXTENDED (0) +#define SC22_EVO_CANLV_BMSLV_TEMP1_IS_EXTENDED (0) +#define SC22_EVO_CANLV_BMSLV_TEMP2_IS_EXTENDED (0) #define SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE1_IS_EXTENDED (0) #define SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE2_IS_EXTENDED (0) #define SC22_EVO_CANLV_BMSLV_BATTERY_PACK_GENERAL_IS_EXTENDED (0) @@ -168,18 +171,60 @@ struct sc22_evo_canlv_steering_motor_control_debug_t { }; /** - * Signals in message BMSLV_Temp. + * Signals in message BMSLV_Temp1. * * All signal values are as on the CAN bus. */ -struct sc22_evo_canlv_bmslv_temp_t { +struct sc22_evo_canlv_bmslv_temp1_t { /** - * Range: 0..1 (0.000000..1.000000 -) - * Scale: 1.0 - * Offset: 0.0 + * Range: -32..991 (0.000000..31968.750000 -) + * Scale: 31.25 + * Offset: 1000.0 + */ + uint16_t ntc1_resistance; + + /** + * Range: -32..991 (0.000000..31968.750000 -) + * Scale: 31.25 + * Offset: 1000.0 + */ + uint16_t ntc2_resistance; + + /** + * Range: -32..991 (0.000000..31968.750000 -) + * Scale: 31.25 + * Offset: 1000.0 + */ + uint16_t ntc3_resistance; + + /** + * Range: -32..991 (0.000000..31968.750000 -) + * Scale: 31.25 + * Offset: 1000.0 + */ + uint16_t ntc4_resistance; + + /** + * Range: -32..991 (0.000000..31968.750000 -) + * Scale: 31.25 + * Offset: 1000.0 + */ + uint16_t ntc5_resistance; + + /** + * Range: -32..991 (0.000000..31968.750000 -) + * Scale: 31.25 + * Offset: 1000.0 */ - int8_t ntc_is_first_message; + uint16_t ntc6_resistance; +}; +/** + * Signals in message BMSLV_Temp2. + * + * All signal values are as on the CAN bus. + */ +struct sc22_evo_canlv_bmslv_temp2_t { /** * Range: -32..991 (0.000000..31968.750000 -) * Scale: 31.25 @@ -1122,7 +1167,7 @@ float sc22_evo_canlv_steering_motor_control_debug_rear_right_on_decode(int8_t va bool sc22_evo_canlv_steering_motor_control_debug_rear_right_on_is_in_range(int8_t value); /** - * Pack message BMSLV_Temp. + * Pack message BMSLV_Temp1. * * @param[out] dst_p Buffer to pack the message into. * @param[in] src_p Data to pack. @@ -1130,13 +1175,13 @@ bool sc22_evo_canlv_steering_motor_control_debug_rear_right_on_is_in_range(int8_ * * @return Size of packed data, or negative error code. */ -int sc22_evo_canlv_bmslv_temp_pack( +int sc22_evo_canlv_bmslv_temp1_pack( uint8_t *dst_p, - const struct sc22_evo_canlv_bmslv_temp_t *src_p, + const struct sc22_evo_canlv_bmslv_temp1_t *src_p, size_t size); /** - * Unpack message BMSLV_Temp. + * Unpack message BMSLV_Temp1. * * @param[out] dst_p Object to unpack the message into. * @param[in] src_p Message to unpack. @@ -1144,8 +1189,8 @@ int sc22_evo_canlv_bmslv_temp_pack( * * @return zero(0) or negative error code. */ -int sc22_evo_canlv_bmslv_temp_unpack( - struct sc22_evo_canlv_bmslv_temp_t *dst_p, +int sc22_evo_canlv_bmslv_temp1_unpack( + struct sc22_evo_canlv_bmslv_temp1_t *dst_p, const uint8_t *src_p, size_t size); @@ -1156,7 +1201,61 @@ int sc22_evo_canlv_bmslv_temp_unpack( * * @return Encoded signal. */ -int8_t sc22_evo_canlv_bmslv_temp_ntc_is_first_message_encode(float value); +uint16_t sc22_evo_canlv_bmslv_temp1_ntc1_resistance_encode(float value); + +/** + * Decode given signal by applying scaling and offset. + * + * @param[in] value Signal to decode. + * + * @return Decoded signal. + */ +float sc22_evo_canlv_bmslv_temp1_ntc1_resistance_decode(uint16_t value); + +/** + * Check that given signal is in allowed range. + * + * @param[in] value Signal to check. + * + * @return true if in range, false otherwise. + */ +bool sc22_evo_canlv_bmslv_temp1_ntc1_resistance_is_in_range(uint16_t value); + +/** + * Encode given signal by applying scaling and offset. + * + * @param[in] value Signal to encode. + * + * @return Encoded signal. + */ +uint16_t sc22_evo_canlv_bmslv_temp1_ntc2_resistance_encode(float value); + +/** + * Decode given signal by applying scaling and offset. + * + * @param[in] value Signal to decode. + * + * @return Decoded signal. + */ +float sc22_evo_canlv_bmslv_temp1_ntc2_resistance_decode(uint16_t value); + +/** + * Check that given signal is in allowed range. + * + * @param[in] value Signal to check. + * + * @return true if in range, false otherwise. + */ +bool sc22_evo_canlv_bmslv_temp1_ntc2_resistance_is_in_range(uint16_t value); + +/** + * Encode given signal by applying scaling and offset. + * + * @param[in] value Signal to encode. + * + * @return Encoded signal. + */ +uint16_t sc22_evo_canlv_bmslv_temp1_ntc3_resistance_encode(float value); /** * Decode given signal by applying scaling and offset. @@ -1165,7 +1264,7 @@ int8_t sc22_evo_canlv_bmslv_temp_ntc_is_first_message_encode(float value); * * @return Decoded signal. */ -float sc22_evo_canlv_bmslv_temp_ntc_is_first_message_decode(int8_t value); +float sc22_evo_canlv_bmslv_temp1_ntc3_resistance_decode(uint16_t value); /** * Check that given signal is in allowed range. @@ -1174,7 +1273,116 @@ float sc22_evo_canlv_bmslv_temp_ntc_is_first_message_decode(int8_t value); * * @return true if in range, false otherwise. */ -bool sc22_evo_canlv_bmslv_temp_ntc_is_first_message_is_in_range(int8_t value); +bool sc22_evo_canlv_bmslv_temp1_ntc3_resistance_is_in_range(uint16_t value); + +/** + * Encode given signal by applying scaling and offset. + * + * @param[in] value Signal to encode. + * + * @return Encoded signal. + */ +uint16_t sc22_evo_canlv_bmslv_temp1_ntc4_resistance_encode(float value); + +/** + * Decode given signal by applying scaling and offset. + * + * @param[in] value Signal to decode. + * + * @return Decoded signal. + */ +float sc22_evo_canlv_bmslv_temp1_ntc4_resistance_decode(uint16_t value); + +/** + * Check that given signal is in allowed range. + * + * @param[in] value Signal to check. + * + * @return true if in range, false otherwise. + */ +bool sc22_evo_canlv_bmslv_temp1_ntc4_resistance_is_in_range(uint16_t value); + +/** + * Encode given signal by applying scaling and offset. + * + * @param[in] value Signal to encode. + * + * @return Encoded signal. + */ +uint16_t sc22_evo_canlv_bmslv_temp1_ntc5_resistance_encode(float value); + +/** + * Decode given signal by applying scaling and offset. + * + * @param[in] value Signal to decode. + * + * @return Decoded signal. + */ +float sc22_evo_canlv_bmslv_temp1_ntc5_resistance_decode(uint16_t value); + +/** + * Check that given signal is in allowed range. + * + * @param[in] value Signal to check. + * + * @return true if in range, false otherwise. + */ +bool sc22_evo_canlv_bmslv_temp1_ntc5_resistance_is_in_range(uint16_t value); + +/** + * Encode given signal by applying scaling and offset. + * + * @param[in] value Signal to encode. + * + * @return Encoded signal. + */ +uint16_t sc22_evo_canlv_bmslv_temp1_ntc6_resistance_encode(float value); + +/** + * Decode given signal by applying scaling and offset. + * + * @param[in] value Signal to decode. + * + * @return Decoded signal. + */ +float sc22_evo_canlv_bmslv_temp1_ntc6_resistance_decode(uint16_t value); + +/** + * Check that given signal is in allowed range. + * + * @param[in] value Signal to check. + * + * @return true if in range, false otherwise. + */ +bool sc22_evo_canlv_bmslv_temp1_ntc6_resistance_is_in_range(uint16_t value); + +/** + * Pack message BMSLV_Temp2. + * + * @param[out] dst_p Buffer to pack the message into. + * @param[in] src_p Data to pack. + * @param[in] size Size of dst_p. + * + * @return Size of packed data, or negative error code. + */ +int sc22_evo_canlv_bmslv_temp2_pack( + uint8_t *dst_p, + const struct sc22_evo_canlv_bmslv_temp2_t *src_p, + size_t size); + +/** + * Unpack message BMSLV_Temp2. + * + * @param[out] dst_p Object to unpack the message into. + * @param[in] src_p Message to unpack. + * @param[in] size Size of src_p. + * + * @return zero(0) or negative error code. + */ +int sc22_evo_canlv_bmslv_temp2_unpack( + struct sc22_evo_canlv_bmslv_temp2_t *dst_p, + const uint8_t *src_p, + size_t size); /** * Encode given signal by applying scaling and offset. @@ -1183,7 +1391,7 @@ bool sc22_evo_canlv_bmslv_temp_ntc_is_first_message_is_in_range(int8_t value); * * @return Encoded signal. */ -uint16_t sc22_evo_canlv_bmslv_temp_ntc1_resistance_encode(float value); +uint16_t sc22_evo_canlv_bmslv_temp2_ntc1_resistance_encode(float value); /** * Decode given signal by applying scaling and offset. @@ -1192,7 +1400,7 @@ uint16_t sc22_evo_canlv_bmslv_temp_ntc1_resistance_encode(float value); * * @return Decoded signal. */ -float sc22_evo_canlv_bmslv_temp_ntc1_resistance_decode(uint16_t value); +float sc22_evo_canlv_bmslv_temp2_ntc1_resistance_decode(uint16_t value); /** * Check that given signal is in allowed range. @@ -1201,7 +1409,7 @@ float sc22_evo_canlv_bmslv_temp_ntc1_resistance_decode(uint16_t value); * * @return true if in range, false otherwise. */ -bool sc22_evo_canlv_bmslv_temp_ntc1_resistance_is_in_range(uint16_t value); +bool sc22_evo_canlv_bmslv_temp2_ntc1_resistance_is_in_range(uint16_t value); /** * Encode given signal by applying scaling and offset. @@ -1210,7 +1418,7 @@ bool sc22_evo_canlv_bmslv_temp_ntc1_resistance_is_in_range(uint16_t value); * * @return Encoded signal. */ -uint16_t sc22_evo_canlv_bmslv_temp_ntc2_resistance_encode(float value); +uint16_t sc22_evo_canlv_bmslv_temp2_ntc2_resistance_encode(float value); /** * Decode given signal by applying scaling and offset. @@ -1219,7 +1427,7 @@ uint16_t sc22_evo_canlv_bmslv_temp_ntc2_resistance_encode(float value); * * @return Decoded signal. */ -float sc22_evo_canlv_bmslv_temp_ntc2_resistance_decode(uint16_t value); +float sc22_evo_canlv_bmslv_temp2_ntc2_resistance_decode(uint16_t value); /** * Check that given signal is in allowed range. @@ -1228,7 +1436,7 @@ float sc22_evo_canlv_bmslv_temp_ntc2_resistance_decode(uint16_t value); * * @return true if in range, false otherwise. */ -bool sc22_evo_canlv_bmslv_temp_ntc2_resistance_is_in_range(uint16_t value); +bool sc22_evo_canlv_bmslv_temp2_ntc2_resistance_is_in_range(uint16_t value); /** * Encode given signal by applying scaling and offset. @@ -1237,7 +1445,7 @@ bool sc22_evo_canlv_bmslv_temp_ntc2_resistance_is_in_range(uint16_t value); * * @return Encoded signal. */ -uint16_t sc22_evo_canlv_bmslv_temp_ntc3_resistance_encode(float value); +uint16_t sc22_evo_canlv_bmslv_temp2_ntc3_resistance_encode(float value); /** * Decode given signal by applying scaling and offset. @@ -1246,7 +1454,7 @@ uint16_t sc22_evo_canlv_bmslv_temp_ntc3_resistance_encode(float value); * * @return Decoded signal. */ -float sc22_evo_canlv_bmslv_temp_ntc3_resistance_decode(uint16_t value); +float sc22_evo_canlv_bmslv_temp2_ntc3_resistance_decode(uint16_t value); /** * Check that given signal is in allowed range. @@ -1255,7 +1463,7 @@ float sc22_evo_canlv_bmslv_temp_ntc3_resistance_decode(uint16_t value); * * @return true if in range, false otherwise. */ -bool sc22_evo_canlv_bmslv_temp_ntc3_resistance_is_in_range(uint16_t value); +bool sc22_evo_canlv_bmslv_temp2_ntc3_resistance_is_in_range(uint16_t value); /** * Encode given signal by applying scaling and offset. @@ -1264,7 +1472,7 @@ bool sc22_evo_canlv_bmslv_temp_ntc3_resistance_is_in_range(uint16_t value); * * @return Encoded signal. */ -uint16_t sc22_evo_canlv_bmslv_temp_ntc4_resistance_encode(float value); +uint16_t sc22_evo_canlv_bmslv_temp2_ntc4_resistance_encode(float value); /** * Decode given signal by applying scaling and offset. @@ -1273,7 +1481,7 @@ uint16_t sc22_evo_canlv_bmslv_temp_ntc4_resistance_encode(float value); * * @return Decoded signal. */ -float sc22_evo_canlv_bmslv_temp_ntc4_resistance_decode(uint16_t value); +float sc22_evo_canlv_bmslv_temp2_ntc4_resistance_decode(uint16_t value); /** * Check that given signal is in allowed range. @@ -1282,7 +1490,7 @@ float sc22_evo_canlv_bmslv_temp_ntc4_resistance_decode(uint16_t value); * * @return true if in range, false otherwise. */ -bool sc22_evo_canlv_bmslv_temp_ntc4_resistance_is_in_range(uint16_t value); +bool sc22_evo_canlv_bmslv_temp2_ntc4_resistance_is_in_range(uint16_t value); /** * Encode given signal by applying scaling and offset. @@ -1291,7 +1499,7 @@ bool sc22_evo_canlv_bmslv_temp_ntc4_resistance_is_in_range(uint16_t value); * * @return Encoded signal. */ -uint16_t sc22_evo_canlv_bmslv_temp_ntc5_resistance_encode(float value); +uint16_t sc22_evo_canlv_bmslv_temp2_ntc5_resistance_encode(float value); /** * Decode given signal by applying scaling and offset. @@ -1300,7 +1508,7 @@ uint16_t sc22_evo_canlv_bmslv_temp_ntc5_resistance_encode(float value); * * @return Decoded signal. */ -float sc22_evo_canlv_bmslv_temp_ntc5_resistance_decode(uint16_t value); +float sc22_evo_canlv_bmslv_temp2_ntc5_resistance_decode(uint16_t value); /** * Check that given signal is in allowed range. @@ -1309,7 +1517,7 @@ float sc22_evo_canlv_bmslv_temp_ntc5_resistance_decode(uint16_t value); * * @return true if in range, false otherwise. */ -bool sc22_evo_canlv_bmslv_temp_ntc5_resistance_is_in_range(uint16_t value); +bool sc22_evo_canlv_bmslv_temp2_ntc5_resistance_is_in_range(uint16_t value); /** * Encode given signal by applying scaling and offset. @@ -1318,7 +1526,7 @@ bool sc22_evo_canlv_bmslv_temp_ntc5_resistance_is_in_range(uint16_t value); * * @return Encoded signal. */ -uint16_t sc22_evo_canlv_bmslv_temp_ntc6_resistance_encode(float value); +uint16_t sc22_evo_canlv_bmslv_temp2_ntc6_resistance_encode(float value); /** * Decode given signal by applying scaling and offset. @@ -1327,7 +1535,7 @@ uint16_t sc22_evo_canlv_bmslv_temp_ntc6_resistance_encode(float value); * * @return Decoded signal. */ -float sc22_evo_canlv_bmslv_temp_ntc6_resistance_decode(uint16_t value); +float sc22_evo_canlv_bmslv_temp2_ntc6_resistance_decode(uint16_t value); /** * Check that given signal is in allowed range. @@ -1336,7 +1544,7 @@ float sc22_evo_canlv_bmslv_temp_ntc6_resistance_decode(uint16_t value); * * @return true if in range, false otherwise. */ -bool sc22_evo_canlv_bmslv_temp_ntc6_resistance_is_in_range(uint16_t value); +bool sc22_evo_canlv_bmslv_temp2_ntc6_resistance_is_in_range(uint16_t value); /** * Pack message BMSLV_CellVoltage1. diff --git a/Core/Src/L9963E_utils.c b/Core/Src/L9963E_utils.c index f92610d..e2fb561 100644 --- a/Core/Src/L9963E_utils.c +++ b/Core/Src/L9963E_utils.c @@ -150,10 +150,10 @@ uint16_t const* L9963E_utils_get_cells(uint8_t *len) { return vcells; } -float L9963E_utils_get_cell_v(uint8_t index) { - return vcells[index] * 89e-6f; +float L9963E_utils_get_cell_mv(uint8_t index) { + return vcells[index] * 89e-3f; } -float L9963E_utils_get_batt_v(void) { - return vtot * 1.33e-3f; +float L9963E_utils_get_batt_mv(void) { + return vtot * 1.33f; } \ No newline at end of file diff --git a/Core/Src/can_send_timebase.c b/Core/Src/can_send_timebase.c index e978ddd..72e0333 100644 --- a/Core/Src/can_send_timebase.c +++ b/Core/Src/can_send_timebase.c @@ -8,12 +8,8 @@ STMLIBS_StatusTypeDef battery_pack_general_cb(void) { return STMLIBS_OK; } -STMLIBS_StatusTypeDef cell_voltage1_cb(void) { +STMLIBS_StatusTypeDef cell_voltage_cb(void) { can_send_msg(SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE1_FRAME_ID); - return STMLIBS_OK; -} - -STMLIBS_StatusTypeDef cell_voltage2_cb(void) { can_send_msg(SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE2_FRAME_ID); return STMLIBS_OK; } @@ -24,7 +20,8 @@ STMLIBS_StatusTypeDef status_cb(void) { } STMLIBS_StatusTypeDef temp_cb(void) { - can_send_msg(SC22_EVO_CANLV_BMSLV_TEMP_FRAME_ID); + can_send_msg(SC22_EVO_CANLV_BMSLV_TEMP1_FRAME_ID); + can_send_msg(SC22_EVO_CANLV_BMSLV_TEMP2_FRAME_ID); return STMLIBS_OK; } @@ -35,8 +32,7 @@ void can_send_timebase_init(void) { TIMEBASE_add_interval(&can_send_timebase_handle, 1000, &interval); TIMEBASE_register_callback(&can_send_timebase_handle, interval, battery_pack_general_cb); - TIMEBASE_register_callback(&can_send_timebase_handle, interval, cell_voltage1_cb); - TIMEBASE_register_callback(&can_send_timebase_handle, interval, cell_voltage2_cb); + TIMEBASE_register_callback(&can_send_timebase_handle, interval, cell_voltage_cb); TIMEBASE_register_callback(&can_send_timebase_handle, interval, status_cb); TIMEBASE_add_interval(&can_send_timebase_handle, 20000, &interval); diff --git a/Core/Src/can_utils.c b/Core/Src/can_utils.c index 034fe96..fbbfe12 100644 --- a/Core/Src/can_utils.c +++ b/Core/Src/can_utils.c @@ -55,7 +55,8 @@ HAL_StatusTypeDef can_send(CAN_HandleTypeDef *hcan, uint8_t *buffer, CAN_TxHeade void can_send_msg(uint32_t id) { uint8_t buffer[8] = {0}; union { - struct sc22_evo_canlv_bmslv_temp_t bmslv_temp; + struct sc22_evo_canlv_bmslv_temp1_t bmslv_temp1; + struct sc22_evo_canlv_bmslv_temp2_t bmslv_temp2; struct sc22_evo_canlv_bmslv_cell_voltage1_t bmslv_cell_voltage1; struct sc22_evo_canlv_bmslv_cell_voltage2_t bmslv_cell_voltage2; struct sc22_evo_canlv_bmslv_battery_pack_general_t bmslv_battery_pack_general; @@ -66,49 +67,48 @@ void can_send_msg(uint32_t id) { switch (id) { - case SC22_EVO_CANLV_BMSLV_TEMP_FRAME_ID: - msgs.bmslv_temp.ntc_is_first_message = 1; - msgs.bmslv_temp.ntc1_resistance = sc22_evo_canlv_bmslv_temp_ntc1_resistance_encode(ntc_get_ext_resistance(0)); - msgs.bmslv_temp.ntc2_resistance = sc22_evo_canlv_bmslv_temp_ntc2_resistance_encode(ntc_get_ext_resistance(1)); - msgs.bmslv_temp.ntc3_resistance = sc22_evo_canlv_bmslv_temp_ntc3_resistance_encode(ntc_get_ext_resistance(2)); - msgs.bmslv_temp.ntc4_resistance = sc22_evo_canlv_bmslv_temp_ntc4_resistance_encode(ntc_get_ext_resistance(3)); - msgs.bmslv_temp.ntc5_resistance = sc22_evo_canlv_bmslv_temp_ntc5_resistance_encode(ntc_get_ext_resistance(4)); - msgs.bmslv_temp.ntc6_resistance = sc22_evo_canlv_bmslv_temp_ntc6_resistance_encode(ntc_get_ext_resistance(5)); - - tx_header.DLC = sc22_evo_canlv_bmslv_temp_pack(buffer, &msgs.bmslv_temp, SC22_EVO_CANLV_BMSLV_TEMP_LENGTH); + case SC22_EVO_CANLV_BMSLV_TEMP1_FRAME_ID: + msgs.bmslv_temp2.ntc1_resistance = sc22_evo_canlv_bmslv_temp2_ntc1_resistance_encode(ntc_get_ext_resistance(0)); + msgs.bmslv_temp2.ntc2_resistance = sc22_evo_canlv_bmslv_temp2_ntc2_resistance_encode(ntc_get_ext_resistance(1)); + msgs.bmslv_temp2.ntc3_resistance = sc22_evo_canlv_bmslv_temp2_ntc3_resistance_encode(ntc_get_ext_resistance(2)); + msgs.bmslv_temp2.ntc4_resistance = sc22_evo_canlv_bmslv_temp2_ntc4_resistance_encode(ntc_get_ext_resistance(3)); + msgs.bmslv_temp2.ntc5_resistance = sc22_evo_canlv_bmslv_temp2_ntc5_resistance_encode(ntc_get_ext_resistance(4)); + msgs.bmslv_temp2.ntc6_resistance = sc22_evo_canlv_bmslv_temp2_ntc6_resistance_encode(ntc_get_ext_resistance(5)); + + tx_header.DLC = sc22_evo_canlv_bmslv_temp1_pack(buffer, &msgs.bmslv_temp1, SC22_EVO_CANLV_BMSLV_TEMP1_LENGTH); can_send(&hcan1, buffer, &tx_header); - - msgs.bmslv_temp.ntc_is_first_message = 0; - msgs.bmslv_temp.ntc1_resistance = sc22_evo_canlv_bmslv_temp_ntc1_resistance_encode(ntc_get_ext_resistance(6)); - msgs.bmslv_temp.ntc2_resistance = sc22_evo_canlv_bmslv_temp_ntc2_resistance_encode(ntc_get_int_resistance(0)); - msgs.bmslv_temp.ntc3_resistance = sc22_evo_canlv_bmslv_temp_ntc3_resistance_encode(ntc_get_int_resistance(1)); - msgs.bmslv_temp.ntc4_resistance = sc22_evo_canlv_bmslv_temp_ntc4_resistance_encode(ntc_get_int_resistance(2)); - msgs.bmslv_temp.ntc5_resistance = sc22_evo_canlv_bmslv_temp_ntc5_resistance_encode(ntc_get_int_resistance(3)); - msgs.bmslv_temp.ntc6_resistance = sc22_evo_canlv_bmslv_temp_ntc6_resistance_encode(ntc_get_int_resistance(4)); - - tx_header.DLC = sc22_evo_canlv_bmslv_temp_pack(buffer, &msgs.bmslv_temp, SC22_EVO_CANLV_BMSLV_TEMP_LENGTH); + break; + case SC22_EVO_CANLV_BMSLV_TEMP2_FRAME_ID: + msgs.bmslv_temp2.ntc1_resistance = sc22_evo_canlv_bmslv_temp2_ntc1_resistance_encode(ntc_get_ext_resistance(6)); + msgs.bmslv_temp2.ntc2_resistance = sc22_evo_canlv_bmslv_temp2_ntc2_resistance_encode(ntc_get_int_resistance(0)); + msgs.bmslv_temp2.ntc3_resistance = sc22_evo_canlv_bmslv_temp2_ntc3_resistance_encode(ntc_get_int_resistance(1)); + msgs.bmslv_temp2.ntc4_resistance = sc22_evo_canlv_bmslv_temp2_ntc4_resistance_encode(ntc_get_int_resistance(2)); + msgs.bmslv_temp2.ntc5_resistance = sc22_evo_canlv_bmslv_temp2_ntc5_resistance_encode(ntc_get_int_resistance(3)); + msgs.bmslv_temp2.ntc6_resistance = sc22_evo_canlv_bmslv_temp2_ntc6_resistance_encode(ntc_get_int_resistance(4)); + + tx_header.DLC = sc22_evo_canlv_bmslv_temp2_pack(buffer, &msgs.bmslv_temp2, SC22_EVO_CANLV_BMSLV_TEMP2_LENGTH); can_send(&hcan1, buffer, &tx_header); break; case SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE1_FRAME_ID: - msgs.bmslv_cell_voltage1.cell_1_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_1_voltage_m_v_encode(L9963E_utils_get_cell_v(0)); - msgs.bmslv_cell_voltage1.cell_2_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_2_voltage_m_v_encode(L9963E_utils_get_cell_v(1)); - msgs.bmslv_cell_voltage1.cell_3_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_3_voltage_m_v_encode(L9963E_utils_get_cell_v(2)); - msgs.bmslv_cell_voltage1.cell_4_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_4_voltage_m_v_encode(L9963E_utils_get_cell_v(3)); + msgs.bmslv_cell_voltage1.cell_1_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_1_voltage_m_v_encode(L9963E_utils_get_cell_mv(0)); + msgs.bmslv_cell_voltage1.cell_2_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_2_voltage_m_v_encode(L9963E_utils_get_cell_mv(1)); + msgs.bmslv_cell_voltage1.cell_3_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_3_voltage_m_v_encode(L9963E_utils_get_cell_mv(2)); + msgs.bmslv_cell_voltage1.cell_4_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_4_voltage_m_v_encode(L9963E_utils_get_cell_mv(3)); tx_header.DLC = sc22_evo_canlv_bmslv_cell_voltage1_pack(buffer, &msgs.bmslv_cell_voltage1, SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE1_LENGTH); can_send(&hcan1, buffer, &tx_header); break; case SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE2_FRAME_ID: - msgs.bmslv_cell_voltage2.cell_5_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_1_voltage_m_v_encode(L9963E_utils_get_cell_v(4)); - msgs.bmslv_cell_voltage2.cell_6_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_2_voltage_m_v_encode(L9963E_utils_get_cell_v(5)); - msgs.bmslv_cell_voltage2.cell_7_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_3_voltage_m_v_encode(L9963E_utils_get_cell_v(6)); + msgs.bmslv_cell_voltage2.cell_5_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_1_voltage_m_v_encode(L9963E_utils_get_cell_mv(4)); + msgs.bmslv_cell_voltage2.cell_6_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_2_voltage_m_v_encode(L9963E_utils_get_cell_mv(5)); + msgs.bmslv_cell_voltage2.cell_7_voltage_m_v = sc22_evo_canlv_bmslv_cell_voltage1_cell_3_voltage_m_v_encode(L9963E_utils_get_cell_mv(6)); tx_header.DLC = sc22_evo_canlv_bmslv_cell_voltage2_pack(buffer, &msgs.bmslv_cell_voltage2, SC22_EVO_CANLV_BMSLV_CELL_VOLTAGE2_LENGTH); can_send(&hcan1, buffer, &tx_header); break; case SC22_EVO_CANLV_BMSLV_BATTERY_PACK_GENERAL_FRAME_ID: msgs.bmslv_battery_pack_general.current_sensor_voltage = sc22_evo_canlv_bmslv_battery_pack_general_current_sensor_voltage_encode(lem_get_current_ampere()); - msgs.bmslv_battery_pack_general.lv_total_voltage_m_v = 0xdead; + msgs.bmslv_battery_pack_general.lv_total_voltage_m_v = sc22_evo_canlv_bmslv_battery_pack_general_lv_total_voltage_m_v_encode(L9963E_utils_get_batt_mv()); tx_header.DLC = sc22_evo_canlv_bmslv_battery_pack_general_pack(buffer, &msgs.bmslv_battery_pack_general, SC22_EVO_CANLV_BMSLV_BATTERY_PACK_GENERAL_LENGTH); can_send(&hcan1, buffer, &tx_header); diff --git a/Core/Src/main.c b/Core/Src/main.c index af6ad28..4377f8c 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -140,7 +140,7 @@ int main(void) data_reading_timebase_routine(); can_send_timebase_routine(); - battery_v = L9963E_utils_get_batt_v(); + battery_v = L9963E_utils_get_batt_mv(); if(battery_v > 21.56) { HAL_GPIO_WritePin(LED_WARN_GPIO_OUT_GPIO_Port, LED_WARN_GPIO_OUT_Pin, GPIO_PIN_SET); diff --git a/Core/Src/ntc.c b/Core/Src/ntc.c index 8f20af8..d2dbe60 100644 --- a/Core/Src/ntc.c +++ b/Core/Src/ntc.c @@ -53,6 +53,11 @@ void ntc_set_ext_data(uint16_t const *data, uint8_t len, uint8_t offset) { } void ntc_adc_callback(ADC_HandleTypeDef *hadc) { + static uint8_t is_first = 1; + if(is_first) { + is_first = 0; + memcpy(ntc_int_data, ntc_dma_data, sizeof(ntc_int_data)); + } for(uint8_t i=0; i @@ -277,21 +277,17 @@ bool sc22_evo_canlv_steering_motor_control_debug_rear_right_on_is_in_range(int8_ return ((value >= 0) && (value <= 1)); } -int sc22_evo_canlv_bmslv_temp_pack( +int sc22_evo_canlv_bmslv_temp1_pack( uint8_t *dst_p, - const struct sc22_evo_canlv_bmslv_temp_t *src_p, + const struct sc22_evo_canlv_bmslv_temp1_t *src_p, size_t size) { - uint8_t ntc_is_first_message; - if (size < 8u) { return (-EINVAL); } memset(&dst_p[0], 0, 8); - ntc_is_first_message = (uint8_t)src_p->ntc_is_first_message; - dst_p[0] |= pack_left_shift_u8(ntc_is_first_message, 0u, 0x01u); dst_p[0] |= pack_left_shift_u16(src_p->ntc1_resistance, 1u, 0xfeu); dst_p[1] |= pack_right_shift_u16(src_p->ntc1_resistance, 7u, 0x07u); dst_p[1] |= pack_left_shift_u16(src_p->ntc2_resistance, 3u, 0xf8u); @@ -309,24 +305,15 @@ int sc22_evo_canlv_bmslv_temp_pack( return (8); } -int sc22_evo_canlv_bmslv_temp_unpack( - struct sc22_evo_canlv_bmslv_temp_t *dst_p, +int sc22_evo_canlv_bmslv_temp1_unpack( + struct sc22_evo_canlv_bmslv_temp1_t *dst_p, const uint8_t *src_p, size_t size) { - uint8_t ntc_is_first_message; - if (size < 8u) { return (-EINVAL); } - ntc_is_first_message = unpack_right_shift_u8(src_p[0], 0u, 0x01u); - - if ((ntc_is_first_message & (1u << 0)) != 0u) { - ntc_is_first_message |= 0xfeu; - } - - dst_p->ntc_is_first_message = (int8_t)ntc_is_first_message; dst_p->ntc1_resistance = unpack_right_shift_u16(src_p[0], 1u, 0xfeu); dst_p->ntc1_resistance |= unpack_left_shift_u16(src_p[1], 7u, 0x07u); dst_p->ntc2_resistance = unpack_right_shift_u16(src_p[1], 3u, 0xf8u); @@ -344,107 +331,236 @@ int sc22_evo_canlv_bmslv_temp_unpack( return (0); } -int8_t sc22_evo_canlv_bmslv_temp_ntc_is_first_message_encode(float value) +uint16_t sc22_evo_canlv_bmslv_temp1_ntc1_resistance_encode(float value) { - return (int8_t)(value); + return (uint16_t)((value - 1000.0f) / 31.250000f); } -float sc22_evo_canlv_bmslv_temp_ntc_is_first_message_decode(int8_t value) +float sc22_evo_canlv_bmslv_temp1_ntc1_resistance_decode(uint16_t value) { - return ((float)value); + return (((float)value * 31.250000f) + 1000.0f); } -bool sc22_evo_canlv_bmslv_temp_ntc_is_first_message_is_in_range(int8_t value) +bool sc22_evo_canlv_bmslv_temp1_ntc1_resistance_is_in_range(uint16_t value) { - return ((value >= 0) && (value <= 1)); + return (value <= 991u); +} + +uint16_t sc22_evo_canlv_bmslv_temp1_ntc2_resistance_encode(float value) +{ + return (uint16_t)((value - 1000.0f) / 31.250000f); +} + +float sc22_evo_canlv_bmslv_temp1_ntc2_resistance_decode(uint16_t value) +{ + return (((float)value * 31.250000f) + 1000.0f); +} + +bool sc22_evo_canlv_bmslv_temp1_ntc2_resistance_is_in_range(uint16_t value) +{ + return (value <= 991u); +} + +uint16_t sc22_evo_canlv_bmslv_temp1_ntc3_resistance_encode(float value) +{ + return (uint16_t)((value - 1000.0f) / 31.250000f); +} + +float sc22_evo_canlv_bmslv_temp1_ntc3_resistance_decode(uint16_t value) +{ + return (((float)value * 31.250000f) + 1000.0f); +} + +bool sc22_evo_canlv_bmslv_temp1_ntc3_resistance_is_in_range(uint16_t value) +{ + return (value <= 991u); +} + +uint16_t sc22_evo_canlv_bmslv_temp1_ntc4_resistance_encode(float value) +{ + return (uint16_t)((value - 1000.0f) / 31.250000f); +} + +float sc22_evo_canlv_bmslv_temp1_ntc4_resistance_decode(uint16_t value) +{ + return (((float)value * 31.250000f) + 1000.0f); +} + +bool sc22_evo_canlv_bmslv_temp1_ntc4_resistance_is_in_range(uint16_t value) +{ + return (value <= 991u); +} + +uint16_t sc22_evo_canlv_bmslv_temp1_ntc5_resistance_encode(float value) +{ + return (uint16_t)((value - 1000.0f) / 31.250000f); +} + +float sc22_evo_canlv_bmslv_temp1_ntc5_resistance_decode(uint16_t value) +{ + return (((float)value * 31.250000f) + 1000.0f); +} + +bool sc22_evo_canlv_bmslv_temp1_ntc5_resistance_is_in_range(uint16_t value) +{ + return (value <= 991u); +} + +uint16_t sc22_evo_canlv_bmslv_temp1_ntc6_resistance_encode(float value) +{ + return (uint16_t)((value - 1000.0f) / 31.250000f); +} + +float sc22_evo_canlv_bmslv_temp1_ntc6_resistance_decode(uint16_t value) +{ + return (((float)value * 31.250000f) + 1000.0f); +} + +bool sc22_evo_canlv_bmslv_temp1_ntc6_resistance_is_in_range(uint16_t value) +{ + return (value <= 991u); +} + +int sc22_evo_canlv_bmslv_temp2_pack( + uint8_t *dst_p, + const struct sc22_evo_canlv_bmslv_temp2_t *src_p, + size_t size) +{ + if (size < 8u) { + return (-EINVAL); + } + + memset(&dst_p[0], 0, 8); + + dst_p[0] |= pack_left_shift_u16(src_p->ntc1_resistance, 1u, 0xfeu); + dst_p[1] |= pack_right_shift_u16(src_p->ntc1_resistance, 7u, 0x07u); + dst_p[1] |= pack_left_shift_u16(src_p->ntc2_resistance, 3u, 0xf8u); + dst_p[2] |= pack_right_shift_u16(src_p->ntc2_resistance, 5u, 0x1fu); + dst_p[2] |= pack_left_shift_u16(src_p->ntc3_resistance, 5u, 0xe0u); + dst_p[3] |= pack_right_shift_u16(src_p->ntc3_resistance, 3u, 0x7fu); + dst_p[3] |= pack_left_shift_u16(src_p->ntc4_resistance, 7u, 0x80u); + dst_p[4] |= pack_right_shift_u16(src_p->ntc4_resistance, 1u, 0xffu); + dst_p[5] |= pack_right_shift_u16(src_p->ntc4_resistance, 9u, 0x01u); + dst_p[5] |= pack_left_shift_u16(src_p->ntc5_resistance, 1u, 0xfeu); + dst_p[6] |= pack_right_shift_u16(src_p->ntc5_resistance, 7u, 0x07u); + dst_p[6] |= pack_left_shift_u16(src_p->ntc6_resistance, 6u, 0xc0u); + dst_p[7] |= pack_right_shift_u16(src_p->ntc6_resistance, 2u, 0xffu); + + return (8); +} + +int sc22_evo_canlv_bmslv_temp2_unpack( + struct sc22_evo_canlv_bmslv_temp2_t *dst_p, + const uint8_t *src_p, + size_t size) +{ + if (size < 8u) { + return (-EINVAL); + } + + dst_p->ntc1_resistance = unpack_right_shift_u16(src_p[0], 1u, 0xfeu); + dst_p->ntc1_resistance |= unpack_left_shift_u16(src_p[1], 7u, 0x07u); + dst_p->ntc2_resistance = unpack_right_shift_u16(src_p[1], 3u, 0xf8u); + dst_p->ntc2_resistance |= unpack_left_shift_u16(src_p[2], 5u, 0x1fu); + dst_p->ntc3_resistance = unpack_right_shift_u16(src_p[2], 5u, 0xe0u); + dst_p->ntc3_resistance |= unpack_left_shift_u16(src_p[3], 3u, 0x7fu); + dst_p->ntc4_resistance = unpack_right_shift_u16(src_p[3], 7u, 0x80u); + dst_p->ntc4_resistance |= unpack_left_shift_u16(src_p[4], 1u, 0xffu); + dst_p->ntc4_resistance |= unpack_left_shift_u16(src_p[5], 9u, 0x01u); + dst_p->ntc5_resistance = unpack_right_shift_u16(src_p[5], 1u, 0xfeu); + dst_p->ntc5_resistance |= unpack_left_shift_u16(src_p[6], 7u, 0x07u); + dst_p->ntc6_resistance = unpack_right_shift_u16(src_p[6], 6u, 0xc0u); + dst_p->ntc6_resistance |= unpack_left_shift_u16(src_p[7], 2u, 0xffu); + + return (0); } -uint16_t sc22_evo_canlv_bmslv_temp_ntc1_resistance_encode(float value) +uint16_t sc22_evo_canlv_bmslv_temp2_ntc1_resistance_encode(float value) { return (uint16_t)((value - 1000.0f) / 31.250000f); } -float sc22_evo_canlv_bmslv_temp_ntc1_resistance_decode(uint16_t value) +float sc22_evo_canlv_bmslv_temp2_ntc1_resistance_decode(uint16_t value) { return (((float)value * 31.250000f) + 1000.0f); } -bool sc22_evo_canlv_bmslv_temp_ntc1_resistance_is_in_range(uint16_t value) +bool sc22_evo_canlv_bmslv_temp2_ntc1_resistance_is_in_range(uint16_t value) { return (value <= 991u); } -uint16_t sc22_evo_canlv_bmslv_temp_ntc2_resistance_encode(float value) +uint16_t sc22_evo_canlv_bmslv_temp2_ntc2_resistance_encode(float value) { return (uint16_t)((value - 1000.0f) / 31.250000f); } -float sc22_evo_canlv_bmslv_temp_ntc2_resistance_decode(uint16_t value) +float sc22_evo_canlv_bmslv_temp2_ntc2_resistance_decode(uint16_t value) { return (((float)value * 31.250000f) + 1000.0f); } -bool sc22_evo_canlv_bmslv_temp_ntc2_resistance_is_in_range(uint16_t value) +bool sc22_evo_canlv_bmslv_temp2_ntc2_resistance_is_in_range(uint16_t value) { return (value <= 991u); } -uint16_t sc22_evo_canlv_bmslv_temp_ntc3_resistance_encode(float value) +uint16_t sc22_evo_canlv_bmslv_temp2_ntc3_resistance_encode(float value) { return (uint16_t)((value - 1000.0f) / 31.250000f); } -float sc22_evo_canlv_bmslv_temp_ntc3_resistance_decode(uint16_t value) +float sc22_evo_canlv_bmslv_temp2_ntc3_resistance_decode(uint16_t value) { return (((float)value * 31.250000f) + 1000.0f); } -bool sc22_evo_canlv_bmslv_temp_ntc3_resistance_is_in_range(uint16_t value) +bool sc22_evo_canlv_bmslv_temp2_ntc3_resistance_is_in_range(uint16_t value) { return (value <= 991u); } -uint16_t sc22_evo_canlv_bmslv_temp_ntc4_resistance_encode(float value) +uint16_t sc22_evo_canlv_bmslv_temp2_ntc4_resistance_encode(float value) { return (uint16_t)((value - 1000.0f) / 31.250000f); } -float sc22_evo_canlv_bmslv_temp_ntc4_resistance_decode(uint16_t value) +float sc22_evo_canlv_bmslv_temp2_ntc4_resistance_decode(uint16_t value) { return (((float)value * 31.250000f) + 1000.0f); } -bool sc22_evo_canlv_bmslv_temp_ntc4_resistance_is_in_range(uint16_t value) +bool sc22_evo_canlv_bmslv_temp2_ntc4_resistance_is_in_range(uint16_t value) { return (value <= 991u); } -uint16_t sc22_evo_canlv_bmslv_temp_ntc5_resistance_encode(float value) +uint16_t sc22_evo_canlv_bmslv_temp2_ntc5_resistance_encode(float value) { return (uint16_t)((value - 1000.0f) / 31.250000f); } -float sc22_evo_canlv_bmslv_temp_ntc5_resistance_decode(uint16_t value) +float sc22_evo_canlv_bmslv_temp2_ntc5_resistance_decode(uint16_t value) { return (((float)value * 31.250000f) + 1000.0f); } -bool sc22_evo_canlv_bmslv_temp_ntc5_resistance_is_in_range(uint16_t value) +bool sc22_evo_canlv_bmslv_temp2_ntc5_resistance_is_in_range(uint16_t value) { return (value <= 991u); } -uint16_t sc22_evo_canlv_bmslv_temp_ntc6_resistance_encode(float value) +uint16_t sc22_evo_canlv_bmslv_temp2_ntc6_resistance_encode(float value) { return (uint16_t)((value - 1000.0f) / 31.250000f); } -float sc22_evo_canlv_bmslv_temp_ntc6_resistance_decode(uint16_t value) +float sc22_evo_canlv_bmslv_temp2_ntc6_resistance_decode(uint16_t value) { return (((float)value * 31.250000f) + 1000.0f); } -bool sc22_evo_canlv_bmslv_temp_ntc6_resistance_is_in_range(uint16_t value) +bool sc22_evo_canlv_bmslv_temp2_ntc6_resistance_is_in_range(uint16_t value) { return (value <= 991u); } diff --git a/openblt_f446re/STM32-for-VSCode.config.yaml b/openblt_f446re/STM32-for-VSCode.config.yaml index 8269a7b..5e8a5d0 100644 --- a/openblt_f446re/STM32-for-VSCode.config.yaml +++ b/openblt_f446re/STM32-for-VSCode.config.yaml @@ -6,7 +6,7 @@ # - entry_2 # The project name -target: openblt_mainboard +target: openblt_f446re # Can be C or C++ language: C diff --git a/openblt_f446re/STM32Make.make b/openblt_f446re/STM32Make.make index 89b49ce..89dd6e3 100644 --- a/openblt_f446re/STM32Make.make +++ b/openblt_f446re/STM32Make.make @@ -13,7 +13,7 @@ ###################################### # target ###################################### -TARGET = openblt_mainboard +TARGET = openblt_f446re ######################################