mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-18 22:05:13 +03:00
Added arming enable to the 'motor test enable' switch.
This commit is contained in:
parent
a791255d46
commit
808c33860a
4 changed files with 47 additions and 39 deletions
|
@ -1495,10 +1495,10 @@
|
|||
"message": "Master"
|
||||
},
|
||||
"motorsNotice": {
|
||||
"message": "<strong>Motor Test Mode Notice:</strong><br />Moving the sliders will cause the motors to <strong>spin up</strong>.<br />In order to prevent injury <strong style=\"color: red\">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 style=\"color: red\">remove ALL propellers</strong> before using this feature.<br />"
|
||||
},
|
||||
"motorsEnableControl": {
|
||||
"message": "I understand the risks, propellers are removed - Enable motor control."
|
||||
"message": "I understand the risks, propellers are removed - Enable motor control and arming."
|
||||
},
|
||||
|
||||
"sensorsInfo": {
|
||||
|
|
|
@ -2022,6 +2022,28 @@ 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;
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_ARMING_DISABLE, mspHelper.crunch(MSPCodes.MSP_ARMING_DISABLE), false, function () {
|
||||
if (doEnable) {
|
||||
GUI.log(chrome.i18n.getMessage('armingEnabled'));
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('armingDisabled'));
|
||||
}
|
||||
|
||||
if (onCompleteCallback) {
|
||||
onCompleteCallback();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (onCompleteCallback) {
|
||||
onCompleteCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MSP.SDCARD_STATE_NOT_PRESENT = 0; //TODO, move these to better place
|
||||
MSP.SDCARD_STATE_FATAL = 1;
|
||||
MSP.SDCARD_STATE_CARD_INIT = 2;
|
||||
|
|
|
@ -59,7 +59,6 @@ $(document).ready(function () {
|
|||
$('div#port-picker #port, div#port-picker #baud, div#port-picker #delay').prop('disabled', true);
|
||||
$('div.connect_controls a.connect_state').text(chrome.i18n.getMessage('connecting'));
|
||||
|
||||
|
||||
serial.connect(selected_port, {bitrate: selected_baud}, onOpen);
|
||||
|
||||
toggleStatus();
|
||||
|
@ -69,17 +68,11 @@ $(document).ready(function () {
|
|||
GUI.tab_switch_cleanup();
|
||||
GUI.tab_switch_in_progress = false;
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.37.0") && CONFIG.arming_disabled) {
|
||||
CONFIG.arming_disabled = false;
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_ARMING_DISABLE, mspHelper.crunch(MSPCodes.MSP_ARMING_DISABLE), false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('armingEnabled'));
|
||||
|
||||
finishClose(toggleStatus);
|
||||
});
|
||||
} else {
|
||||
function onFinishCallback() {
|
||||
finishClose(toggleStatus);
|
||||
}
|
||||
|
||||
mspHelper.setArmingEnabled(true, onFinishCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,17 +227,8 @@ function onOpen(openInfo) {
|
|||
MSP.send_message(MSPCodes.MSP_NAME, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('craftNameReceived', [CONFIG.name]));
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
|
||||
CONFIG.arming_disabled = true;
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_ARMING_DISABLE, mspHelper.crunch(MSPCodes.MSP_ARMING_DISABLE), false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('armingDisabled'));
|
||||
|
||||
finishOpen();
|
||||
});
|
||||
} else {
|
||||
finishOpen();
|
||||
}
|
||||
CONFIG.arming_disabled = false;
|
||||
mspHelper.setArmingEnabled(false, finishOpen);
|
||||
});
|
||||
} else {
|
||||
finishOpen();
|
||||
|
|
|
@ -210,8 +210,7 @@ TABS.motors.initialize = function (callback) {
|
|||
self.escProtocolIsDshot = false;
|
||||
}
|
||||
|
||||
$('#motorsEnableTestMode').prop('checked', false)
|
||||
.prop('disabled', true);
|
||||
$('#motorsEnableTestMode').prop('checked', false);
|
||||
|
||||
update_model(MIXER_CONFIG.mixer);
|
||||
|
||||
|
@ -461,10 +460,8 @@ TABS.motors.initialize = function (callback) {
|
|||
}
|
||||
}
|
||||
|
||||
setSlidersDefault();
|
||||
|
||||
$('#motorsEnableTestMode').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
function setSlidersEnabled(isEnabled) {
|
||||
if (isEnabled && !self.armed) {
|
||||
$('div.sliders input').slice(0, number_of_valid_outputs).prop('disabled', false);
|
||||
|
||||
// unlock master slider
|
||||
|
@ -477,6 +474,18 @@ TABS.motors.initialize = function (callback) {
|
|||
}
|
||||
|
||||
$('div.sliders input').trigger('input');
|
||||
}
|
||||
|
||||
setSlidersDefault();
|
||||
|
||||
$('#motorsEnableTestMode').change(function () {
|
||||
var enabled = $(this).is(':checked');
|
||||
|
||||
setSlidersEnabled(enabled);
|
||||
|
||||
$('div.sliders input').trigger('input');
|
||||
|
||||
mspHelper.setArmingEnabled(enabled);
|
||||
}).change();
|
||||
|
||||
var buffering_set_motor = [],
|
||||
|
@ -530,9 +539,8 @@ TABS.motors.initialize = function (callback) {
|
|||
}
|
||||
|
||||
if (motors_running) {
|
||||
if (!self.armed) {
|
||||
$('#motorsEnableTestMode').prop('checked', true).change();
|
||||
}
|
||||
|
||||
// motors are running adjust sliders to current values
|
||||
|
||||
var sliders = $('div.sliders input:not(.master)');
|
||||
|
@ -607,15 +615,9 @@ TABS.motors.initialize = function (callback) {
|
|||
//keep the following here so at least we get a visual cue of our motor setup
|
||||
update_arm_status();
|
||||
|
||||
if (self.armed) {
|
||||
$('#motorsEnableTestMode').prop('disabled', true)
|
||||
.prop('checked', false);
|
||||
} else {
|
||||
$('#motorsEnableTestMode').prop('disabled', false);
|
||||
}
|
||||
|
||||
if (previousArmState != self.armed) {
|
||||
console.log('arm state change detected');
|
||||
|
||||
$('#motorsEnableTestMode').change();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue