Fix SOC% value

This commit is contained in:
Daniel Öster 2024-09-01 17:42:21 +03:00
parent 5a0f9ee8e6
commit 79ae74122a
2 changed files with 12 additions and 12 deletions

View file

@ -17,7 +17,7 @@
//#define KIA_E_GMP_BATTERY
//#define KIA_HYUNDAI_HYBRID_BATTERY
//#define MG_5_BATTERY
#define NISSAN_LEAF_BATTERY
//#define NISSAN_LEAF_BATTERY
//#define PYLON_BATTERY
//#define RENAULT_KANGOO_BATTERY
//#define RENAULT_ZOE_GEN1_BATTERY
@ -32,7 +32,7 @@
//#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus
//#define BYD_SMA //Enable this line to emulate a SMA compatible "BYD Battery-Box HVS 10.2KW battery" over CAN bus
//#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU
#define BYD_KOSTAL_RS485 //Enable this line to emulate a "BYD 11kWh HVM battery" over Kostal RS485
//#define BYD_KOSTAL_RS485 //Enable this line to emulate a "BYD 11kWh HVM battery" over Kostal RS485
//#define PYLON_CAN //Enable this line to emulate a "Pylontech battery" over CAN bus
//#define SMA_CAN //Enable this line to emulate a "BYD Battery-Box H 8.9kWh, 7 mod" over CAN bus
//#define SMA_TRIPOWER_CAN //Enable this line to emulate a "SMA Home Storage battery" over CAN bus

View file

@ -213,26 +213,26 @@ void update_RS485_registers_inverter() {
.max_discharge_amp_dA; //Cap the value to the max allowed Amp. Some inverters cannot handle large values.
}
float2frame(frame2, (float)datalayer.battery.status.voltage_dV / 10, 6);
float2frame(frame2, (float)(datalayer.battery.status.voltage_dV / 10), 6);
float2frameMSB(frame2, (float)datalayer.battery.info.max_design_voltage_dV / 10, 12);
float2frameMSB(frame2, (float)(datalayer.battery.info.max_design_voltage_dV / 10), 12);
float2frameMSB(
frame2, (float)(datalayer.battery.status.temperature_max_dC + datalayer.battery.status.temperature_min_dC) / 20,
frame2, (float)((datalayer.battery.status.temperature_max_dC + datalayer.battery.status.temperature_min_dC) / 20),
16);
float2frameMSB(frame2, (float)datalayer.battery.status.current_dA, 20);
float2frameMSB(frame2, (float)datalayer.battery.status.current_dA, 24);
float2frameMSB(frame2, (float)discharge_current / 10, 28);
float2frameMSB(frame2, (float)discharge_current / 10, 32);
float2frameMSB(frame2, (float)(discharge_current / 10), 28);
float2frameMSB(frame2, (float)(discharge_current / 10), 32);
float2frameMSB(frame2, (float)datalayer.battery.status.temperature_max_dC / 10, 40);
float2frameMSB(frame2, (float)datalayer.battery.status.temperature_min_dC / 10, 44);
float2frameMSB(frame2, (float)(datalayer.battery.status.temperature_max_dC / 10), 40);
float2frameMSB(frame2, (float)(datalayer.battery.status.temperature_min_dC / 10), 44);
float2frame(frame2, (float)datalayer.battery.status.cell_max_voltage_mV / 1000, 46);
float2frame(frame2, (float)datalayer.battery.status.cell_min_voltage_mV / 1000, 50);
float2frame(frame2, (float)(datalayer.battery.status.cell_max_voltage_mV / 1000), 46);
float2frame(frame2, (float)(datalayer.battery.status.cell_min_voltage_mV / 1000), 50);
frame2[58] = (byte)datalayer.battery.status.reported_soc / 100;
frame2[58] = (byte)(datalayer.battery.status.reported_soc / 100);
register_content_ok = true;
}