1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-15 12:25:13 +03:00

fixed reboot sequence

This commit is contained in:
Pawel Spychalski (DzikuVx) 2016-12-23 16:08:42 +01:00
parent 6581da1654
commit 9de6e9d2f1
9 changed files with 91 additions and 106 deletions

View file

@ -56,6 +56,22 @@ var BOARD_DEFINITIONS = [
name: "MotoLab",
identifier: "MOTO",
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 = {
};
BOARD.find_board_definition = function (identifier) {

View file

@ -1,5 +1,7 @@
'use strict';
/*global chrome*/
var serial = {
connectionId: false,
openRequested: false,
@ -291,4 +293,5 @@ var serial = {
this.outputBuffer = [];
this.transmitting = false;
}
};

View file

@ -7,6 +7,45 @@ $(document).ready(function () {
$baud = $('#baud'),
$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(){
var selected_port = $port.find('option:selected');
if (selected_port.data().isManual) {
@ -148,9 +187,6 @@ $(document).ready(function () {
PortUsage.initialize();
});
function onOpen(openInfo) {
if (openInfo) {
// update connected_to

View file

@ -1,5 +1,5 @@
'use strict';
/*global chrome*/
TABS.cli = {
'validateText': "",
'currentLine': "",
@ -163,23 +163,7 @@ TABS.cli.read = function (readInfo) {
CONFIGURATOR.cliValid = false;
GUI.log(chrome.i18n.getMessage('cliReboot'));
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
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
}
GUI.handleReconnect();
}
} else {
// try to catch part of valid CLI enter message

View file

@ -188,29 +188,33 @@
</div>
</div>
<div class="gui_box grey 3d">
<div class="config-section gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="configuration3d"></div>
</div>
<div class="spacer_box">
<div class="number">
<label> <input type="number" name="3ddeadbandlow" step="1" min="1425" max="1500" /> <span
data-i18n="configuration3dDeadbandLow"></span>
<input type="number" id="3ddeadbandlow" name="3ddeadbandlow" step="1" min="1425" max="1500" />
<label for="3ddeadbandlow">
<span data-i18n="configuration3dDeadbandLow"></span>
</label>
</div>
<div class="number">
<label> <input type="number" name="3ddeadbandhigh" step="1" min="1500" max="1575" /> <span
data-i18n="configuration3dDeadbandHigh"></span>
<input type="number" id="3ddeadbandhigh" name="3ddeadbandhigh" step="1" min="1500" max="1575" />
<label for="3ddeadbandhigh">
<span data-i18n="configuration3dDeadbandHigh"></span>
</label>
</div>
<div class="number">
<label> <input type="number" name="3dneutral" step="1" min="1475" max="1525" /> <span
data-i18n="configuration3dNeutral"></span>
<input type="number" id="3dneutral" name="3dneutral" step="1" min="1475" max="1525" />
<label for="3dneutral">
<span data-i18n="configuration3dNeutral"></span>
</label>
</div>
<div class="number 3ddeadbandthrottle" >
<label> <input type="number" name="3ddeadbandthrottle" step="1" min="0" max="1000" /> <span
data-i18n="configuration3dDeadbandThrottle"></span>
<div id="deadband-3d-throttle-container" class="number">
<input type="number" id="3ddeadbandthrottle" name="3ddeadbandthrottle" step="1" min="0" max="1000" />
<label for="3ddeadbandthrottle">
<span data-i18n="configuration3dDeadbandThrottle"></span>
</label>
</div>
</div>

View file

@ -72,8 +72,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
//Update Analog/Battery Data
function load_analog() {
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
$('input[name="batteryvoltage"]').val([ANALOG.voltage.toFixed(1)]);
$('input[name="batterycurrent"]').val([ANALOG.amperage.toFixed(2)]);
$('#batteryvoltage').val([ANALOG.voltage.toFixed(1)]);
$('#batterycurrent').val([ANALOG.amperage.toFixed(2)]);
});
}
@ -114,7 +114,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
var feature_tip_html = '';
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') {
@ -543,13 +543,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$(".requires-v1_5").hide();
}
$('input[name="3ddeadbandlow"]').val(_3D.deadband3d_low);
$('input[name="3ddeadbandhigh"]').val(_3D.deadband3d_high);
$('input[name="3dneutral"]').val(_3D.neutral3d);
$('#3ddeadbandlow').val(_3D.deadband3d_low);
$('#3ddeadbandhigh').val(_3D.deadband3d_high);
$('#3dneutral').val(_3D.neutral3d);
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
$('input[name="3ddeadbandthrottle"]').val(_3D.deadband3d_throttle);
$('#3ddeadbandthrottle').val(_3D.deadband3d_throttle);
} else {
$('.3ddeadbandthrottle').hide();
$('#deadband-3d-throttle-container').remove();
}
$('input[type="checkbox"].feature', features_e).change(function () {
@ -615,11 +615,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
BF_CONFIG.currentoffset = parseInt($('#currentoffset').val());
MISC.multiwiicurrentoutput = ~~$('#multiwiicurrentoutput').is(':checked'); // ~~ boolean to decimal conversion
_3D.deadband3d_low = parseInt($('input[name="3ddeadbandlow"]').val());
_3D.deadband3d_high = parseInt($('input[name="3ddeadbandhigh"]').val());
_3D.neutral3d = parseInt($('input[name="3dneutral"]').val());
_3D.deadband3d_low = parseInt($('#3ddeadbandlow').val());
_3D.deadband3d_high = parseInt($('#3ddeadbandhigh').val());
_3D.neutral3d = parseInt($('#3dneutral').val());
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() {
//noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
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
}
GUI.handleReconnect($('.tab_configuration a'));
}
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_misc);

View file

@ -348,21 +348,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
function reinitialize() {
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
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
}
GUI.handleReconnect($('.tab_failsafe a'));
}
if(apiVersionGte1_15_0) {

View file

@ -51,21 +51,7 @@ TABS.onboard_logging.initialize = function (callback) {
function reinitialize() {
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
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
}
GUI.handleReconnect($('.tab_onboard_logging a'));
}
function load_html() {

View file

@ -278,20 +278,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
function on_reboot_success_handler() {
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
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
}
GUI.handleReconnect($('.tab_ports a'));
}
}
};