LV battery voltage
This commit is contained in:
parent
638394ac0a
commit
6d70d12148
|
@ -137,6 +137,8 @@ typedef struct {
|
||||||
float min_cell_volt;
|
float min_cell_volt;
|
||||||
float max_cell_temp;
|
float max_cell_temp;
|
||||||
int soc_ts;
|
int soc_ts;
|
||||||
|
|
||||||
|
float lv_bat_voltage;
|
||||||
int soc_lv;
|
int soc_lv;
|
||||||
|
|
||||||
float ts_current;
|
float ts_current;
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#define CAN_ABX_DRIVER_SPEED_FACTOR (0.2 * 3.6)
|
#define CAN_ABX_DRIVER_SPEED_FACTOR (0.2 * 3.6)
|
||||||
#define CAN_CS_INTERNAL_TEMP_FACTOR 0.01
|
#define CAN_CS_INTERNAL_TEMP_FACTOR 0.01
|
||||||
#define CAN_ABX_MISC_DISTANCE_TOTAL_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) {
|
void vehicle_thread_entry(ULONG hfdcan_addr) {
|
||||||
memset(&vehicle_state, 0, sizeof(vehicle_state));
|
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 =
|
vehicle_state.distance_total =
|
||||||
(data[3] | (data[4] << 8)) * CAN_ABX_MISC_DISTANCE_TOTAL_FACTOR;
|
(data[3] | (data[4] << 8)) * CAN_ABX_MISC_DISTANCE_TOTAL_FACTOR;
|
||||||
vehicle_state.soc_lv = data[5];
|
vehicle_state.soc_lv = data[5];
|
||||||
|
vehicle_state.lv_bat_voltage = data[6] * CAN_ABX_MISC_LV_BAT_VOLTAGE_FACTOR;
|
||||||
break;
|
break;
|
||||||
case CAN_ID_AS_MISSION_FB:
|
case CAN_ID_AS_MISSION_FB:
|
||||||
vehicle_state.active_mission = data[0] & 0b111;
|
vehicle_state.active_mission = data[0] & 0b111;
|
||||||
|
|
|
@ -17,7 +17,7 @@ CountedEnum(DataFieldType, size_t, DF_TSState, DF_ASState, DF_ActiveMission,
|
||||||
DF_Speed, DF_BBal, DF_BPF, DF_BPR, DF_DistanceTotal, DF_TempMotL,
|
DF_Speed, DF_BBal, DF_BPF, DF_BPR, DF_DistanceTotal, DF_TempMotL,
|
||||||
DF_TempMotR, DF_TempInvL, DF_TempInvR, DF_TempBrakeFL,
|
DF_TempMotR, DF_TempInvL, DF_TempInvR, DF_TempBrakeFL,
|
||||||
DF_TempBrakeFR, DF_TempBrakeRL, DF_TempBrakeRR, DF_LapBest,
|
DF_TempBrakeFR, DF_TempBrakeRL, DF_TempBrakeRR, DF_LapBest,
|
||||||
DF_LapLast);
|
DF_LapLast, DF_LVBatVoltage);
|
||||||
|
|
||||||
enum class NamedFieldKind { Float, Bool, Text, Int };
|
enum class NamedFieldKind { Float, Bool, Text, Int };
|
||||||
|
|
||||||
|
|
|
@ -298,6 +298,8 @@ NamedFieldDescription dataFieldDescs[] = {
|
||||||
VEH_FIELD(lap_best)},
|
VEH_FIELD(lap_best)},
|
||||||
[DF_LapLast] = {NamedFieldKind::Float, "LAPLAST", 3, 1,
|
[DF_LapLast] = {NamedFieldKind::Float, "LAPLAST", 3, 1,
|
||||||
VEH_FIELD(lap_last)},
|
VEH_FIELD(lap_last)},
|
||||||
|
[DF_LVBatVoltage] = {NamedFieldKind::Float, "LVVBAT", 2, 2,
|
||||||
|
VEH_FIELD(lv_bat_voltage)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(dataFieldDescs) / sizeof(dataFieldDescs[0]) ==
|
static_assert(sizeof(dataFieldDescs) / sizeof(dataFieldDescs[0]) ==
|
||||||
|
|
Loading…
Reference in New Issue