From a891257019088f47d640bd170d729cd5ef91c7cf Mon Sep 17 00:00:00 2001 From: Ole Date: Sat, 6 Apr 2024 08:37:53 +0200 Subject: [PATCH 1/5] Add cell min/max voltage + max charge/discharge + simple SOH + use real SOC for better resolution --- Software/src/battery/BMW-I3-BATTERY.cpp | 63 +++++++++++++++++++++---- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/Software/src/battery/BMW-I3-BATTERY.cpp b/Software/src/battery/BMW-I3-BATTERY.cpp index f9c185f7..81025ba3 100644 --- a/Software/src/battery/BMW-I3-BATTERY.cpp +++ b/Software/src/battery/BMW-I3-BATTERY.cpp @@ -266,6 +266,20 @@ CAN_frame_t BMW_5F8 = {.FIR = {.B = .MsgID = 0x5F8, .data = {0x64, 0x01, 0x00, 0x0B, 0x92, 0x03, 0x00, 0x05}}; +CAN_frame_t BMW_6F1_CELL = { .FIR = { .B = { + .DLC = 5, + .FF = CAN_frame_std, + } }, + .MsgID = 0x6F1, + .data = { 0x07, 0x03, 0x22, 0xDD, 0xBF } }; + +CAN_frame_t BMW_6F1_CONTINUE = { .FIR = { .B = { + .DLC = 4, + .FF = CAN_frame_std, + } }, + .MsgID = 0x6F1, + .data = { 0x07, 0x30, 0x00, 0x02 } }; + //The above CAN messages need to be sent towards the battery to keep it alive static uint8_t startup_counter_contactor = 0; @@ -345,6 +359,9 @@ static uint8_t battery_status_diagnosis_powertrain_immediate_multiplexer = 0; static uint8_t battery_ID2 = 0; static uint8_t battery_cellvoltage_mux = 0; +static uint8_t message_data[50]; +static uint8_t next_data = 0; + static uint8_t calculateCRC(CAN_frame_t rx_frame, uint8_t length, uint8_t initial_value) { uint8_t crc = initial_value; for (uint8_t j = 1; j < length; j++) { //start at 1, since 0 is the CRC @@ -363,7 +380,7 @@ static uint8_t increment_alive_counter(uint8_t counter) { void update_values_battery() { //This function maps all the values fetched via CAN to the correct parameters used for modbus - system_real_SOC_pptt = (battery_display_SOC * 100); //increase Display_SOC range from 0-100 -> 100.00 + system_real_SOC_pptt = (battery_HVBatt_SOC * 10); //increase Display_SOC range from 0-100 -> 100.00 system_battery_voltage_dV = battery_volts; //Unit V+1 (5000 = 500.0V) @@ -373,16 +390,17 @@ void update_values_battery() { //This function maps all the values fetched via system_remaining_capacity_Wh = (battery_energy_content_maximum_kWh * 1000); // Convert kWh to Wh - if ((battery_max_charge_amperage * system_battery_voltage_dV) > 65000) { - system_max_charge_power_W = 65000; - } else { - system_max_charge_power_W = (battery_max_charge_amperage * system_battery_voltage_dV); - } + system_SOH_pptt = battery_energy_content_maximum_kWh * 10000 / 27.2; - if ((battery_max_discharge_amperage * system_battery_voltage_dV) > 65000) { + if (battery_BEV_available_power_longterm_discharge > 65000) { system_max_discharge_power_W = 65000; } else { - system_max_discharge_power_W = (battery_max_discharge_amperage * system_battery_voltage_dV); + system_max_discharge_power_W = battery_BEV_available_power_longterm_discharge; + } + if (battery_BEV_available_power_longterm_charge > 65000) { + system_max_charge_power_W = 65000; + } else { + system_max_charge_power_W = battery_BEV_available_power_longterm_charge; } battery_power = (system_battery_current_dA * (system_battery_voltage_dV / 100)); @@ -393,6 +411,9 @@ void update_values_battery() { //This function maps all the values fetched via system_temperature_max_dC = battery_temperature_max * 10; // Add a decimal + system_cell_min_voltage_mV = system_cellvoltages_mV[0]; + system_cell_max_voltage_mV = system_cellvoltages_mV[1]; + /* Check if the BMS is still sending CAN messages. If we go 60s without messages we raise an error*/ if (!CANstillAlive) { set_event(EVENT_CAN_RX_FAILURE, 0); @@ -549,7 +570,28 @@ void receive_can_battery(CAN_frame_t rx_frame) { case 0x587: //BMS [5s] Services battery_ID2 = rx_frame.data.u8[0]; break; - case 0x607: //BMS - No use for this message + case 0x607: //BMS - messages requested on 0x615 + if (rx_frame.FIR.B.DLC > 6 + && next_data == 0 + && rx_frame.data.u8[0] == 0xf1) { + uint8_t count = 6; + while (count < rx_frame.FIR.B.DLC && next_data < 49) { + message_data[next_data++] = rx_frame.data.u8[count++]; + } + ESP32Can.CANWriteFrame(&BMW_6F1_CONTINUE); // tell battery to send additional messages + + } else if (rx_frame.FIR.B.DLC > 3 + && next_data > 0 + && rx_frame.data.u8[0] == 0xf1 + && ((rx_frame.data.u8[1] & 0xF0) == 0x20)) { + uint8_t count = 2; + while (count < rx_frame.FIR.B.DLC && next_data < 49) { + message_data[next_data++] = rx_frame.data.u8[count++]; + } + + system_cellvoltages_mV[0] = (message_data[0] << 8 | message_data[1]); + system_cellvoltages_mV[1] = (message_data[2] << 8 | message_data[3]); + } break; default: break; @@ -699,6 +741,9 @@ void send_can_battery() { ESP32Can.CANWriteFrame(&BMW_3E4); ESP32Can.CANWriteFrame(&BMW_37B); + next_data = 0; + ESP32Can.CANWriteFrame(&BMW_6F1_CELL); + BMW_3E5.data.u8[0] = 0xFD; // First 3E5 message byte0 we send is unique, once we sent initial value send this } } From db57a23dea0c465cf917db3eee0a01d0b9578c5b Mon Sep 17 00:00:00 2001 From: Ole Date: Tue, 9 Apr 2024 21:46:59 +0200 Subject: [PATCH 2/5] Added additional data from battery --- Software/src/battery/BMW-I3-BATTERY.cpp | 67 +++++++++++++++++-- Software/src/devboard/webserver/webserver.cpp | 7 ++ Software/src/devboard/webserver/webserver.h | 7 ++ 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/Software/src/battery/BMW-I3-BATTERY.cpp b/Software/src/battery/BMW-I3-BATTERY.cpp index 81025ba3..d255ad06 100644 --- a/Software/src/battery/BMW-I3-BATTERY.cpp +++ b/Software/src/battery/BMW-I3-BATTERY.cpp @@ -16,6 +16,7 @@ static unsigned long previousMillis5000 = 0; // will store last time a 5000ms static unsigned long previousMillis10000 = 0; // will store last time a 10000ms CAN Message was send static uint8_t CANstillAlive = 12; // counter for checking if CAN is still alive static uint16_t CANerror = 0; // counter on how many CAN errors encountered +#define MAX_CAN_FAILURES 500 // Amount of malformed CAN messages to allow before raising a warning #define ALIVE_MAX_VALUE 14 // BMW CAN messages contain alive counter, goes from 0...14 static const uint16_t WUPonDuration = 477; // in milliseconds how long WUP should be ON after poweron @@ -25,6 +26,9 @@ unsigned long turnOnTime; // Variables to store timestamps enum State { POWERON, STATE_ON, STATE_OFF }; static State WUPState = POWERON; +enum CmdState { SOH, CELL_VOLTAGE, SOC, CELL_VOLTAGE_AVG }; +static CmdState cmdState = SOH; + const unsigned char crc8_table[256] = { // CRC8_SAE_J1850_ZER0 formula,0x1D Poly,initial value 0x3F,Final XOR value varies 0x00, 0x1D, 0x3A, 0x27, 0x74, 0x69, 0x4E, 0x53, 0xE8, 0xF5, 0xD2, 0xCF, 0x9C, 0x81, 0xA6, 0xBB, 0xCD, 0xD0, @@ -273,6 +277,28 @@ CAN_frame_t BMW_6F1_CELL = { .FIR = { .B = { .MsgID = 0x6F1, .data = { 0x07, 0x03, 0x22, 0xDD, 0xBF } }; +CAN_frame_t BMW_6F1_SOH = { .FIR = { .B = { + .DLC = 5, + .FF = CAN_frame_std, + } }, + .MsgID = 0x6F1, + .data = { 0x07, 0x03, 0x22, 0x63, 0x35 } }; + + +CAN_frame_t BMW_6F1_SOC = { .FIR = { .B = { + .DLC = 5, + .FF = CAN_frame_std, + } }, + .MsgID = 0x6F1, + .data = { 0x07, 0x03, 0x22, 0xDD, 0xBC } }; + +CAN_frame_t BMW_6F1_CELL_VOLTAGE_AVG = { .FIR = { .B = { + .DLC = 5, + .FF = CAN_frame_std, + } }, + .MsgID = 0x6F1, + .data = { 0x07, 0x03, 0x22, 0xDF, 0xA0 } }; + CAN_frame_t BMW_6F1_CONTINUE = { .FIR = { .B = { .DLC = 4, .FF = CAN_frame_std, @@ -320,6 +346,12 @@ static uint16_t battery_prediction_voltage_longterm_charge = 0; static uint16_t battery_prediction_voltage_longterm_discharge = 0; static uint16_t battery_prediction_duration_charging_minutes = 0; static uint16_t battery_target_voltage_in_CV_mode = 0; + +uint16_t battery_soc = 0; +uint16_t battery_soc_hvmax = 0; +uint16_t battery_soc_hvmin = 0; +uint16_t battery_capacity_cah = 0; + static int16_t battery_temperature_HV = 0; static int16_t battery_temperature_heat_exchanger = 0; static int16_t battery_temperature_max = 0; @@ -358,6 +390,7 @@ static uint8_t battery_status_diagnosis_powertrain_maximum_multiplexer = 0; static uint8_t battery_status_diagnosis_powertrain_immediate_multiplexer = 0; static uint8_t battery_ID2 = 0; static uint8_t battery_cellvoltage_mux = 0; +static uint8_t battery_soh = 0; static uint8_t message_data[50]; static uint8_t next_data = 0; @@ -380,7 +413,7 @@ static uint8_t increment_alive_counter(uint8_t counter) { void update_values_battery() { //This function maps all the values fetched via CAN to the correct parameters used for modbus - system_real_SOC_pptt = (battery_HVBatt_SOC * 10); //increase Display_SOC range from 0-100 -> 100.00 + system_real_SOC_pptt = (battery_HVBatt_SOC * 10); system_battery_voltage_dV = battery_volts; //Unit V+1 (5000 = 500.0V) @@ -390,7 +423,7 @@ void update_values_battery() { //This function maps all the values fetched via system_remaining_capacity_Wh = (battery_energy_content_maximum_kWh * 1000); // Convert kWh to Wh - system_SOH_pptt = battery_energy_content_maximum_kWh * 10000 / 27.2; + system_SOH_pptt = battery_soh * 100; if (battery_BEV_available_power_longterm_discharge > 65000) { system_max_discharge_power_W = 65000; @@ -570,7 +603,7 @@ void receive_can_battery(CAN_frame_t rx_frame) { case 0x587: //BMS [5s] Services battery_ID2 = rx_frame.data.u8[0]; break; - case 0x607: //BMS - messages requested on 0x615 + case 0x607: //BMS - responses to message requests on 0x615 if (rx_frame.FIR.B.DLC > 6 && next_data == 0 && rx_frame.data.u8[0] == 0xf1) { @@ -589,8 +622,32 @@ void receive_can_battery(CAN_frame_t rx_frame) { message_data[next_data++] = rx_frame.data.u8[count++]; } - system_cellvoltages_mV[0] = (message_data[0] << 8 | message_data[1]); - system_cellvoltages_mV[1] = (message_data[2] << 8 | message_data[3]); + switch (cmdState) { + case CELL_VOLTAGE: + if (next_data>=4) { + system_cellvoltages_mV[0] = (message_data[0] << 8 | message_data[1]); + system_cellvoltages_mV[2] = (message_data[2] << 8 | message_data[3]); + } + break; + case CELL_VOLTAGE_AVG: + if (next_data>=30) { + system_cellvoltages_mV[1] = (message_data[10] << 8 | message_data[11]) / 10; + battery_capacity_cah = (message_data[4] << 8 | message_data[5]); + } + break; + case SOH: + if (next_data>=4) { + battery_soh = message_data[3]; + } + break; + case SOC: + if (next_data>=6) { + battery_soc = (message_data[0] << 8 | message_data[1]); + battery_soc_hvmax = (message_data[2] << 8 | message_data[3]); + battery_soc_hvmin = (message_data[4] << 8 | message_data[5]); + } + break; + } } break; default: diff --git a/Software/src/devboard/webserver/webserver.cpp b/Software/src/devboard/webserver/webserver.cpp index c2edeea4..634e9a98 100644 --- a/Software/src/devboard/webserver/webserver.cpp +++ b/Software/src/devboard/webserver/webserver.cpp @@ -526,6 +526,13 @@ String processor(const String& var) { } else { // > 0 content += "

Battery charging!

"; } +#ifdef BMW_I3_BATTERY + content += "

Battery Capacity cAh: " + String(battery_capacity_cah / 100.0, 2) + " Ah

"; + content += "

Battery SOC: " + String(battery_soc / 10.0, 1) + "%%

"; + content += "

Battery SOC hvMax: " + String(battery_soc_hvmax / 10.0, 1) + "%%

"; + content += "

Battery SOC hvMin: " + String(battery_soc_hvmin / 10.0, 1) + "%%

"; +#endif + content += "

Automatic contactor closing allowed:

"; content += "

Battery: "; if (batteryAllowsContactorClosing) { diff --git a/Software/src/devboard/webserver/webserver.h b/Software/src/devboard/webserver/webserver.h index ad748147..c6fe16de 100644 --- a/Software/src/devboard/webserver/webserver.h +++ b/Software/src/devboard/webserver/webserver.h @@ -40,6 +40,13 @@ extern uint8_t LEDcolor; //Enum, 0-10 extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false +#ifdef BMW_I3_BATTERY +extern uint16_t battery_soc; +extern uint16_t battery_soc_hvmax; +extern uint16_t battery_soc_hvmin; +extern uint16_t battery_capacity_cah; +#endif + extern const char* ssid; extern const char* password; extern const uint8_t wifi_channel; From ed1d17cc9bdf8d276cbf81bc6136d496ab41ec47 Mon Sep 17 00:00:00 2001 From: Ole Date: Tue, 9 Apr 2024 22:02:29 +0200 Subject: [PATCH 3/5] Formatting --- Software/src/battery/BMW-I3-BATTERY.cpp | 89 ++++++++++++------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/Software/src/battery/BMW-I3-BATTERY.cpp b/Software/src/battery/BMW-I3-BATTERY.cpp index d255ad06..bca7f74e 100644 --- a/Software/src/battery/BMW-I3-BATTERY.cpp +++ b/Software/src/battery/BMW-I3-BATTERY.cpp @@ -270,42 +270,45 @@ CAN_frame_t BMW_5F8 = {.FIR = {.B = .MsgID = 0x5F8, .data = {0x64, 0x01, 0x00, 0x0B, 0x92, 0x03, 0x00, 0x05}}; -CAN_frame_t BMW_6F1_CELL = { .FIR = { .B = { - .DLC = 5, - .FF = CAN_frame_std, - } }, - .MsgID = 0x6F1, - .data = { 0x07, 0x03, 0x22, 0xDD, 0xBF } }; +CAN_frame_t BMW_6F1_CELL = {.FIR = {.B = + { + .DLC = 5, + .FF = CAN_frame_std, + }}, + .MsgID = 0x6F1, + .data = {0x07, 0x03, 0x22, 0xDD, 0xBF}}; -CAN_frame_t BMW_6F1_SOH = { .FIR = { .B = { - .DLC = 5, - .FF = CAN_frame_std, - } }, - .MsgID = 0x6F1, - .data = { 0x07, 0x03, 0x22, 0x63, 0x35 } }; +CAN_frame_t BMW_6F1_SOH = {.FIR = {.B = + { + .DLC = 5, + .FF = CAN_frame_std, + }}, + .MsgID = 0x6F1, + .data = {0x07, 0x03, 0x22, 0x63, 0x35}}; +CAN_frame_t BMW_6F1_SOC = {.FIR = {.B = + { + .DLC = 5, + .FF = CAN_frame_std, + }}, + .MsgID = 0x6F1, + .data = {0x07, 0x03, 0x22, 0xDD, 0xBC}}; -CAN_frame_t BMW_6F1_SOC = { .FIR = { .B = { - .DLC = 5, - .FF = CAN_frame_std, - } }, - .MsgID = 0x6F1, - .data = { 0x07, 0x03, 0x22, 0xDD, 0xBC } }; - -CAN_frame_t BMW_6F1_CELL_VOLTAGE_AVG = { .FIR = { .B = { - .DLC = 5, - .FF = CAN_frame_std, - } }, - .MsgID = 0x6F1, - .data = { 0x07, 0x03, 0x22, 0xDF, 0xA0 } }; - -CAN_frame_t BMW_6F1_CONTINUE = { .FIR = { .B = { - .DLC = 4, - .FF = CAN_frame_std, - } }, - .MsgID = 0x6F1, - .data = { 0x07, 0x30, 0x00, 0x02 } }; +CAN_frame_t BMW_6F1_CELL_VOLTAGE_AVG = {.FIR = {.B = + { + .DLC = 5, + .FF = CAN_frame_std, + }}, + .MsgID = 0x6F1, + .data = {0x07, 0x03, 0x22, 0xDF, 0xA0}}; +CAN_frame_t BMW_6F1_CONTINUE = {.FIR = {.B = + { + .DLC = 4, + .FF = CAN_frame_std, + }}, + .MsgID = 0x6F1, + .data = {0x07, 0x30, 0x00, 0x02}}; //The above CAN messages need to be sent towards the battery to keep it alive static uint8_t startup_counter_contactor = 0; @@ -413,7 +416,7 @@ static uint8_t increment_alive_counter(uint8_t counter) { void update_values_battery() { //This function maps all the values fetched via CAN to the correct parameters used for modbus - system_real_SOC_pptt = (battery_HVBatt_SOC * 10); + system_real_SOC_pptt = (battery_HVBatt_SOC * 10); system_battery_voltage_dV = battery_volts; //Unit V+1 (5000 = 500.0V) @@ -604,19 +607,15 @@ void receive_can_battery(CAN_frame_t rx_frame) { battery_ID2 = rx_frame.data.u8[0]; break; case 0x607: //BMS - responses to message requests on 0x615 - if (rx_frame.FIR.B.DLC > 6 - && next_data == 0 - && rx_frame.data.u8[0] == 0xf1) { + if (rx_frame.FIR.B.DLC > 6 && next_data == 0 && rx_frame.data.u8[0] == 0xf1) { uint8_t count = 6; while (count < rx_frame.FIR.B.DLC && next_data < 49) { message_data[next_data++] = rx_frame.data.u8[count++]; } - ESP32Can.CANWriteFrame(&BMW_6F1_CONTINUE); // tell battery to send additional messages + ESP32Can.CANWriteFrame(&BMW_6F1_CONTINUE); // tell battery to send additional messages - } else if (rx_frame.FIR.B.DLC > 3 - && next_data > 0 - && rx_frame.data.u8[0] == 0xf1 - && ((rx_frame.data.u8[1] & 0xF0) == 0x20)) { + } else if (rx_frame.FIR.B.DLC > 3 && next_data > 0 && rx_frame.data.u8[0] == 0xf1 && + ((rx_frame.data.u8[1] & 0xF0) == 0x20)) { uint8_t count = 2; while (count < rx_frame.FIR.B.DLC && next_data < 49) { message_data[next_data++] = rx_frame.data.u8[count++]; @@ -624,24 +623,24 @@ void receive_can_battery(CAN_frame_t rx_frame) { switch (cmdState) { case CELL_VOLTAGE: - if (next_data>=4) { + if (next_data >= 4) { system_cellvoltages_mV[0] = (message_data[0] << 8 | message_data[1]); system_cellvoltages_mV[2] = (message_data[2] << 8 | message_data[3]); } break; case CELL_VOLTAGE_AVG: - if (next_data>=30) { + if (next_data >= 30) { system_cellvoltages_mV[1] = (message_data[10] << 8 | message_data[11]) / 10; battery_capacity_cah = (message_data[4] << 8 | message_data[5]); } break; case SOH: - if (next_data>=4) { + if (next_data >= 4) { battery_soh = message_data[3]; } break; case SOC: - if (next_data>=6) { + if (next_data >= 6) { battery_soc = (message_data[0] << 8 | message_data[1]); battery_soc_hvmax = (message_data[2] << 8 | message_data[3]); battery_soc_hvmin = (message_data[4] << 8 | message_data[5]); From 15c1291f908a625d38745e2e343e4e76d902384b Mon Sep 17 00:00:00 2001 From: Ole Date: Tue, 9 Apr 2024 22:13:57 +0200 Subject: [PATCH 4/5] Removed changes from webserver and fix MAX_CAN_FAILURES --- Software/src/battery/BMW-I3-BATTERY.cpp | 1 - Software/src/devboard/webserver/webserver.cpp | 6 ------ Software/src/devboard/webserver/webserver.h | 7 ------- 3 files changed, 14 deletions(-) diff --git a/Software/src/battery/BMW-I3-BATTERY.cpp b/Software/src/battery/BMW-I3-BATTERY.cpp index bca7f74e..241303c8 100644 --- a/Software/src/battery/BMW-I3-BATTERY.cpp +++ b/Software/src/battery/BMW-I3-BATTERY.cpp @@ -16,7 +16,6 @@ static unsigned long previousMillis5000 = 0; // will store last time a 5000ms static unsigned long previousMillis10000 = 0; // will store last time a 10000ms CAN Message was send static uint8_t CANstillAlive = 12; // counter for checking if CAN is still alive static uint16_t CANerror = 0; // counter on how many CAN errors encountered -#define MAX_CAN_FAILURES 500 // Amount of malformed CAN messages to allow before raising a warning #define ALIVE_MAX_VALUE 14 // BMW CAN messages contain alive counter, goes from 0...14 static const uint16_t WUPonDuration = 477; // in milliseconds how long WUP should be ON after poweron diff --git a/Software/src/devboard/webserver/webserver.cpp b/Software/src/devboard/webserver/webserver.cpp index f87257e8..46dc114f 100644 --- a/Software/src/devboard/webserver/webserver.cpp +++ b/Software/src/devboard/webserver/webserver.cpp @@ -529,12 +529,6 @@ String processor(const String& var) { } else { // > 0 content += "

Battery charging!

"; } -#ifdef BMW_I3_BATTERY - content += "

Battery Capacity cAh: " + String(battery_capacity_cah / 100.0, 2) + " Ah

"; - content += "

Battery SOC: " + String(battery_soc / 10.0, 1) + "%%

"; - content += "

Battery SOC hvMax: " + String(battery_soc_hvmax / 10.0, 1) + "%%

"; - content += "

Battery SOC hvMin: " + String(battery_soc_hvmin / 10.0, 1) + "%%

"; -#endif content += "

Automatic contactor closing allowed:

"; content += "

Battery: "; diff --git a/Software/src/devboard/webserver/webserver.h b/Software/src/devboard/webserver/webserver.h index eb2a8e76..527223ef 100644 --- a/Software/src/devboard/webserver/webserver.h +++ b/Software/src/devboard/webserver/webserver.h @@ -40,13 +40,6 @@ extern uint8_t LEDcolor; //Enum, 0-10 extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false -#ifdef BMW_I3_BATTERY -extern uint16_t battery_soc; -extern uint16_t battery_soc_hvmax; -extern uint16_t battery_soc_hvmin; -extern uint16_t battery_capacity_cah; -#endif - extern const char* ssid; extern const char* password; extern const uint8_t wifi_channel; From e1d9c9390eba6e2c1bbc2162ff9092f94d3f6fc0 Mon Sep 17 00:00:00 2001 From: Ole Date: Wed, 10 Apr 2024 07:32:01 +0200 Subject: [PATCH 5/5] use static --- Software/src/battery/BMW-I3-BATTERY.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Software/src/battery/BMW-I3-BATTERY.cpp b/Software/src/battery/BMW-I3-BATTERY.cpp index 241303c8..923dc555 100644 --- a/Software/src/battery/BMW-I3-BATTERY.cpp +++ b/Software/src/battery/BMW-I3-BATTERY.cpp @@ -348,11 +348,10 @@ static uint16_t battery_prediction_voltage_longterm_charge = 0; static uint16_t battery_prediction_voltage_longterm_discharge = 0; static uint16_t battery_prediction_duration_charging_minutes = 0; static uint16_t battery_target_voltage_in_CV_mode = 0; - -uint16_t battery_soc = 0; -uint16_t battery_soc_hvmax = 0; -uint16_t battery_soc_hvmin = 0; -uint16_t battery_capacity_cah = 0; +static uint16_t battery_soc = 0; +static uint16_t battery_soc_hvmax = 0; +static uint16_t battery_soc_hvmin = 0; +static uint16_t battery_capacity_cah = 0; static int16_t battery_temperature_HV = 0; static int16_t battery_temperature_heat_exchanger = 0;