1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-23 00:05:22 +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:
Michael Keller 2019-09-07 12:30:18 +12:00 committed by GitHub
commit 9f63b994b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 3 deletions

View file

@ -1883,6 +1883,10 @@
"auxiliaryMax": { "auxiliaryMax": {
"message": "Max" "message": "Max"
}, },
"auxiliaryDisabled": {
"message": "(DISABLED)",
"descripton": "Text to add to the ARM mode (maybe others in the future) in the MODES TAB when it has been disabled for some external reason"
},
"auxiliaryAddRange": { "auxiliaryAddRange": {
"message": "Add Range" "message": "Add Range"
}, },

View file

@ -40,6 +40,14 @@
background: #828885; background: #828885;
} }
.tab-auxiliary .mode.disabled .info {
background: var(--error);
color: var(--quietText);}
.tab-auxiliary .mode.disabled:nth-child(odd) .info {
background: var(--error);
}
#tab-auxiliary-templates { #tab-auxiliary-templates {
display: none; display: none;
} }

View file

@ -429,14 +429,46 @@ TABS.auxiliary.initialize = function (callback) {
let modeElement = $('#mode-' + i); let modeElement = $('#mode-' + i);
if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) { if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) {
// if the mode is unused, skip it // if the mode is unused, skip it
modeElement.removeClass('off').removeClass('on'); modeElement.removeClass('off').removeClass('on').removeClass('disabled');
continue; continue;
} }
if (bit_check(CONFIG.mode, i)) { 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 { } 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; hasUsedMode = true;
} }