1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Use BATTERY_STATE for cellCount (#3964)

* Use BATTERY_STATE for cellCount

* Remove outdated comments

* Use vbatcellcount instead of 1.8V condition
This commit is contained in:
Mark Haslinghuis 2024-05-20 14:32:16 +02:00 committed by GitHub
parent 874e1ac0cc
commit c3cb9ceda0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 21 deletions

View file

@ -740,8 +740,9 @@ async function update_live_status() {
if (GUI.active_tab !== 'cli' && GUI.active_tab !== 'presets') {
await MSP.promise(MSPCodes.MSP_ANALOG);
await MSP.promise(MSPCodes.MSP_BATTERY_STATE);
const nbCells = FC.ANALOG.voltage === 0 ? 1 : Math.floor(FC.ANALOG.voltage / FC.BATTERY_CONFIG.vbatmaxcellvoltage) + 1;
const nbCells = FC.ANALOG.voltage === 0 || FC.BATTERY_STATE.cellCount === 0 ? 1 : FC.BATTERY_STATE.cellCount;
const min = FC.BATTERY_CONFIG.vbatmincellvoltage * nbCells;
const max = FC.BATTERY_CONFIG.vbatmaxcellvoltage * nbCells;
const warn = FC.BATTERY_CONFIG.vbatwarningcellvoltage * nbCells;