1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Merge pull request #1203 from timman2er/change_connect_to_configure

change firmware flasher" to "firmware updater" and move button
This commit is contained in:
Michael Keller 2018-10-08 01:02:20 +13:00 committed by GitHub
commit 8036ff3b02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 121 additions and 4 deletions

View file

@ -78,6 +78,7 @@ function setupAnalytics(result) {
}
$('.connect_b a.connect').removeClass('disabled');
$('.firmware_b a.flash').removeClass('disabled');
}
//Process to execute to real start the app
@ -149,7 +150,14 @@ function startProcess() {
return;
}
if (GUI.allowedTabs.indexOf(tab) < 0) {
if (GUI.allowedTabs.indexOf(tab) < 0 && tabName == "Firmware Flasher") {
if (GUI.connected_to || GUI.connecting_to) {
$('a.connect').click();
} else {
self.disconnect();
}
$('div.open_firmware_flasher a.flash').click();
} else if (GUI.allowedTabs.indexOf(tab) < 0) {
GUI.log(i18n.getMessage('tabSwitchUpgradeRequired', [tabName]));
return;
}
@ -164,6 +172,11 @@ function startProcess() {
GUI.tab_switch_in_progress = true;
GUI.tab_switch_cleanup(function () {
// disable active firmware flasher if it was active
if ($('div#flashbutton a.flash_state').hasClass('active') && $('div#flashbutton a.flash').addClass('active')) {
$('div#flashbutton a.flash_state').removeClass('active');
$('div#flashbutton a.flash').removeClass('active');
}
// disable previously active tab highlight
$('li', ui_tabs).removeClass('active');

View file

@ -67,6 +67,10 @@ function initializeSerialBackend() {
toggleStatus();
} else {
if ($('div#flashbutton a.flash_state').hasClass('active') && $('div#flashbutton a.flash').hasClass('active')) {
$('div#flashbutton a.flash_state').removeClass('active');
$('div#flashbutton a.flash').removeClass('active');
}
GUI.timeout_kill_all();
GUI.interval_kill_all();
GUI.tab_switch_cleanup();
@ -82,6 +86,23 @@ function initializeSerialBackend() {
}
});
$('div.open_firmware_flasher a.flash').click(function () {
if ($('div#flashbutton a.flash_state').hasClass('active') && $('div#flashbutton a.flash').hasClass('active')) {
$('div#flashbutton a.flash_state').removeClass('active');
$('div#flashbutton a.flash').removeClass('active');
document.getElementById("tab_landing").style.display = "block";
document.getElementById("tab_help").style.display = "block";
$('#tabs ul.mode-disconnected .tab_landing a').click();
} else {
$('#tabs ul.mode-disconnected .tab_firmware_flasher a').click();
$('div.open_firmware_flasher a.flash_state').text(i18n.getMessage('flashTab'));
$('div#flashbutton a.flash_state').addClass('active');
$('div#flashbutton a.flash').addClass('active');
document.getElementById("tab_landing").style.display = "none";
document.getElementById("tab_help").style.display = "none";
}
});
// auto-connect
chrome.storage.local.get('auto_connect', function (result) {
if (result.auto_connect === 'undefined' || result.auto_connect) {
@ -337,6 +358,10 @@ function connectCli() {
}
function onConnect() {
if ($('div#flashbutton a.flash_state').hasClass('active') && $('div#flashbutton a.flash').hasClass('active')) {
$('div#flashbutton a.flash_state').removeClass('active');
$('div#flashbutton a.flash').removeClass('active');
}
GUI.timeout_remove('connecting'); // kill connecting timer
$('div#connectbutton a.connect_state').text(i18n.getMessage('disconnect')).addClass('active');
$('div#connectbutton a.connect').addClass('active');