1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Merge pull request #9645 from etracer65/mixer_vbat_comp_div0

Fix division by 0 risk in mixer vbat sag compensation
This commit is contained in:
Michael Keller 2020-03-28 14:01:58 +13:00 committed by GitHub
commit 9c248b1dcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -366,7 +366,7 @@ void mixerInitProfile(void)
//TODO: Make this voltage user configurable //TODO: Make this voltage user configurable
vbatFull = CELL_VOLTAGE_FULL_CV; vbatFull = CELL_VOLTAGE_FULL_CV;
vbatRangeToCompensate = vbatFull - batteryConfig()->vbatwarningcellvoltage; vbatRangeToCompensate = vbatFull - batteryConfig()->vbatwarningcellvoltage;
if (vbatRangeToCompensate >= 0) { if (vbatRangeToCompensate > 0) {
vbatSagCompensationFactor = ((float)currentPidProfile->vbat_sag_compensation) / 100.0f; vbatSagCompensationFactor = ((float)currentPidProfile->vbat_sag_compensation) / 100.0f;
} }
} }