mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 01:35:28 +03:00
Fixed failed merge of VCP reboot handling.
This commit is contained in:
parent
f869dd94e7
commit
52fd9642bd
2 changed files with 31 additions and 43 deletions
|
@ -445,12 +445,20 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
function reinitialize() {
|
function reinitialize() {
|
||||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||||
|
|
||||||
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect
|
||||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
$('a.connect').click();
|
||||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
GUI.timeout_add('start_connection',function start_connection() {
|
||||||
TABS.configuration.initialize(false, $('#content').scrollTop());
|
$('a.connect').click();
|
||||||
});
|
},2000);
|
||||||
},1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts
|
} else {
|
||||||
|
|
||||||
|
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||||
|
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
||||||
|
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||||
|
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(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_serial_config);
|
MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_serial_config);
|
||||||
|
@ -465,9 +473,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TABS.configuration.cleanup = function (callback) {
|
||||||
|
|
||||||
|
|
||||||
TABS.configuration.cleanup = function (callback) {
|
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,13 +73,10 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
$('#content').load("./tabs/ports.html", on_tab_loaded_handler);
|
$('#content').load("./tabs/ports.html", on_tab_loaded_handler);
|
||||||
|
|
||||||
|
|
||||||
board_definition = BOARD.find_board_definition(CONFIG.boardIdentifier);
|
board_definition = BOARD.find_board_definition(CONFIG.boardIdentifier);
|
||||||
console.log('Using board definition', board_definition);
|
console.log('Using board definition', board_definition);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_ui() {
|
function update_ui() {
|
||||||
|
|
||||||
|
@ -168,11 +165,6 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
var checkboxId = 'functionCheckbox-' + portIndex + '-' + columnIndex + '-' + i;
|
var checkboxId = 'functionCheckbox-' + portIndex + '-' + columnIndex + '-' + i;
|
||||||
functions_e.prepend('<span class="function"><input type="checkbox" class="togglesmall" id="' + checkboxId + '" value="' + functionName + '" /><label for="' + checkboxId + '"> ' + functionRule.displayName + '</label></span>');
|
functions_e.prepend('<span class="function"><input type="checkbox" class="togglesmall" id="' + checkboxId + '" value="' + functionName + '" /><label for="' + checkboxId + '"> ' + functionRule.displayName + '</label></span>');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (serialPort.functions.indexOf(functionName) >= 0) {
|
if (serialPort.functions.indexOf(functionName) >= 0) {
|
||||||
var checkbox_e = functions_e.find('#' + checkboxId);
|
var checkbox_e = functions_e.find('#' + checkboxId);
|
||||||
checkbox_e.prop("checked", true);
|
checkbox_e.prop("checked", true);
|
||||||
|
@ -219,14 +211,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function on_save_handler() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function on_save_handler() {
|
|
||||||
|
|
||||||
// update configuration based on current ui state
|
// update configuration based on current ui state
|
||||||
SERIAL_CONFIG.ports = [];
|
SERIAL_CONFIG.ports = [];
|
||||||
|
@ -254,12 +239,9 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(),
|
blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(),
|
||||||
identifier: oldSerialPort.identifier
|
identifier: oldSerialPort.identifier
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(serialPort);
|
|
||||||
SERIAL_CONFIG.ports.push(serialPort);
|
SERIAL_CONFIG.ports.push(serialPort);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_SET_CF_SERIAL_CONFIG, MSP.crunch(MSP_codes.MSP_SET_CF_SERIAL_CONFIG), false, save_to_eeprom);
|
MSP.send_message(MSP_codes.MSP_SET_CF_SERIAL_CONFIG, MSP.crunch(MSP_codes.MSP_SET_CF_SERIAL_CONFIG), false, save_to_eeprom);
|
||||||
|
|
||||||
function save_to_eeprom() {
|
function save_to_eeprom() {
|
||||||
|
@ -277,22 +259,23 @@ 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'));
|
||||||
|
|
||||||
var rebootTimeoutDelay = 1500; // seems to be just the right amount of delay to prevent data request timeouts
|
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('waiting_for_bootup', function waiting_for_bootup() {
|
GUI.timeout_add('start_connection',function start_connection() {
|
||||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
$('a.connect').click();
|
||||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
},2000);
|
||||||
TABS.ports.initialize(false, $('#content').scrollTop());
|
} else {
|
||||||
});
|
GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
|
||||||
}, rebootTimeoutDelay);
|
MSP.send_message(MSP_codes.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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TABS.ports.cleanup = function (callback) {
|
TABS.ports.cleanup = function (callback) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue