Cracked it!

I've got it working with not timeouts or any of that nonsense. There was a call to loadHTML mid MSP chain that was screwing everything up. After silencing that, everything works.
pull/2195/head
Mr D - RC 5 days ago
parent 780ab3b950
commit 9b268d515e

@ -3,6 +3,7 @@
var helper = helper || {};
var savingDefaultsModal;
var processingDefaults = false;
helper.defaultsDialog = (function () {
@ -1130,6 +1131,7 @@ helper.defaultsDialog = (function () {
};
privateScope.finalize = function (selectedDefaultPreset) {
processingDefaults = false;
mspHelper.saveToEeprom(function () {
//noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
@ -1206,9 +1208,6 @@ helper.defaultsDialog = (function () {
]);
}
settingsChainer.setChain(miscChain);
settingsChainer.execute();
// Set profiles
for (let ps = 0; ps < 3; ps++) {
@ -1242,20 +1241,29 @@ helper.defaultsDialog = (function () {
MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [currentBatteryProfile], false, callback);
});
for (let pc = 0; pc < 3; pc++) {
profileChainer[pc].setChain(profileChain[pc]);
if (pc < 2) {
profileChainer[pc].setExitPoint(function () {
profileChainer[pc+1].execute();
});
}
}
processingDefaults = true;
settingsChainer.setChain(miscChain);
settingsChainer.setExitPoint(function () {
updateActivatedTab();
profileChainer[0].execute();
});
settingsChainer.execute();
profileChainer[2].setExitPoint(function () {
updateActivatedTab();
privateScope.finalize(selectedDefaultPreset);
});
let timeout = (miscChain.length * 250) + 7000;
let timeOut0 = setTimeout(profileChainer[0].execute, timeout);
timeout+= (profileChain[0].length * 250) + 5000;
let timeOut1 = setTimeout(profileChainer[1].execute, timeout);
timeout+= (profileChain[1].length * 250) + 5000;
let timeOut2 = setTimeout(profileChainer[2].execute, timeout);
}
privateScope.onPresetClick = function (event) {

@ -261,20 +261,22 @@ GUI_control.prototype.updateStatusBar = function() {
};
GUI_control.prototype.updateProfileChange = function(refresh) {
$('#mixerprofilechange').val(CONFIG.mixer_profile);
$('#profilechange').val(CONFIG.profile);
$('#batteryprofilechange').val(CONFIG.battery_profile);
if (refresh > 0) {
if (refresh & mspHelper.PROFILES_CHANGED.MIXER) {
GUI.log(chrome.i18n.getMessage('loadedMixerProfile', [CONFIG.mixer_profile + 1]));
}
if (refresh & mspHelper.PROFILES_CHANGED.CONTROL) {
GUI.log(chrome.i18n.getMessage('pidTuning_LoadedProfile', [CONFIG.profile + 1]));
}
if (refresh & mspHelper.PROFILES_CHANGED.BATTERY) {
GUI.log(chrome.i18n.getMessage('loadedBatteryProfile', [CONFIG.battery_profile + 1]));
if ((processingDefaults != undefined && processingDefaults === true) === false) {
$('#mixerprofilechange').val(CONFIG.mixer_profile);
$('#profilechange').val(CONFIG.profile);
$('#batteryprofilechange').val(CONFIG.battery_profile);
if (refresh > 0) {
if (refresh & mspHelper.PROFILES_CHANGED.MIXER) {
GUI.log(chrome.i18n.getMessage('loadedMixerProfile', [CONFIG.mixer_profile + 1]));
}
if (refresh & mspHelper.PROFILES_CHANGED.CONTROL) {
GUI.log(chrome.i18n.getMessage('pidTuning_LoadedProfile', [CONFIG.profile + 1]));
}
if (refresh & mspHelper.PROFILES_CHANGED.BATTERY) {
GUI.log(chrome.i18n.getMessage('loadedBatteryProfile', [CONFIG.battery_profile + 1]));
}
updateActivatedTab();
}
updateActivatedTab();
}
};

Loading…
Cancel
Save