File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -396,11 +396,14 @@ TABS.power.initialize = function (callback) {
396396
397397 let vbatscalechanged = false ;
398398 let amperagescalechanged = false ;
399+ let vbatnewscale = 0 ;
400+ let amperagenewscale = 0 ;
401+
399402 $ ( 'a.calibrate' ) . click ( function ( ) {
400403 if ( FC . BATTERY_CONFIG . voltageMeterSource == 1 ) {
401404 const vbatcalibration = parseFloat ( $ ( 'input[name="vbatcalibration"]' ) . val ( ) ) ;
402405 if ( vbatcalibration != 0 ) {
403- const vbatnewscale = Math . round ( FC . VOLTAGE_METER_CONFIGS [ 0 ] . vbatscale * ( vbatcalibration / FC . VOLTAGE_METERS [ 0 ] . voltage ) ) ;
406+ vbatnewscale = Math . round ( FC . VOLTAGE_METER_CONFIGS [ 0 ] . vbatscale * ( vbatcalibration / FC . VOLTAGE_METERS [ 0 ] . voltage ) ) ;
404407 if ( vbatnewscale >= 10 && vbatnewscale <= 255 ) {
405408 FC . VOLTAGE_METER_CONFIGS [ 0 ] . vbatscale = vbatnewscale ;
406409 vbatscalechanged = true ;
@@ -413,7 +416,7 @@ TABS.power.initialize = function (callback) {
413416 const amperageoffset = FC . CURRENT_METER_CONFIGS [ ampsource - 1 ] . offset / 1000 ;
414417 if ( amperagecalibration != 0 ) {
415418 if ( FC . CURRENT_METERS [ ampsource - 1 ] . amperage != amperageoffset && amperagecalibration != amperageoffset ) {
416- const amperagenewscale = Math . round ( FC . CURRENT_METER_CONFIGS [ ampsource - 1 ] . scale *
419+ amperagenewscale = Math . round ( FC . CURRENT_METER_CONFIGS [ ampsource - 1 ] . scale *
417420 ( ( FC . CURRENT_METERS [ ampsource - 1 ] . amperage - amperageoffset ) / ( amperagecalibration - amperageoffset ) ) ) ;
418421 if ( amperagenewscale > - 16000 && amperagenewscale < 16000 && amperagenewscale != 0 ) {
419422 FC . CURRENT_METER_CONFIGS [ ampsource - 1 ] . scale = amperagenewscale ;
You can’t perform that action at this time.
0 commit comments