Add status bit writing to 4250

This commit is contained in:
Daniel Öster 2025-01-16 23:22:34 +02:00
parent cb3713c91e
commit 2a6dca1d31

View file

@ -196,12 +196,16 @@ void update_values_can_inverter() { //This function maps all the values fetched
// Status=Bit 0,1,2= 0:Sleep, 1:Charge, 2:Discharge 3:Idle. Bit3 ForceChargeReq. Bit4 Balance charge Request
if (datalayer.battery.status.bms_status == FAULT) {
PYLON_4250.data.u8[0] = (0x00); // Sleep
PYLON_4251.data.u8[0] = (0x00); // Sleep
} else if (datalayer.battery.status.current_dA < 0) {
PYLON_4250.data.u8[0] = (0x01); // Charge
PYLON_4251.data.u8[0] = (0x01); // Charge
} else if (datalayer.battery.status.current_dA > 0) {
PYLON_4250.data.u8[0] = (0x02); // Discharge
PYLON_4251.data.u8[0] = (0x02); // Discharge
} else if (datalayer.battery.status.current_dA == 0) {
PYLON_4250.data.u8[0] = (0x03); // Idle
PYLON_4251.data.u8[0] = (0x03); // Idle
}