mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-20 14:55:15 +03:00
Merge pull request #1121 from atomgomba/feature-remember-last-tab
Add option to reopen last tab on connect
This commit is contained in:
commit
c5dfaea1a8
9 changed files with 49 additions and 5 deletions
|
@ -321,5 +321,15 @@ GUI_control.prototype.content_ready = function (callback) {
|
|||
if (callback) callback();
|
||||
}
|
||||
|
||||
GUI_control.prototype.selectDefaultTabWhenConnected = function() {
|
||||
chrome.storage.local.get(['rememberLastTab', 'lastTab'], function (result) {
|
||||
if (!(result.rememberLastTab && !!result.lastTab)) {
|
||||
$('#tabs ul.mode-connected .tab_setup a').click();
|
||||
return;
|
||||
}
|
||||
$("#tabs ul.mode-connected ." + result.lastTab + " a").click();
|
||||
});
|
||||
};
|
||||
|
||||
// initialize object into GUI variable
|
||||
var GUI = new GUI_control();
|
||||
|
|
|
@ -86,6 +86,13 @@ function startProcess() {
|
|||
return;
|
||||
}
|
||||
|
||||
$("#tabs ul.mode-connected li").click(function() {
|
||||
// store the first class of the current tab (omit things like ".active")
|
||||
chrome.storage.local.set({
|
||||
lastTab: $(this).attr("class").split(' ')[0]
|
||||
});
|
||||
});
|
||||
|
||||
GUI.tab_switch_in_progress = true;
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
|
@ -217,6 +224,13 @@ function startProcess() {
|
|||
}).change();
|
||||
});
|
||||
|
||||
chrome.storage.local.get('rememberLastTab', function (result) {
|
||||
$('div.rememberLastTab input')
|
||||
.prop('checked', !!result.rememberLastTab)
|
||||
.change(function() { chrome.storage.local.set({rememberLastTab: $(this).is(':checked')}) })
|
||||
.change();
|
||||
});
|
||||
|
||||
if (GUI.operating_system !== 'ChromeOS') {
|
||||
chrome.storage.local.get('checkForConfiguratorUnstableVersions', function (result) {
|
||||
if (result.checkForConfiguratorUnstableVersions) {
|
||||
|
|
|
@ -299,7 +299,7 @@ function finishOpen() {
|
|||
|
||||
onConnect();
|
||||
|
||||
$('#tabs ul.mode-connected .tab_setup a').click();
|
||||
GUI.selectDefaultTabWhenConnected();
|
||||
}
|
||||
|
||||
function connectCli() {
|
||||
|
|
|
@ -45,7 +45,11 @@ TABS.motors.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function load_motor_data() {
|
||||
MSP.send_message(MSPCodes.MSP_MOTOR, false, false, load_html);
|
||||
MSP.send_message(MSPCodes.MSP_MOTOR, false, false, load_mixer_config);
|
||||
}
|
||||
|
||||
function load_mixer_config() {
|
||||
MSP.send_message(MSPCodes.MSP_MIXER_CONFIG, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
|
|
|
@ -39,9 +39,13 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}).then(function() {
|
||||
return MSP.promise(MSPCodes.MSP_RC_DEADBAND);
|
||||
}).then(function() {
|
||||
$('#content').load("./tabs/pid_tuning.html", process_html);
|
||||
MSP.send_message(MSPCodes.MSP_MIXER_CONFIG, false, false, load_html);
|
||||
});
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/pid_tuning.html", process_html);
|
||||
}
|
||||
|
||||
function pid_and_rc_to_form() {
|
||||
self.setProfile();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
||||
|
|
|
@ -40,7 +40,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function load_rx_config() {
|
||||
var next_callback = load_html;
|
||||
var next_callback = load_mixer_config;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, next_callback);
|
||||
} else {
|
||||
|
@ -48,6 +48,10 @@ TABS.receiver.initialize = function (callback) {
|
|||
}
|
||||
}
|
||||
|
||||
function load_mixer_config() {
|
||||
MSP.send_message(MSPCodes.MSP_MIXER_CONFIG, false, false, load_html);
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/receiver.html", process_html);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue