mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-06 12:00:13 +02:00
SoC estimation before initialized cell count - fix
This commit is contained in:
parent
d8d3dc4f32
commit
cd8d9e2e0c
1 changed files with 6 additions and 0 deletions
|
@ -108,6 +108,12 @@ uint16_t estimateSOCFromCell(uint16_t cellVoltage) {
|
||||||
|
|
||||||
// Simplified version of the pack-based SOC estimation with compensation
|
// Simplified version of the pack-based SOC estimation with compensation
|
||||||
uint16_t estimateSOC(uint16_t packVoltage, uint16_t cellCount, int16_t currentAmps) {
|
uint16_t estimateSOC(uint16_t packVoltage, uint16_t cellCount, int16_t currentAmps) {
|
||||||
|
// If cell count is still the default 192 but we haven't confirmed it yet
|
||||||
|
if (!set_voltage_limits && cellCount == 192) {
|
||||||
|
// Fall back to BMS-reported SOC while cell count is uncertain
|
||||||
|
return (SOC_Display * 10);
|
||||||
|
}
|
||||||
|
|
||||||
if (cellCount == 0)
|
if (cellCount == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue