LV battery voltage

This commit is contained in:
2023-07-27 19:04:44 +02:00
parent 638394ac0a
commit 6d70d12148
4 changed files with 7 additions and 1 deletions

View File

@ -137,6 +137,8 @@ typedef struct {
float min_cell_volt;
float max_cell_temp;
int soc_ts;
float lv_bat_voltage;
int soc_lv;
float ts_current;

View File

@ -33,6 +33,7 @@
#define CAN_ABX_DRIVER_SPEED_FACTOR (0.2 * 3.6)
#define CAN_CS_INTERNAL_TEMP_FACTOR 0.01
#define CAN_ABX_MISC_DISTANCE_TOTAL_FACTOR 0.01
#define CAN_ABX_MISC_LV_BAT_VOLTAGE_FACTOR (15.0f / 255)
void vehicle_thread_entry(ULONG hfdcan_addr) {
memset(&vehicle_state, 0, sizeof(vehicle_state));
@ -130,6 +131,7 @@ void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {
vehicle_state.distance_total =
(data[3] | (data[4] << 8)) * CAN_ABX_MISC_DISTANCE_TOTAL_FACTOR;
vehicle_state.soc_lv = data[5];
vehicle_state.lv_bat_voltage = data[6] * CAN_ABX_MISC_LV_BAT_VOLTAGE_FACTOR;
break;
case CAN_ID_AS_MISSION_FB:
vehicle_state.active_mission = data[0] & 0b111;