mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 20:35:19 +03:00
fixed reboot sequence
This commit is contained in:
parent
6581da1654
commit
9de6e9d2f1
9 changed files with 91 additions and 106 deletions
17
js/boards.js
17
js/boards.js
|
@ -56,6 +56,22 @@ var BOARD_DEFINITIONS = [
|
||||||
name: "MotoLab",
|
name: "MotoLab",
|
||||||
identifier: "MOTO",
|
identifier: "MOTO",
|
||||||
vcp: true
|
vcp: true
|
||||||
|
}, {
|
||||||
|
name: "Omnibus",
|
||||||
|
identifier: "OMNI",
|
||||||
|
vcp: true
|
||||||
|
}, {
|
||||||
|
name: "Airbot F4",
|
||||||
|
identifier: "ABF4",
|
||||||
|
vcp: true
|
||||||
|
}, {
|
||||||
|
name: "Revolution",
|
||||||
|
identifier: "REVO",
|
||||||
|
vcp: true
|
||||||
|
}, {
|
||||||
|
name: "Omnibus F4",
|
||||||
|
identifier: "OBF4",
|
||||||
|
vcp: true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -66,7 +82,6 @@ var DEFAULT_BOARD_DEFINITION = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var BOARD = {
|
var BOARD = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BOARD.find_board_definition = function (identifier) {
|
BOARD.find_board_definition = function (identifier) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/*global chrome*/
|
||||||
|
|
||||||
var serial = {
|
var serial = {
|
||||||
connectionId: false,
|
connectionId: false,
|
||||||
openRequested: false,
|
openRequested: false,
|
||||||
|
@ -291,4 +293,5 @@ var serial = {
|
||||||
this.outputBuffer = [];
|
this.outputBuffer = [];
|
||||||
this.transmitting = false;
|
this.transmitting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
|
@ -7,6 +7,45 @@ $(document).ready(function () {
|
||||||
$baud = $('#baud'),
|
$baud = $('#baud'),
|
||||||
$portOverride = $('#port-override');
|
$portOverride = $('#port-override');
|
||||||
|
|
||||||
|
GUI.handleReconnect = function ($tabElement) {
|
||||||
|
if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect
|
||||||
|
|
||||||
|
/*
|
||||||
|
Disconnect
|
||||||
|
*/
|
||||||
|
setTimeout(function () {
|
||||||
|
$('a.connect').click();
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Connect again
|
||||||
|
*/
|
||||||
|
setTimeout(function start_connection() {
|
||||||
|
$('a.connect').click();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Open configuration tab
|
||||||
|
*/
|
||||||
|
if ($tabElement != null) {
|
||||||
|
setTimeout(function () {
|
||||||
|
$tabElement.click();
|
||||||
|
}, 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 5000);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||||
|
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
||||||
|
//noinspection JSUnresolvedVariable
|
||||||
|
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||||
|
//noinspection JSValidateTypes
|
||||||
|
TABS.configuration.initialize(false, $('#content').scrollTop());
|
||||||
|
});
|
||||||
|
},1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
GUI.updateManualPortVisibility = function(){
|
GUI.updateManualPortVisibility = function(){
|
||||||
var selected_port = $port.find('option:selected');
|
var selected_port = $port.find('option:selected');
|
||||||
if (selected_port.data().isManual) {
|
if (selected_port.data().isManual) {
|
||||||
|
@ -148,9 +187,6 @@ $(document).ready(function () {
|
||||||
PortUsage.initialize();
|
PortUsage.initialize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function onOpen(openInfo) {
|
function onOpen(openInfo) {
|
||||||
if (openInfo) {
|
if (openInfo) {
|
||||||
// update connected_to
|
// update connected_to
|
||||||
|
|
20
tabs/cli.js
20
tabs/cli.js
|
@ -1,5 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
/*global chrome*/
|
||||||
TABS.cli = {
|
TABS.cli = {
|
||||||
'validateText': "",
|
'validateText': "",
|
||||||
'currentLine': "",
|
'currentLine': "",
|
||||||
|
@ -163,23 +163,7 @@ TABS.cli.read = function (readInfo) {
|
||||||
CONFIGURATOR.cliValid = false;
|
CONFIGURATOR.cliValid = false;
|
||||||
GUI.log(chrome.i18n.getMessage('cliReboot'));
|
GUI.log(chrome.i18n.getMessage('cliReboot'));
|
||||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||||
|
GUI.handleReconnect();
|
||||||
if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect
|
|
||||||
$('a.connect').click();
|
|
||||||
GUI.timeout_add('start_connection',function start_connection() {
|
|
||||||
$('a.connect').click();
|
|
||||||
},2500);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
|
||||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
|
||||||
if (!GUI.tab_switch_in_progress) {
|
|
||||||
$('#tabs ul.mode-connected .tab_setup a').click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// try to catch part of valid CLI enter message
|
// try to catch part of valid CLI enter message
|
||||||
|
|
|
@ -188,29 +188,33 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="gui_box grey 3d">
|
<div class="config-section gui_box grey">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" data-i18n="configuration3d"></div>
|
<div class="spacer_box_title" data-i18n="configuration3d"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer_box">
|
<div class="spacer_box">
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="3ddeadbandlow" step="1" min="1425" max="1500" /> <span
|
<input type="number" id="3ddeadbandlow" name="3ddeadbandlow" step="1" min="1425" max="1500" />
|
||||||
data-i18n="configuration3dDeadbandLow"></span>
|
<label for="3ddeadbandlow">
|
||||||
|
<span data-i18n="configuration3dDeadbandLow"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="3ddeadbandhigh" step="1" min="1500" max="1575" /> <span
|
<input type="number" id="3ddeadbandhigh" name="3ddeadbandhigh" step="1" min="1500" max="1575" />
|
||||||
data-i18n="configuration3dDeadbandHigh"></span>
|
<label for="3ddeadbandhigh">
|
||||||
|
<span data-i18n="configuration3dDeadbandHigh"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="3dneutral" step="1" min="1475" max="1525" /> <span
|
<input type="number" id="3dneutral" name="3dneutral" step="1" min="1475" max="1525" />
|
||||||
data-i18n="configuration3dNeutral"></span>
|
<label for="3dneutral">
|
||||||
|
<span data-i18n="configuration3dNeutral"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="number 3ddeadbandthrottle" >
|
<div id="deadband-3d-throttle-container" class="number">
|
||||||
<label> <input type="number" name="3ddeadbandthrottle" step="1" min="0" max="1000" /> <span
|
<input type="number" id="3ddeadbandthrottle" name="3ddeadbandthrottle" step="1" min="0" max="1000" />
|
||||||
data-i18n="configuration3dDeadbandThrottle"></span>
|
<label for="3ddeadbandthrottle">
|
||||||
|
<span data-i18n="configuration3dDeadbandThrottle"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -72,8 +72,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
//Update Analog/Battery Data
|
//Update Analog/Battery Data
|
||||||
function load_analog() {
|
function load_analog() {
|
||||||
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
|
||||||
$('input[name="batteryvoltage"]').val([ANALOG.voltage.toFixed(1)]);
|
$('#batteryvoltage').val([ANALOG.voltage.toFixed(1)]);
|
||||||
$('input[name="batterycurrent"]').val([ANALOG.amperage.toFixed(2)]);
|
$('#batterycurrent').val([ANALOG.amperage.toFixed(2)]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
var feature_tip_html = '';
|
var feature_tip_html = '';
|
||||||
if (features[i].haveTip) {
|
if (features[i].haveTip) {
|
||||||
feature_tip_html = '<div class="helpicon cf_tip" i18n_title="feature' + features[i].name + 'Tip"></div>';
|
feature_tip_html = '<div class="helpicon cf_tip" data-i18n_title="feature' + features[i].name + 'Tip"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (features[i].mode === 'group') {
|
if (features[i].mode === 'group') {
|
||||||
|
@ -543,13 +543,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$(".requires-v1_5").hide();
|
$(".requires-v1_5").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('input[name="3ddeadbandlow"]').val(_3D.deadband3d_low);
|
$('#3ddeadbandlow').val(_3D.deadband3d_low);
|
||||||
$('input[name="3ddeadbandhigh"]').val(_3D.deadband3d_high);
|
$('#3ddeadbandhigh').val(_3D.deadband3d_high);
|
||||||
$('input[name="3dneutral"]').val(_3D.neutral3d);
|
$('#3dneutral').val(_3D.neutral3d);
|
||||||
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
|
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
|
||||||
$('input[name="3ddeadbandthrottle"]').val(_3D.deadband3d_throttle);
|
$('#3ddeadbandthrottle').val(_3D.deadband3d_throttle);
|
||||||
} else {
|
} else {
|
||||||
$('.3ddeadbandthrottle').hide();
|
$('#deadband-3d-throttle-container').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('input[type="checkbox"].feature', features_e).change(function () {
|
$('input[type="checkbox"].feature', features_e).change(function () {
|
||||||
|
@ -615,11 +615,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
BF_CONFIG.currentoffset = parseInt($('#currentoffset').val());
|
BF_CONFIG.currentoffset = parseInt($('#currentoffset').val());
|
||||||
MISC.multiwiicurrentoutput = ~~$('#multiwiicurrentoutput').is(':checked'); // ~~ boolean to decimal conversion
|
MISC.multiwiicurrentoutput = ~~$('#multiwiicurrentoutput').is(':checked'); // ~~ boolean to decimal conversion
|
||||||
|
|
||||||
_3D.deadband3d_low = parseInt($('input[name="3ddeadbandlow"]').val());
|
_3D.deadband3d_low = parseInt($('#3ddeadbandlow').val());
|
||||||
_3D.deadband3d_high = parseInt($('input[name="3ddeadbandhigh"]').val());
|
_3D.deadband3d_high = parseInt($('#3ddeadbandhigh').val());
|
||||||
_3D.neutral3d = parseInt($('input[name="3dneutral"]').val());
|
_3D.neutral3d = parseInt($('#3dneutral').val());
|
||||||
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
|
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
|
||||||
_3D.deadband3d_throttle = ($('input[name="3ddeadbandthrottle"]').val());
|
_3D.deadband3d_throttle = ($('#3ddeadbandthrottle').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -729,23 +729,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
function reinitialize() {
|
function reinitialize() {
|
||||||
//noinspection JSUnresolvedVariable
|
//noinspection JSUnresolvedVariable
|
||||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||||
|
GUI.handleReconnect($('.tab_configuration a'));
|
||||||
if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect
|
|
||||||
$('a.connect').click();
|
|
||||||
GUI.timeout_add('start_connection',function start_connection() {
|
|
||||||
$('a.connect').click();
|
|
||||||
},2500);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
|
||||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
|
||||||
//noinspection JSUnresolvedVariable
|
|
||||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
|
||||||
//noinspection JSValidateTypes
|
|
||||||
TABS.configuration.initialize(false, $('#content').scrollTop());
|
|
||||||
});
|
|
||||||
},1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_misc);
|
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_misc);
|
||||||
|
|
|
@ -348,21 +348,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
function reinitialize() {
|
function reinitialize() {
|
||||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||||
|
GUI.handleReconnect($('.tab_failsafe a'));
|
||||||
if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect
|
|
||||||
$('a.connect').click();
|
|
||||||
GUI.timeout_add('start_connection',function start_connection() {
|
|
||||||
$('a.connect').click();
|
|
||||||
},2500);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
|
||||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
|
||||||
TABS.failsafe.initialize(false, $('#content').scrollTop());
|
|
||||||
});
|
|
||||||
},1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(apiVersionGte1_15_0) {
|
if(apiVersionGte1_15_0) {
|
||||||
|
|
|
@ -51,21 +51,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
||||||
|
|
||||||
function reinitialize() {
|
function reinitialize() {
|
||||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||||
|
GUI.handleReconnect($('.tab_onboard_logging a'));
|
||||||
if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect
|
|
||||||
$('a.connect').click();
|
|
||||||
GUI.timeout_add('start_connection',function start_connection() {
|
|
||||||
$('a.connect').click();
|
|
||||||
},2000);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
|
||||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
|
||||||
TABS.onboard_logging.initialize(false, $('#content').scrollTop());
|
|
||||||
});
|
|
||||||
},1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_html() {
|
function load_html() {
|
||||||
|
|
|
@ -278,20 +278,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
function on_reboot_success_handler() {
|
function on_reboot_success_handler() {
|
||||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||||
|
GUI.handleReconnect($('.tab_ports a'));
|
||||||
if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect
|
|
||||||
$('a.connect').click();
|
|
||||||
GUI.timeout_add('start_connection',function start_connection() {
|
|
||||||
$('a.connect').click();
|
|
||||||
},2500);
|
|
||||||
} else {
|
|
||||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
|
||||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
|
||||||
TABS.ports.initialize(false, $('#content').scrollTop());
|
|
||||||
});
|
|
||||||
}, 1500); // seems to be just the right amount of delay to prevent data request timeouts
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue