Skip to content

Commit 847b7ef

Browse files
committed
Cleaned up configuration tab.
1 parent 9c50885 commit 847b7ef

File tree

7 files changed

+72
-81
lines changed

7 files changed

+72
-81
lines changed

_locales/en/messages.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,6 @@
641641
"configurationDisarmKillSwitch": {
642642
"message": "Disarm motors regardless of throttle value (When arming via AUX channel)"
643643
},
644-
"configurationMidRc": {
645-
"message": "Center value for RC channels"
646-
},
647-
"configurationMidRcHelp": {
648-
"message": "This is the center value <span style=\"font-weight: bold\">for all RC channels</span>. Set this to the value that your transmitter sends when the stick is centered for a channel. To adjust the thrust at throttle mid position, change the 'Trottle MID' value on the PID Tuning tab."
649-
},
650644
"configurationDigitalIdlePercent": {
651645
"message": "Motor Idle Throttle Value (percent)"
652646
},
@@ -979,6 +973,12 @@
979973
"receiverThrottleExpo": {
980974
"message": "Throttle EXPO"
981975
},
976+
"receiverMidRc": {
977+
"message": "Center value for RC channels"
978+
},
979+
"receiverMidRcHelp": {
980+
"message": "This is the center value <span style=\"font-weight: bold\">for all RC channels</span>. Set this to the value that your transmitter sends when the stick is centered for a channel. To adjust the thrust at throttle mid position, change the 'Trottle MID' value on the PID Tuning tab."
981+
},
982982
"receiverDeadband": {
983983
"message": "RC Deadband"
984984
},

js/fc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ var FC = {
185185
};
186186

187187
MISC = {
188-
midrc: 0,
189188
minthrottle: 0,
190189
maxthrottle: 0,
191190
mincommand: 0,

js/msp/MSPHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
205205
}
206206
break;
207207
case MSPCodes.MSP_MISC: // 22 bytes
208-
MISC.midrc = data.readU16();
208+
RX_CONFIG.midrc = data.readU16();
209209
MISC.minthrottle = data.readU16(); // 0-2000
210210
MISC.maxthrottle = data.readU16(); // 0-2000
211211
MISC.mincommand = data.readU16(); // 0-2000
@@ -1029,7 +1029,7 @@ MspHelper.prototype.crunch = function(code) {
10291029
buffer.push16(FC_CONFIG.loopTime);
10301030
break;
10311031
case MSPCodes.MSP_SET_MISC:
1032-
buffer.push16(MISC.midrc)
1032+
buffer.push16(RX_CONFIG.midrc)
10331033
.push16(MISC.minthrottle)
10341034
.push16(MISC.maxthrottle)
10351035
.push16(MISC.mincommand)

tabs/configuration.html

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,6 @@
8282
</div>
8383
</div>
8484
<!-- -->
85-
<div class="number">
86-
<label>
87-
<div class="numberspacer">
88-
<input type="number" name="midrc" min="0" max="2000" />
89-
</div>
90-
<span i18n="configurationMidRc"></span>
91-
<div class="helpicon cf_tip" i18n_title="configurationMidRcHelp"></div>
92-
</label>
93-
</div>
9485
<div class="number digitalIdlePercent">
9586
<label>
9687
<div class="numberspacer">
@@ -361,33 +352,33 @@
361352
<!-- table generated here -->
362353
</tbody>
363354
</table>
364-
<div class="select batterymetertype">
355+
<div class="select batterymetertype vbatmonitoring">
365356
<label>
366357
<select class="batterymetertype"><!-- list generated here --></select>
367358
<span i18n="configurationBatteryMeterType"></span>
368359
</label>
369360
</div>
370-
<div class="number">
361+
<div class="number vbatmonitoring">
371362
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
372363
i18n="configurationBatteryMinimum"></span>
373364
</label>
374365
</div>
375-
<div class="number">
366+
<div class="number vbatmonitoring">
376367
<label> <input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" /> <span
377368
i18n="configurationBatteryMaximum"></span>
378369
</label>
379370
</div>
380-
<div class="number">
371+
<div class="number vbatmonitoring">
381372
<label> <input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" /> <span
382373
i18n="configurationBatteryWarning"></span>
383374
</label>
384375
</div>
385-
<div class="number">
376+
<div class="number vbatmonitoring vbatCalibration">
386377
<label> <input type="number" name="voltagescale" step="1" min="10" max="255" /> <span
387378
i18n="configurationBatteryScale"></span>
388379
</label>
389380
</div>
390-
<div class="number">
381+
<div class="number vbatmonitoring">
391382
<label> <input type="text" name="batteryvoltage" readonly class="disabled" /> <span
392383
i18n="configurationBatteryVoltage"></span>
393384
</label>
@@ -411,29 +402,29 @@
411402
<!-- table generated here -->
412403
</tbody>
413404
</table>
414-
<div class="select">
405+
<div class="select currentMonitoring">
415406
<label>
416407
<select class="currentmetertype"><!-- list generated here --></select>
417408
<span i18n="configurationCurrentMeterType"></span>
418409
</label>
419410
</div>
420-
<div class="number">
411+
<div class="number currentMonitoring currentCalibration">
421412
<label> <input type="number" name="currentscale" step="1" min="-16000" max="16000" /> <span
422413
i18n="configurationCurrentScale"></span>
423414
</label>
424415
</div>
425-
<div class="number">
416+
<div class="number currentMonitoring currentCalibration">
426417
<label> <input type="number" name="currentoffset" step="1" min="-1600" max="16000" /> <span
427418
i18n="configurationCurrentOffset"></span>
428419
</label>
429420
</div>
430-
<div class="number">
421+
<div class="number currentMonitoring currentOutput">
431422
<label>
432423
<input type="text" name="batterycurrent" readonly class="disabled" /> <span
433424
i18n="configurationBatteryCurrent"></span>
434425
</label>
435426
</div>
436-
<div class="checkbox">
427+
<div class="checkbox currentMonitoring currentOutput">
437428
<div class="numberspacer">
438429
<input type="checkbox" name="multiwiicurrentoutput" class="toggle" />
439430
</div>

tabs/configuration.js

Lines changed: 32 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
458458
}
459459

