Show battery temperature

This commit is contained in:
2023-05-22 08:46:04 +02:00
parent 6e0fd1a3cf
commit 216ad67840
15 changed files with 298 additions and 154 deletions

View File

@ -87,6 +87,8 @@ typedef struct {
float inv_r;
float mot_l;
float mot_r;
float bat_l;
float bat_r;
} Temperatures;
typedef struct {

View File

@ -92,6 +92,9 @@ void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {
ftcan_unmarshal_unsigned(&ptr, 2) * CAN_AMS_STATUS_VOLTAGE_FACTOR;
vehicle_state.max_cell_temp =
ftcan_unmarshal_signed(&ptr, 2) * CAN_AMS_STATUS_TEMP_FACTOR;
// TODO: Separate temperatures for left and right side of battery
vehicle_state.temps.bat_l = vehicle_state.max_cell_temp;
vehicle_state.temps.bat_r = vehicle_state.max_cell_temp;
break;
case CAN_ID_AMS_ERROR:
vehicle_state.last_ams_error.kind = data[0];