1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 22:35:17 +03:00

Added disabling of runaway takeoff prevention.

This commit is contained in:
mikeller 2018-02-14 01:32:23 +13:00
parent bf717b27eb
commit 5d760e8735
6 changed files with 55 additions and 31 deletions

View file

@ -369,6 +369,12 @@
"armingEnabled": { "armingEnabled": {
"message": "<strong>Arming Enabled</strong>" "message": "<strong>Arming Enabled</strong>"
}, },
"runawayTakeoffPreventionDisabled": {
"message": "<strong>Runaway Takeoff Prevention temporarily Disabled</strong>"
},
"runawayTakeoffPreventionEnabled": {
"message": "<strong>Runaway Takeoff Prevention Enabled</strong>"
},
"boardInfoReceived": { "boardInfoReceived": {
"message": "Board: <strong>$1</strong>, version: <strong>$2</strong>" "message": "Board: <strong>$1</strong>, version: <strong>$2</strong>"
}, },
@ -1768,10 +1774,10 @@
"message": "Master" "message": "Master"
}, },
"motorsNotice": { "motorsNotice": {
"message": "<strong>Motor Test Mode / Arming Notice:</strong><br />Moving the sliders or arming your craft with the transmitter will cause the motors to <strong>spin up</strong>.<br />In order to prevent injury <strong class=\"message-negative\">remove ALL propellers</strong> before using this feature.<br />" "message": "<strong>Motor Test Mode / Arming Notice:</strong><br />Moving the sliders or arming your craft with the transmitter will cause the motors to <strong>spin up</strong>.<br />In order to prevent injury <strong class=\"message-negative\">remove ALL propellers</strong> before using this feature.<br />Enabling motor test mode will also temporarily disable Runaway Takeoff Prevention, to stop it from disarming the craft when bench testing without propellers.<br />"
}, },
"motorsEnableControl": { "motorsEnableControl": {
"message": "I understand the risks, propellers are removed - Enable motor control and arming." "message": "<strong>I understand the risks</strong>, the propellers are removed - enable motor control and arming, and disable Runaway Takeoff Prevention."
}, },
"sensorsInfo": { "sensorsInfo": {

View file

@ -81,6 +81,8 @@ var FC = {
rateProfile: 0, rateProfile: 0,
boardType: 0, boardType: 0,
armingDisableFlags: 0, armingDisableFlags: 0,
armingDisabled: false,
runawayTakeoffPreventionDisabled: false,
}; };
BF_CONFIG = { BF_CONFIG = {

View file

@ -1525,12 +1525,21 @@ MspHelper.prototype.crunch = function(code) {
break; break;
case MSPCodes.MSP_ARMING_DISABLE: case MSPCodes.MSP_ARMING_DISABLE:
var value; var value;
if (CONFIG.arming_disabled) { if (CONFIG.armingDisabled) {
value = 1; value = 1;
} else { } else {
value = 0; value = 0;
} }
buffer.push8(value); buffer.push8(value);
if (CONFIG.runawayTakeoffPreventionDisabled) {
value = 1;
} else {
value = 0;
}
// This will be ignored if `armingDisabled` is true
buffer.push8(value);
break; break;
default: default:
return false; return false;
@ -2022,13 +2031,19 @@ MspHelper.prototype.sendRxFailConfig = function(onCompleteCallback) {
} }
} }
MspHelper.prototype.setArmingEnabled = function(doEnable, onCompleteCallback) { MspHelper.prototype.setArmingEnabled = function(doEnable, disableRunawayTakeoffPrevention, onCompleteCallback) {
if (semver.gte(CONFIG.apiVersion, "1.37.0") && (doEnable === CONFIG.arming_disabled)) { if (semver.gte(CONFIG.apiVersion, "1.37.0") && (CONFIG.armingDisabled === doEnable || CONFIG.runawayTakeoffPreventionDisabled !== disableRunawayTakeoffPrevention)) {
CONFIG.arming_disabled = !doEnable; CONFIG.armingDisabled = !doEnable;
CONFIG.runawayTakeoffPreventionDisabled = disableRunawayTakeoffPrevention;
MSP.send_message(MSPCodes.MSP_ARMING_DISABLE, mspHelper.crunch(MSPCodes.MSP_ARMING_DISABLE), false, function () { MSP.send_message(MSPCodes.MSP_ARMING_DISABLE, mspHelper.crunch(MSPCodes.MSP_ARMING_DISABLE), false, function () {
if (doEnable) { if (doEnable) {
GUI.log(i18n.getMessage('armingEnabled')); GUI.log(i18n.getMessage('armingEnabled'));
if (disableRunawayTakeoffPrevention) {
GUI.log(i18n.getMessage('runawayTakeoffPreventionDisabled'));
} else {
GUI.log(i18n.getMessage('runawayTakeoffPreventionEnabled'));
}
} else { } else {
GUI.log(i18n.getMessage('armingDisabled')); GUI.log(i18n.getMessage('armingDisabled'));
} }

View file

@ -119,7 +119,8 @@ var serial = {
case 'break': // This seems to be the error that is thrown under NW.js in Windows when the device reboots after typing 'exit' in CLI case 'break': // This seems to be the error that is thrown under NW.js in Windows when the device reboots after typing 'exit' in CLI
case 'device_lost': case 'device_lost':
CONFIG.arming_disabled = false; CONFIG.armingDisabled = false;
CONFIG.runawayTakeoffPreventionDisabled = false;
if (GUI.connected_to || GUI.connecting_to) { if (GUI.connected_to || GUI.connecting_to) {
$('a.connect').click(); $('a.connect').click();

View file

@ -72,7 +72,7 @@ function initializeSerialBackend() {
finishClose(toggleStatus); finishClose(toggleStatus);
} }
mspHelper.setArmingEnabled(true, onFinishCallback); mspHelper.setArmingEnabled(true, false, onFinishCallback);
} }
} }
} }
@ -227,8 +227,8 @@ function onOpen(openInfo) {
MSP.send_message(MSPCodes.MSP_NAME, false, false, function () { MSP.send_message(MSPCodes.MSP_NAME, false, false, function () {
GUI.log(i18n.getMessage('craftNameReceived', [CONFIG.name])); GUI.log(i18n.getMessage('craftNameReceived', [CONFIG.name]));
CONFIG.arming_disabled = false; CONFIG.armingDisabled = false;
mspHelper.setArmingEnabled(false, finishOpen); mspHelper.setArmingEnabled(false, false, finishOpen);
}); });
} else { } else {
finishOpen(); finishOpen();

View file

@ -485,7 +485,7 @@ TABS.motors.initialize = function (callback) {
$('div.sliders input').trigger('input'); $('div.sliders input').trigger('input');
mspHelper.setArmingEnabled(enabled); mspHelper.setArmingEnabled(enabled, enabled);
}).change(); }).change();
var buffering_set_motor = [], var buffering_set_motor = [],