mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 11:29:53 +03:00
Fix profile change not working
Initially, I thought that the profiles were not changing when you selected a new profile from the select box. It turns out that this was only happening after setting up from the defaults dialog. The problem was that the `periodicStatusUpdater` was being stopped to perform the parameter upload. But not re-started. I added a function to resume the updater, and everything works as it should. I made a few other changes: - Tidied up the setting of the parameters for each profile - Added specific `set` profile messages, rather than `loaded` being repeated - Only show messages for the profiles that have changed, not all of them
This commit is contained in:
parent
45e7e41b96
commit
c0e02494f6
7 changed files with 60 additions and 64 deletions
21
js/gui.js
21
js/gui.js
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
const { dialog } = require("@electron/remote");
|
||||
|
||||
|
||||
const CONFIGURATOR = require('./data_storage');
|
||||
const Switchery = require('./libraries/switchery/switchery')
|
||||
const MSP = require('./msp');
|
||||
|
@ -55,6 +54,12 @@ var GUI_control = function () {
|
|||
];
|
||||
this.allowedTabs = this.defaultAllowedTabsWhenDisconnected;
|
||||
|
||||
this.PROFILES_CHANGED = {
|
||||
'CONTROL' : 1,
|
||||
'BATTERY' : 2,
|
||||
'MIXER' : 4
|
||||
};
|
||||
|
||||
// check which operating system is user running
|
||||
if (navigator.appVersion.indexOf("Win") != -1) this.operating_system = "Windows";
|
||||
else if (navigator.appVersion.indexOf("Mac") != -1) this.operating_system = "MacOS";
|
||||
|
@ -263,10 +268,16 @@ GUI_control.prototype.updateProfileChange = function(refresh) {
|
|||
$('#mixerprofilechange').val(FC.CONFIG.mixer_profile);
|
||||
$('#profilechange').val(FC.CONFIG.profile);
|
||||
$('#batteryprofilechange').val(FC.CONFIG.battery_profile);
|
||||
if (refresh) {
|
||||
GUI.log(i18n.getMessage('loadedMixerProfile', [FC.CONFIG.mixer_profile + 1]));
|
||||
GUI.log(i18n.getMessage('pidTuning_LoadedProfile', [FC.CONFIG.profile + 1]));
|
||||
GUI.log(i18n.getMessage('loadedBatteryProfile', [FC.CONFIG.battery_profile + 1]));
|
||||
if (refresh > 0) {
|
||||
if (refresh & GUI.PROFILES_CHANGED.CONTROL) {
|
||||
GUI.log(i18n.getMessage('pidTuning_LoadedProfile', [FC.CONFIG.profile + 1]));
|
||||
}
|
||||
if (refresh & GUI.PROFILES_CHANGED.MIXER) {
|
||||
GUI.log(i18n.getMessage('loadedMixerProfile', [FC.CONFIG.mixer_profile + 1]));
|
||||
}
|
||||
if (refresh & GUI.PROFILES_CHANGED.BATTERY) {
|
||||
GUI.log(i18n.getMessage('loadedBatteryProfile', [FC.CONFIG.battery_profile + 1]));
|
||||
}
|
||||
GUI.updateActivatedTab();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue