Read IMD M pin
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "can.h"
|
||||
|
||||
#include "imd_monitoring.h"
|
||||
#include "main.h"
|
||||
#include "shunt_monitoring.h"
|
||||
#include "slave_monitoring.h"
|
||||
@ -21,11 +22,17 @@ void can_init(CAN_HandleTypeDef *handle) {
|
||||
}
|
||||
|
||||
HAL_StatusTypeDef can_send_status() {
|
||||
uint8_t data[6];
|
||||
uint8_t data[8];
|
||||
data[0] = ts_state.current_state | (sdc_closed << 7);
|
||||
data[1] = roundf(current_soc);
|
||||
ftcan_marshal_unsigned(&data[2], min_voltage, 2);
|
||||
ftcan_marshal_signed(&data[4], max_temp, 2);
|
||||
data[6] = imd_data.state | (imd_data.ok << 7);
|
||||
if (imd_data.r_iso < 0xFFF) {
|
||||
data[7] = imd_data.r_iso >> 4;
|
||||
} else {
|
||||
data[7] = 0xFF;
|
||||
}
|
||||
return ftcan_transmit(CAN_ID_AMS_STATUS, data, sizeof(data));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user