Basic SoC estimation

This commit is contained in:
2023-06-25 15:21:48 +02:00
parent 2eb7109416
commit 5dba504e10
3 changed files with 90 additions and 5 deletions

View File

@ -8,6 +8,7 @@
#include "can-halal.h"
#include <math.h>
#include <stdint.h>
void can_init(CAN_HandleTypeDef *handle) {
@ -22,7 +23,7 @@ void can_init(CAN_HandleTypeDef *handle) {
HAL_StatusTypeDef can_send_status() {
uint8_t data[6];
data[0] = ts_state.current_state | (sdc_closed << 7);
data[1] = current_soc;
data[1] = roundf(current_soc);
ftcan_marshal_unsigned(&data[2], min_voltage, 2);
ftcan_marshal_signed(&data[4], max_temp, 2);
return ftcan_transmit(CAN_ID_AMS_STATUS, data, sizeof(data));