From 46ed8492f81bb0a4570a8e5ae8a97bbd355ec32c Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Feb 2024 21:54:58 +0200 Subject: [PATCH 1/2] Add cellvoltages, fix temperature scaling --- Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp b/Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp index 24901cb02..55928fc5d 100644 --- a/Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp +++ b/Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp @@ -33,8 +33,8 @@ static double voltage2 = 0; static double BMU_Current = 0; static double BMU_PackVoltage = 0; static double BMU_Power = 0; -static double cell_voltages[89]; //array with all the cellvoltages //TODO: what is max array size? 80/88 cells? -static double cell_temperatures[89]; //array with all the celltemperatures //TODO: what is max array size? 80/88cells? +static double cell_voltages[88]; //array with all the cellvoltages +static double cell_temperatures[88]; //array with all the celltemperatures static double max_volt_cel = 3.70; static double min_volt_cel = 3.70; static double max_temp_cel = 20.00; @@ -96,13 +96,18 @@ void update_values_battery() { //This function maps all the values fetched via } } + //Map all cell voltages to the global array + for (int i = 0; i < 88; ++i) { + system_cellvoltages_mV[i] = (uint16_t)(cell_voltages[i] * 1000); + } + system_cell_max_voltage_mV = (uint16_t)(max_volt_cel * 1000); system_cell_min_voltage_mV = (uint16_t)(min_volt_cel * 1000); - system_temperature_min_dC = (int16_t)(min_temp_cel * 1000); + system_temperature_min_dC = (int16_t)(min_temp_cel * 10); - system_temperature_min_dC = (int16_t)(max_temp_cel * 1000); + system_temperature_min_dC = (int16_t)(max_temp_cel * 10); /* Check if the BMS is still sending CAN messages. If we go 60s without messages we raise an error*/ if (!CANstillAlive) { From e2acfc25ee2bf53c07a13af901a67d589f7d4bda Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 21 Mar 2024 21:25:29 +0200 Subject: [PATCH 2/2] pre-commit fix --- Software/Software.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Software/Software.ino b/Software/Software.ino index 5b97aaef8..9d5efe0e7 100644 --- a/Software/Software.ino +++ b/Software/Software.ino @@ -22,7 +22,7 @@ #include "src/devboard/webserver/webserver.h" #endif -Preferences settings; // Store user settings +Preferences settings; // Store user settings const char* version_number = "5.4.dev"; // The current software version, shown on webserver // Interval settings int intervalUpdateValues = 4800; // Interval at which to update inverter values / Modbus registers