Merge pull request #1275 from McGiverGim/disarm_flags_text

Arming disabled flags into text
10.5.x-maintenance
Michael Keller 2019-01-25 09:23:28 +13:00 committed by GitHub
commit 4c5dfe7f8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 167 additions and 19 deletions

View File

@ -737,7 +737,91 @@
"message": "Arming Allowed"
},
"initialSetupArmingDisableFlagsTooltip": {
"message": "List of flags indicating why arming is currently not allowed. The first and most important value corresponds to the number of warning beeps that sound when arming is attempted. Please refer to the Wiki ('Arming Sequence & Safety' page) for a description of what these flags mean."
"message": "List of flags indicating why arming is currently not allowed. Pass the mouse over the flag or refer to the Wiki ('Arming Sequence & Safety' page) for more info."
},
"initialSetupArmingDisableFlagsTooltipNO_GYRO": {
"message": "A gyro was not detected",
"description": "Description of the NO GYRO arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipFAILSAFE": {
"message": "Failsafe is active",
"description": "Description of the FAILSAFE arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipRX_FAILSAFE": {
"message": "No valid receiver signal is detected",
"description": "Description of the RX_FAILSAFE arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipBAD_RX_RECOVERY": {
"message": "Your receiver has just recovered from receiver failsafe but the arm switch is on",
"description": "Description of the BAD_RX_RECOVERY arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipBOXFAILSAFE": {
"message": "The 'FAILSAFE' switch was activated",
"description": "Description of the BOXFAILSAFE arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipRUNAWAY_TAKEOFF": {
"message": "Runway Takeoff Prevention has been triggered",
"description": "Description of the RUNAWAY_TAKEOFF arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipTHROTTLE": {
"message": "Throttle channel is too high",
"description": "Description of the THROTTLE arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipANGLE": {
"message": "Craft is not level (enough)",
"description": "Description of the ANGLE arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipBOOT_GRACE_TIME": {
"message": "Arming too soon after power on",
"description": "Description of the BOOT_GRACE_TIME arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipNOPREARM": {
"message": "Prearm switch is not activated or prearm has not been toggled after disarm",
"description": "Description of the NOPREARM arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipLOAD": {
"message": "System load is too high for safe flight",
"description": "Description of the LOAD arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipCALIBRATING": {
"message": "Sensor calibration is still ongoing",
"description": "Description of the CALIBRATING arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipCLI": {
"message": "CLI is active",
"description": "Description of the CLI arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipCMS_MENU": {
"message": "CMS (config menu) is Active - over OSD or other display -",
"description": "Description of the CMS_MENU arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipOSD_MENU": {
"message": "OSD menu is active",
"description": "Description of the OSD_MENU arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipBST": {
"message": "A Black Sheep Telemetry device (TBS Core Pro for example) disarmed and is preventing arming",
"description": "Description of the BST arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipMSP": {
"message": "MSP connection is active, probably with this Betaflight Configurator",
"description": "Description of the MSP arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipPARALYZE": {
"message": "Paralyze mode has been activated",
"description": "Description of the PARALYZE arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipGPS": {
"message": "GPS rescue mode is configured but required number of satellites has not been fixed",
"description": "Description of the GPS arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipRESC": {
"message": "The 'GPS Rescue' switch was activated",
"description": "Description of the RESC arming disable flag"
},
"initialSetupArmingDisableFlagsTooltipARM_SWITCH": {
"message": "One of the others disarm flags is active when arming",
"description": "Description of the ARM_SWITCH arming disable flag"
},
"initialSetupGPSHead": {
"message": "GPS"

View File

@ -308,4 +308,10 @@
.tab-setup dialog h3 {
margin-bottom: 0.5em;
}
.disarm-flag {
padding-left: 5px;
}
}

View File

@ -81,6 +81,7 @@ var FC = {
numProfiles: 3,
rateProfile: 0,
boardType: 0,
armingDisableCount: 0,
armingDisableFlags: 0,
armingDisabled: false,
runawayTakeoffPreventionDisabled: false,

View File

@ -99,7 +99,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
}
// Read arming disable flags
data.readU8(); // Flag count
CONFIG.armingDisableCount = data.readU8(); // Flag count
CONFIG.armingDisableFlags = data.readU32();
}

85
src/js/tabs/setup.js Executable file → Normal file
View File

@ -59,7 +59,7 @@ TABS.setup.initialize = function (callback) {
self.initializeInstruments();
$('#arming-disable-flag-row').attr('title', i18n.getMessage('initialSetupArmingDisableFlagsTooltip'));
$('#arming-disable-flag').attr('title', i18n.getMessage('initialSetupArmingDisableFlagsTooltip'));
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
if (isExpertModeEnabled()) {
@ -198,21 +198,78 @@ TABS.setup.initialize = function (callback) {
arming_disable_flags_e.hide();
}
function get_slow_data() {
MSP.send_message(MSPCodes.MSP_STATUS, false, false, function() {
var armingString = '';
if (CONFIG.armingDisableFlags == 0) {
armingString = i18n.getMessage('initialSetupArmingAllowed');
// DISARM FLAGS
// We add all the arming/disarming flags available, and show/hide them if needed.
var prepareDisarmFlags = function() {
var disarmFlagElements = ['NO_GYRO',
'FAILSAFE',
'RX_FAILSAFE',
'BAD_RX_RECOVERY',
'BOXFAILSAFE',
'THROTTLE',
'ANGLE',
'BOOT_GRACE_TIME',
'NOPREARM',
'LOAD',
'CALIBRATING',
'CLI',
'CMS_MENU',
'OSD_MENU',
'BST',
'MSP',
];
if (semver.gte(CONFIG.apiVersion, "1.38.0")) {
disarmFlagElements.splice(disarmFlagElements.indexOf('THROTTLE'), 0, 'RUNAWAY_TAKEOFF');
}
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
disarmFlagElements = disarmFlagElements.concat(['PARALYZE',
'GPS']);
}
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
disarmFlagElements.splice(disarmFlagElements.indexOf('OSD_MENU'), 1);
disarmFlagElements = disarmFlagElements.concat(['RESC']);
}
// Always the latest element
disarmFlagElements = disarmFlagElements.concat(['ARM_SWITCH']);
// Arming allowed flag
arming_disable_flags_e.append('<span id="initialSetupArmingAllowed" i18n="initialSetupArmingAllowed" style="display: none;"/>');
// Arming disabled flags
for (var i = 0; i < CONFIG.armingDisableCount; i++) {
// All the known elements but the ARM_SWITCH (it must be always the last element)
if (i < disarmFlagElements.length - 1) {
arming_disable_flags_e.append('<span id="initialSetupArmingDisableFlags' + i + '" class="cf_tip disarm-flag" title="' + i18n.getMessage('initialSetupArmingDisableFlagsTooltip' + disarmFlagElements[i]) + '" style="display: none;">' + disarmFlagElements[i] + '</span>');
// The ARM_SWITCH, always the last element
} else if (i == CONFIG.armingDisableCount - 1) {
arming_disable_flags_e.append('<span id="initialSetupArmingDisableFlags' + i + '" class="cf_tip disarm-flag" title="' + i18n.getMessage('initialSetupArmingDisableFlagsTooltipARM_SWITCH') + '" style="display: none;">ARM_SWITCH</span>');
// Unknown disarm flags
} else {
var flagIndicies = [];
for (var i = 0; i < 32; i++) {
if (CONFIG.armingDisableFlags & (1 << i)) {
flagIndicies.push(i + 1);
}
}
armingString = flagIndicies;
arming_disable_flags_e.append('<span id="initialSetupArmingDisableFlags' + i + '" class="disarm-flag" style="display: none;">' + (i + 1) + '</span>');
}
arming_disable_flags_e.text(armingString);
}
}
prepareDisarmFlags();
function get_slow_data() {
MSP.send_message(MSPCodes.MSP_STATUS, false, false, function() {
$('#initialSetupArmingAllowed').toggle(CONFIG.armingDisableFlags == 0);
for (var i = 0; i < CONFIG.armingDisableCount; i++) {
$('#initialSetupArmingDisableFlags'+i).css('display',(CONFIG.armingDisableFlags & (1 << i)) == 0 ? 'none':'inline-block');
}
});
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {

View File

@ -101,9 +101,9 @@
<div class="spacer_box">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
<tbody>
<tr id="arming-disable-flag-row" class="cf_tip">
<td i18n="initialSetupArmingDisableFlags"></td>
<td class="arming-disable-flags">0</td>
<tr>
<td id="arming-disable-flag" i18n="initialSetupArmingDisableFlags" class="cf_tip"></td>
<td class="arming-disable-flags"></td>
</tr>
<tr>
<td i18n="initialSetupBattery"></td>