mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 01:05:21 +03:00
Increase max cell count to 12
This commit is contained in:
parent
d019eeb99d
commit
537e4eff4c
2 changed files with 6 additions and 4 deletions
|
@ -1015,10 +1015,10 @@ groups:
|
|||
field: cells
|
||||
condition: USE_ADC
|
||||
min: 0
|
||||
max: 8
|
||||
max: 12
|
||||
- name: vbat_cell_detect_voltage
|
||||
description: "Maximum voltage per cell, used for auto-detecting the number of cells of the battery in 0.01V units, default is 4.30V"
|
||||
default_value: "430"
|
||||
default_value: "425"
|
||||
field: voltage.cellDetect
|
||||
condition: USE_ADC
|
||||
min: 100
|
||||
|
|
|
@ -100,7 +100,7 @@ void pgResetFn_batteryProfiles(batteryProfile_t *instance)
|
|||
.cells = 0,
|
||||
|
||||
.voltage = {
|
||||
.cellDetect = 430,
|
||||
.cellDetect = 425,
|
||||
.cellMax = 420,
|
||||
.cellMin = 330,
|
||||
.cellWarning = 350
|
||||
|
@ -266,7 +266,9 @@ void batteryUpdate(timeUs_t timeDelta)
|
|||
batteryCellCount = currentBatteryProfile->cells;
|
||||
else {
|
||||
batteryCellCount = (vbat / currentBatteryProfile->voltage.cellDetect) + 1;
|
||||
if (batteryCellCount > 8) batteryCellCount = 8; // something is wrong, we expect 8 cells maximum (and autodetection will be problematic at 6+ cells)
|
||||
// Assume there are no 7S, 9S and 11S batteries so round up to 8S, 10S and 12S
|
||||
batteryCellCount = ((batteryCellCount > 6) && (batteryCellCount & 2) == 0) ? batteryCellCount : batteryCellCount + 1;
|
||||
batteryCellCount = MIN(batteryCellCount, 12);
|
||||
}
|
||||
|
||||
batteryFullVoltage = batteryCellCount * currentBatteryProfile->voltage.cellMax;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue