|
3 | 3 |
|
4 | 4 | var helper = helper || {}; |
5 | 5 | var savingDefaultsModal; |
| 6 | +var processingDefaults = false; |
6 | 7 |
|
7 | 8 | helper.defaultsDialog = (function () { |
8 | 9 |
|
@@ -1130,6 +1131,7 @@ helper.defaultsDialog = (function () { |
1130 | 1131 | }; |
1131 | 1132 |
|
1132 | 1133 | privateScope.finalize = function (selectedDefaultPreset) { |
| 1134 | + processingDefaults = false; |
1133 | 1135 | mspHelper.saveToEeprom(function () { |
1134 | 1136 | //noinspection JSUnresolvedVariable |
1135 | 1137 | GUI.log(chrome.i18n.getMessage('configurationEepromSaved')); |
@@ -1206,9 +1208,6 @@ helper.defaultsDialog = (function () { |
1206 | 1208 | ]); |
1207 | 1209 | } |
1208 | 1210 |
|
1209 | | - settingsChainer.setChain(miscChain); |
1210 | | - settingsChainer.execute(); |
1211 | | - |
1212 | 1211 | // Set profiles |
1213 | 1212 |
|
1214 | 1213 | for (let ps = 0; ps < 3; ps++) { |
@@ -1242,20 +1241,29 @@ helper.defaultsDialog = (function () { |
1242 | 1241 | MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [currentBatteryProfile], false, callback); |
1243 | 1242 | }); |
1244 | 1243 |
|
| 1244 | + |
1245 | 1245 | for (let pc = 0; pc < 3; pc++) { |
1246 | 1246 | profileChainer[pc].setChain(profileChain[pc]); |
| 1247 | + |
| 1248 | + if (pc < 2) { |
| 1249 | + profileChainer[pc].setExitPoint(function () { |
| 1250 | + profileChainer[pc+1].execute(); |
| 1251 | + }); |
| 1252 | + } |
1247 | 1253 | } |
1248 | 1254 |
|
| 1255 | + processingDefaults = true; |
| 1256 | + settingsChainer.setChain(miscChain); |
| 1257 | + settingsChainer.setExitPoint(function () { |
| 1258 | + updateActivatedTab(); |
| 1259 | + profileChainer[0].execute(); |
| 1260 | + }); |
| 1261 | + settingsChainer.execute(); |
| 1262 | + |
1249 | 1263 | profileChainer[2].setExitPoint(function () { |
| 1264 | + updateActivatedTab(); |
1250 | 1265 | privateScope.finalize(selectedDefaultPreset); |
1251 | 1266 | }); |
1252 | | - |
1253 | | - let timeout = (miscChain.length * 150) + 2000; |
1254 | | - let timeOut0 = setTimeout(profileChainer[0].execute, timeout); |
1255 | | - timeout+= (profileChain[0].length * 150) + 4000; |
1256 | | - let timeOut1 = setTimeout(profileChainer[1].execute, timeout); |
1257 | | - timeout+= (profileChain[1].length * 150) + 4000; |
1258 | | - let timeOut2 = setTimeout(profileChainer[2].execute, timeout); |
1259 | 1267 | } |
1260 | 1268 |
|
1261 | 1269 | privateScope.onPresetClick = function (event) { |
|
0 commit comments