diff --git a/locales/en/messages.json b/locales/en/messages.json index 541c1f1c..10225763 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -369,6 +369,12 @@ "armingEnabled": { "message": "Arming Enabled" }, + "runawayTakeoffPreventionDisabled": { + "message": "Runaway Takeoff Prevention temporarily Disabled" + }, + "runawayTakeoffPreventionEnabled": { + "message": "Runaway Takeoff Prevention Enabled" + }, "boardInfoReceived": { "message": "Board: $1, version: $2" }, @@ -1768,10 +1774,10 @@ "message": "Master" }, "motorsNotice": { - "message": "Motor Test Mode / Arming Notice:
Moving the sliders or arming your craft with the transmitter will cause the motors to spin up.
In order to prevent injury remove ALL propellers before using this feature.
" + "message": "Motor Test Mode / Arming Notice:
Moving the sliders or arming your craft with the transmitter will cause the motors to spin up.
In order to prevent injury remove ALL propellers before using this feature.
Enabling motor test mode will also temporarily disable Runaway Takeoff Prevention, to stop it from disarming the craft when bench testing without propellers.
" }, "motorsEnableControl": { - "message": "I understand the risks, propellers are removed - Enable motor control and arming." + "message": "I understand the risks, the propellers are removed - enable motor control and arming, and disable Runaway Takeoff Prevention." }, "sensorsInfo": { diff --git a/src/js/fc.js b/src/js/fc.js index 7e47e557..d87ca9bd 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -61,26 +61,28 @@ var DEFAULT; var FC = { resetState: function() { CONFIG = { - apiVersion: "0.0.0", - flightControllerIdentifier: '', - flightControllerVersion: '', - version: 0, - buildInfo: '', - multiType: 0, - msp_version: 0, // not specified using semantic versioning - capability: 0, - cycleTime: 0, - i2cError: 0, - activeSensors: 0, - mode: 0, - profile: 0, - uid: [0, 0, 0], - accelerometerTrims: [0, 0], - name: '', - numProfiles: 3, - rateProfile: 0, - boardType: 0, - armingDisableFlags: 0, + apiVersion: "0.0.0", + flightControllerIdentifier: '', + flightControllerVersion: '', + version: 0, + buildInfo: '', + multiType: 0, + msp_version: 0, // not specified using semantic versioning + capability: 0, + cycleTime: 0, + i2cError: 0, + activeSensors: 0, + mode: 0, + profile: 0, + uid: [0, 0, 0], + accelerometerTrims: [0, 0], + name: '', + numProfiles: 3, + rateProfile: 0, + boardType: 0, + armingDisableFlags: 0, + armingDisabled: false, + runawayTakeoffPreventionDisabled: false, }; BF_CONFIG = { diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index a58b5c06..35b0da71 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -1525,12 +1525,21 @@ MspHelper.prototype.crunch = function(code) { break; case MSPCodes.MSP_ARMING_DISABLE: var value; - if (CONFIG.arming_disabled) { + if (CONFIG.armingDisabled) { value = 1; } else { value = 0; } buffer.push8(value); + + if (CONFIG.runawayTakeoffPreventionDisabled) { + value = 1; + } else { + value = 0; + } + // This will be ignored if `armingDisabled` is true + buffer.push8(value); + break; default: return false; @@ -2022,13 +2031,19 @@ MspHelper.prototype.sendRxFailConfig = function(onCompleteCallback) { } } -MspHelper.prototype.setArmingEnabled = function(doEnable, onCompleteCallback) { - if (semver.gte(CONFIG.apiVersion, "1.37.0") && (doEnable === CONFIG.arming_disabled)) { - CONFIG.arming_disabled = !doEnable; +MspHelper.prototype.setArmingEnabled = function(doEnable, disableRunawayTakeoffPrevention, onCompleteCallback) { + if (semver.gte(CONFIG.apiVersion, "1.37.0") && (CONFIG.armingDisabled === doEnable || CONFIG.runawayTakeoffPreventionDisabled !== disableRunawayTakeoffPrevention)) { + CONFIG.armingDisabled = !doEnable; + CONFIG.runawayTakeoffPreventionDisabled = disableRunawayTakeoffPrevention; MSP.send_message(MSPCodes.MSP_ARMING_DISABLE, mspHelper.crunch(MSPCodes.MSP_ARMING_DISABLE), false, function () { if (doEnable) { GUI.log(i18n.getMessage('armingEnabled')); + if (disableRunawayTakeoffPrevention) { + GUI.log(i18n.getMessage('runawayTakeoffPreventionDisabled')); + } else { + GUI.log(i18n.getMessage('runawayTakeoffPreventionEnabled')); + } } else { GUI.log(i18n.getMessage('armingDisabled')); } diff --git a/src/js/serial.js b/src/js/serial.js index 9cc6eedf..2e916e4e 100644 --- a/src/js/serial.js +++ b/src/js/serial.js @@ -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 'device_lost': - CONFIG.arming_disabled = false; + CONFIG.armingDisabled = false; + CONFIG.runawayTakeoffPreventionDisabled = false; if (GUI.connected_to || GUI.connecting_to) { $('a.connect').click(); diff --git a/src/js/serial_backend.js b/src/js/serial_backend.js index 0afbea69..e06208c7 100755 --- a/src/js/serial_backend.js +++ b/src/js/serial_backend.js @@ -72,7 +72,7 @@ function initializeSerialBackend() { 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 () { GUI.log(i18n.getMessage('craftNameReceived', [CONFIG.name])); - CONFIG.arming_disabled = false; - mspHelper.setArmingEnabled(false, finishOpen); + CONFIG.armingDisabled = false; + mspHelper.setArmingEnabled(false, false, finishOpen); }); } else { finishOpen(); diff --git a/src/js/tabs/motors.js b/src/js/tabs/motors.js index 766266a4..265e74fb 100644 --- a/src/js/tabs/motors.js +++ b/src/js/tabs/motors.js @@ -485,7 +485,7 @@ TABS.motors.initialize = function (callback) { $('div.sliders input').trigger('input'); - mspHelper.setArmingEnabled(enabled); + mspHelper.setArmingEnabled(enabled, enabled); }).change(); var buffering_set_motor = [],