Add cellamount LFP autodetect

This commit is contained in:
Daniel 2024-02-17 10:45:23 +02:00
parent 4bcd7c91a2
commit 77345ec41f

View file

@ -244,7 +244,7 @@ void update_values_battery() { //This function maps all the values fetched via
cell_deviation_mV = (cell_max_v - cell_min_v); cell_deviation_mV = (cell_max_v - cell_min_v);
//Determine which chemistry battery pack is using (crude method, TODO: replace with real CAN data later) //Determine which chemistry battery pack is using (crude method, TODO: replace with real CAN identifier later)
if (soc_vi > 900) { //When SOC% is over 90.0%, we can use max cell voltage to estimate what chemistry is used if (soc_vi > 900) { //When SOC% is over 90.0%, we can use max cell voltage to estimate what chemistry is used
if (cell_max_v < 3450) { if (cell_max_v < 3450) {
LFP_Chemistry = true; LFP_Chemistry = true;
@ -253,6 +253,10 @@ void update_values_battery() { //This function maps all the values fetched via
LFP_Chemistry = false; LFP_Chemistry = false;
} }
} }
// An even better way is to check how many cells are in the pack. NCM/A batteries have 96s, LFP has 102-106s
if (nof_cellvoltages > 101) {
LFP_Chemistry = true;
}
//Check if SOC% is plausible //Check if SOC% is plausible
if (battery_voltage > if (battery_voltage >