mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-22 15:55:33 +03:00
Merge pull request #1616 from etracer65/mode_show_arming_disabled
Add visual indicator on ARM mode when arming is disabled by the firmware
This commit is contained in:
commit
9f63b994b9
3 changed files with 47 additions and 3 deletions
|
@ -429,14 +429,46 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
let modeElement = $('#mode-' + i);
|
||||
if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) {
|
||||
// if the mode is unused, skip it
|
||||
modeElement.removeClass('off').removeClass('on');
|
||||
modeElement.removeClass('off').removeClass('on').removeClass('disabled');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bit_check(CONFIG.mode, i)) {
|
||||
$('.mode .name').eq(i).data('modeElement').addClass('on').removeClass('off');
|
||||
$('.mode .name').eq(i).data('modeElement').addClass('on').removeClass('off').removeClass('disabled');
|
||||
|
||||
// ARM mode is a special case
|
||||
if (i == 0) {
|
||||
$('.mode .name').eq(i).html(AUX_CONFIG[i]);
|
||||
}
|
||||
} else {
|
||||
$('.mode .name').eq(i).data('modeElement').removeClass('on').addClass('off');
|
||||
|
||||
//ARM mode is a special case
|
||||
if (i == 0) {
|
||||
var armSwitchActive = false;
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
if (CONFIG.armingDisableCount > 0) {
|
||||
// check the highest bit of the armingDisableFlags. This will be the ARMING_DISABLED_ARMSWITCH flag.
|
||||
var armSwitchMask = 1 << (CONFIG.armingDisableCount - 1);
|
||||
if ((CONFIG.armingDisableFlags & armSwitchMask) > 0) {
|
||||
armSwitchActive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the ARMING_DISABLED_ARMSWITCH flag is set then that means that arming is disabled
|
||||
// and the arm switch is in a valid arming range. Highlight the mode in red to indicate
|
||||
// that arming is disabled.
|
||||
if (armSwitchActive) {
|
||||
$('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('off').addClass('disabled');
|
||||
$('.mode .name').eq(i).html(AUX_CONFIG[i] + '<br>' + i18n.getMessage('auxiliaryDisabled'));
|
||||
} else {
|
||||
$('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('disabled').addClass('off');
|
||||
$('.mode .name').eq(i).html(AUX_CONFIG[i]);
|
||||
}
|
||||
} else {
|
||||
$('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('disabled').addClass('off');
|
||||
}
|
||||
}
|
||||
hasUsedMode = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue