Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/betaflight/betaflight-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ Blackman <blckmn@users.noreply.github.com>2022-02-01 01:46:58 +0300
committerGitHub <noreply@github.com>2022-02-01 01:46:58 +0300
commit340087a4df85aa36ab859eef2d8cf17cbb387fa8 (patch)
tree9abe8f1a3415395d311f04798e93ec7e9cd10c09
parent3018ac3bce26a1288bb1ee714f4e6354c2b3637e (diff)
parent78c34ed38c1de9b0331ffe540307bbd4fd10a2b4 (diff)
Merge pull request #2786 from PascalLuginbuehl/fix-battery-calibration10.8.0-RC3
fix: battery calibration in power tab
-rw-r--r--src/js/tabs/power.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/js/tabs/power.js b/src/js/tabs/power.js
index 4913be73..eabc868c 100644
--- a/src/js/tabs/power.js
+++ b/src/js/tabs/power.js
@@ -396,11 +396,14 @@ TABS.power.initialize = function (callback) {
let vbatscalechanged = false;
let amperagescalechanged = false;
+ let vbatnewscale = 0;
+ let amperagenewscale = 0;
+
$('a.calibrate').click(function() {
if (FC.BATTERY_CONFIG.voltageMeterSource == 1) {
const vbatcalibration = parseFloat($('input[name="vbatcalibration"]').val());
if (vbatcalibration != 0) {
- const vbatnewscale = Math.round(FC.VOLTAGE_METER_CONFIGS[0].vbatscale * (vbatcalibration / FC.VOLTAGE_METERS[0].voltage));
+ vbatnewscale = Math.round(FC.VOLTAGE_METER_CONFIGS[0].vbatscale * (vbatcalibration / FC.VOLTAGE_METERS[0].voltage));
if (vbatnewscale >= 10 && vbatnewscale <= 255) {
FC.VOLTAGE_METER_CONFIGS[0].vbatscale = vbatnewscale;
vbatscalechanged = true;
@@ -413,7 +416,7 @@ TABS.power.initialize = function (callback) {
const amperageoffset = FC.CURRENT_METER_CONFIGS[ampsource - 1].offset / 1000;
if (amperagecalibration != 0) {
if (FC.CURRENT_METERS[ampsource - 1].amperage != amperageoffset && amperagecalibration != amperageoffset) {
- const amperagenewscale = Math.round(FC.CURRENT_METER_CONFIGS[ampsource - 1].scale *
+ amperagenewscale = Math.round(FC.CURRENT_METER_CONFIGS[ampsource - 1].scale *
((FC.CURRENT_METERS[ampsource - 1].amperage - amperageoffset) / (amperagecalibration - amperageoffset)));
if (amperagenewscale > -16000 && amperagenewscale < 16000 && amperagenewscale != 0) {
FC.CURRENT_METER_CONFIGS[ampsource - 1].scale = amperagenewscale;