460460
// fill throttle
461-
$('input[name="midrc"]').val(MISC.midrc);
462461
var minThrottle_e = $('input[name="minthrottle"]');
463462
minThrottle_e.val(MISC.minthrottle);
464463
$('input[name="maxthrottle"]').val(MISC.maxthrottle);
@@ -497,7 +496,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
497496

498497
batteryMeterType_e.change(function () {
499498
MISC.batterymetertype = parseInt($(this).val());
500-
checkDisableVbatControls();
499+
checkUpdateVbatControls();
501500
});
502501
batteryMeterType_e.val(MISC.batterymetertype).change();
503502
} else {
@@ -527,7 +526,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
527526

528527
currentMeterType_e.change(function () {
529528
BF_CONFIG.currentmetertype = parseInt($(this).val());
530-
checkDisableCurrentControls();
529+
checkUpdateCurrentControls();
531530
});
532531
currentMeterType_e.val(BF_CONFIG.currentmetertype).change();
533532

@@ -574,54 +573,43 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
574573
}
575574
}
576575

577-
function checkDisableVbatControls() {
578-
function disableBatteryControls(disabled) {
579-
$('input[name="mincellvoltage"]').prop('disabled', disabled);
580-
$('input[name="maxcellvoltage"]').prop('disabled', disabled);
581-
$('input[name="warningcellvoltage"]').prop('disabled', disabled);
582-
$('input[name="voltagescale"]').prop('disabled', disabled);
583-
}
576+
function checkUpdateVbatControls() {
577+
if (BF_CONFIG.features.isEnabled('VBAT')) {
578+
$('.vbatmonitoring').show();
584579

585-
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
586-
if (BF_CONFIG.features.isEnabled('VBAT')) {
587-
$('select.batterymetertype').prop('disabled', false);
580+
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
581+
$('select.batterymetertype').show();
588582

589-
if (MISC.batterymetertype == 1) {
590-
disableBatteryControls(true);
591-
} else {
592-
disableBatteryControls(false);
593-
}
583+
if (MISC.batterymetertype !== 0) {
584+
$('.vbatCalibration').hide();
585+
}
594586
} else {
595-
$('select.batterymetertype').prop('disabled', true);
596-
597-
disableBatteryControls(true);
587+
$('select.batterymetertype').hide();
598588
}
599589
} else {
600-
if (BF_CONFIG.features.isEnabled('VBAT')) {
601-
disableBatteryControls(false);
602-
} else {
603-
disableBatteryControls(true);
604-
}
590+
$('.vbatmonitoring').hide();
605591
}
606592
}
607593

608-
function checkDisableCurrentControls() {
594+
function checkUpdateCurrentControls() {
609595
if (BF_CONFIG.features.isEnabled('CURRENT_METER')) {
610-
$('select.currentmetertype').prop('disabled', false);
611-
if (BF_CONFIG.currentmetertype == 0 || BF_CONFIG.currentmetertype == 3) {
612-
$('input[name="currentscale"]').prop('disabled', true);
613-
$('input[name="currentoffset"]').prop('disabled', true);
614-
$('input[name="multiwiicurrentoutput"]').prop('disabled', true);
615-
} else {
616-
$('input[name="currentscale"]').prop('disabled', false);
617-
$('input[name="currentoffset"]').prop('disabled', false);
618-
$('input[name="multiwiicurrentoutput"]').prop('disabled', false);
596+
$('.currentMonitoring').show();
597+
598+
switch(BF_CONFIG.currentmetertype) {
599+
case 0:
600+
$('.currentCalibration').hide();
601+
$('.currentOutput').hide();
602+
603+
break;
604+
case 3:
605+
$('.currentCalibration').hide();
606+
}
607+
608+
if (BF_CONFIG.currentmetertype !== 1 && BF_CONFIG.currentmetertype !== 2) {
609+
$('.currentCalibration').hide();
619610
}
620611
} else {
621-
$('select.currentmetertype').prop('disabled', true);
622-
$('input[name="currentscale"]').prop('disabled', true);
623-
$('input[name="currentoffset"]').prop('disabled', true);
624-
$('input[name="multiwiicurrentoutput"]').prop('disabled', true);
612+
$('.currentMonitoring').hide();
625613
}
626614
}
627615

@@ -637,16 +625,16 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
637625
});
638626

639627
$(features_e).filter('tbody.features.batteryVoltage').change(function() {
640-
checkDisableVbatControls();
628+
checkUpdateVbatControls();
641629
});
642630

643631
$(features_e).filter('tbody.features.batteryCurrent').change(function() {
644-
checkDisableCurrentControls();
632+
checkUpdateCurrentControls();
645633
});
646634

647635
checkShowSerialRxBox();
648-
checkDisableVbatControls();
649-
checkDisableCurrentControls();
636+
checkUpdateVbatControls();
637+
checkUpdateCurrentControls();
650638

651639
$("input[id='unsyncedPWMSwitch']").change(function() {
652640
if ($(this).is(':checked')) {
@@ -672,7 +660,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
672660
ARMING_CONFIG.disarm_kill_switch = $('input[id="disarmkillswitch"]').is(':checked') ? 1 : 0;
673661
}
674662

675-
MISC.midrc = parseInt($('input[name="midrc"]').val());
676663
MISC.minthrottle = parseInt($('input[name="minthrottle"]').val());
677664
MISC.maxthrottle = parseInt($('input[name="maxthrottle"]').val());
678665
MISC.mincommand = parseInt($('input[name="mincommand"]').val());

tabs/receiver.html

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,32 @@
3535
<div class="gui_box tunings grey" style="float: right;">
3636
<table class="deadband" width="100%">
3737
<tr>
38-
<th i18n="receiverDeadband"></th>
39-
<th i18n="receiverYawDeadband"></th>
38+
<th i18n="receiverMidRc">
39+
</th>
40+
<th i18n="receiverDeadband">
41+
</th>
42+
<th i18n="receiverYawDeadband">
43+
</th>
4044
</tr>
4145
<tr>
4246
<td>
43-
<div class="cf_tip" i18n_title="receiverHelpDeadband">
47+
<div class="numberspacer">
48+
<input type="number" name="midrc" min="1200" max="1700" />
49+
<div class="helpicon cf_tip" i18n_title="receiverMidRcHelp"></div>
50+
</div>
51+
</td>
52+
<td>
53+
<div>
4454
<input type="number" name="deadband" step="1" min="0" max="32" />
55+
<div class="helpicon cf_tip" i18n_title="receiverHelpDeadband"></div>
4556
</div>
4657
</td>
4758
<td>
48-
<div class="cf_tip" i18n_title="receiverHelpYawDeadband">
59+
<div>
4960
<input type="number" name="yaw_deadband" step="1" min="0" max="100" />
61+
<div class="helpicon cf_tip" i18n_title="receiverHelpYawDeadband"></div>
5062
</div>
51-
</td>
63+
</td>
5264
</tr>
5365
</table>
5466
</div>

tabs/receiver.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ TABS.receiver.initialize = function (callback) {
7474
if (semver.lt(CONFIG.apiVersion, "1.15.0")) {
7575
$('.deadband').hide();
7676
} else {
77+
$('.deadband input[name="midrc"]').val(RX_CONFIG.midrc);
7778
$('.deadband input[name="yaw_deadband"]').val(RC_deadband.yaw_deadband);
7879
$('.deadband input[name="deadband"]').val(RC_deadband.deadband);
7980

@@ -236,8 +237,9 @@ TABS.receiver.initialize = function (callback) {
236237

237238
$('a.update').click(function () {
238239
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
239-
RC_deadband.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
240-
RC_deadband.deadband = parseInt($('.deadband input[name="deadband"]').val());
240+
RX_CONFIG.midrc = parseInt($('.deadband input[name="midrc"]').val());
241+
RC_deadband.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
242+
RC_deadband.deadband = parseInt($('.deadband input[name="deadband"]').val());
241243
}
242244

243245
// catch rc map

0 commit comments

Comments
 (0)