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"
|
"message": "Master"
|
||||||
},
|
},
|
||||||
"motorsNotice": {
|
"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": {
|
"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": {
|
"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_NOT_PRESENT = 0; //TODO, move these to better place
|
||||||
MSP.SDCARD_STATE_FATAL = 1;
|
MSP.SDCARD_STATE_FATAL = 1;
|
||||||
MSP.SDCARD_STATE_CARD_INIT = 2;
|
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#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'));
|
$('div.connect_controls a.connect_state').text(chrome.i18n.getMessage('connecting'));
|
||||||
|
|
||||||
|
|
||||||
serial.connect(selected_port, {bitrate: selected_baud}, onOpen);
|
serial.connect(selected_port, {bitrate: selected_baud}, onOpen);
|
||||||
|
|
||||||
toggleStatus();
|
toggleStatus();
|
||||||
|
@ -69,17 +68,11 @@ $(document).ready(function () {
|
||||||
GUI.tab_switch_cleanup();
|
GUI.tab_switch_cleanup();
|
||||||
GUI.tab_switch_in_progress = false;
|
GUI.tab_switch_in_progress = false;
|
||||||
|
|
||||||
if (semver.gte(CONFIG.apiVersion, "1.37.0") && CONFIG.arming_disabled) {
|
function onFinishCallback() {
|
||||||
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 {
|
|
||||||
finishClose(toggleStatus);
|
finishClose(toggleStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mspHelper.setArmingEnabled(true, onFinishCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,17 +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(chrome.i18n.getMessage('craftNameReceived', [CONFIG.name]));
|
GUI.log(chrome.i18n.getMessage('craftNameReceived', [CONFIG.name]));
|
||||||
|
|
||||||
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
|
CONFIG.arming_disabled = false;
|
||||||
CONFIG.arming_disabled = true;
|
mspHelper.setArmingEnabled(false, finishOpen);
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_ARMING_DISABLE, mspHelper.crunch(MSPCodes.MSP_ARMING_DISABLE), false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('armingDisabled'));
|
|
||||||
|
|
||||||
finishOpen();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
finishOpen();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
finishOpen();
|
finishOpen();
|
||||||
|
|
|
@ -210,8 +210,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
self.escProtocolIsDshot = false;
|
self.escProtocolIsDshot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#motorsEnableTestMode').prop('checked', false)
|
$('#motorsEnableTestMode').prop('checked', false);
|
||||||
.prop('disabled', true);
|
|
||||||
|
|
||||||
update_model(MIXER_CONFIG.mixer);
|
update_model(MIXER_CONFIG.mixer);
|
||||||
|
|
||||||
|
@ -461,10 +460,8 @@ TABS.motors.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setSlidersDefault();
|
function setSlidersEnabled(isEnabled) {
|
||||||
|
if (isEnabled && !self.armed) {
|
||||||
$('#motorsEnableTestMode').change(function () {
|
|
||||||
if ($(this).is(':checked')) {
|
|
||||||
$('div.sliders input').slice(0, number_of_valid_outputs).prop('disabled', false);
|
$('div.sliders input').slice(0, number_of_valid_outputs).prop('disabled', false);
|
||||||
|
|
||||||
// unlock master slider
|
// unlock master slider
|
||||||
|
@ -477,6 +474,18 @@ TABS.motors.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$('div.sliders input').trigger('input');
|
$('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();
|
}).change();
|
||||||
|
|
||||||
var buffering_set_motor = [],
|
var buffering_set_motor = [],
|
||||||
|
@ -530,9 +539,8 @@ TABS.motors.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (motors_running) {
|
if (motors_running) {
|
||||||
if (!self.armed) {
|
$('#motorsEnableTestMode').prop('checked', true).change();
|
||||||
$('#motorsEnableTestMode').prop('checked', true).change();
|
|
||||||
}
|
|
||||||
// motors are running adjust sliders to current values
|
// motors are running adjust sliders to current values
|
||||||
|
|
||||||
var sliders = $('div.sliders input:not(.master)');
|
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
|
//keep the following here so at least we get a visual cue of our motor setup
|
||||||
update_arm_status();
|
update_arm_status();
|
||||||
|
|
||||||
if (self.armed) {
|
|
||||||
$('#motorsEnableTestMode').prop('disabled', true)
|
|
||||||
.prop('checked', false);
|
|
||||||
} else {
|
|
||||||
$('#motorsEnableTestMode').prop('disabled', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (previousArmState != self.armed) {
|
if (previousArmState != self.armed) {
|
||||||
console.log('arm state change detected');
|
console.log('arm state change detected');
|
||||||
|
|
||||||
$('#motorsEnableTestMode').change();
|
$('#motorsEnableTestMode').change();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue