Skip to content

Commit

Permalink
Merge pull request #1488 from iNavFlight/dzikuvx-pid-tuning-confirmat…
Browse files Browse the repository at this point in the history
…ions

PID Tuning Confirmations
  • Loading branch information
DzikuVx authored Mar 15, 2022
2 parents e201bef + a6f9a61 commit 7ea40ad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
6 changes: 6 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3619,6 +3619,12 @@
"confirm_reset_settings": {
"message": "Do you really want to reset all settings?\nATTENTION: All settings are lost! You have to setup the whole aircraft after this operation!"
},
"confirm_select_defaults": {
"message": "This will allow to select new default values for all settings. Existing PID tune and other settings might be lost!\nDo you want to continue?"
},
"confirm_reset_pid": {
"message": "This will reset all PID settings to firmware default values and save.\nDo you want to continue?"
},
"mappingTableOutput": {
"message": "Output"
},
Expand Down
30 changes: 18 additions & 12 deletions tabs/pid_tuning.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,30 @@ TABS.pid_tuning.initialize = function (callback) {
}
});

$('#resetPIDs').on('click', function(){
MSP.send_message(MSPCodes.MSP_SET_RESET_CURR_PID, false, false, false);
updateActivatedTab();
$('#resetPIDs').on('click', function() {

if (confirm(chrome.i18n.getMessage('confirm_reset_pid'))) {
MSP.send_message(MSPCodes.MSP_SET_RESET_CURR_PID, false, false, false);
updateActivatedTab();
}
});

$('#resetDefaults').on('click', function() {
mspHelper.setSetting("applied_defaults", 0, function() {
mspHelper.saveToEeprom( function () {
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));

GUI.tab_switch_cleanup(function () {
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
GUI.handleReconnect();

if (confirm(chrome.i18n.getMessage('confirm_select_defaults'))) {
mspHelper.setSetting("applied_defaults", 0, function() {
mspHelper.saveToEeprom( function () {
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));

GUI.tab_switch_cleanup(function () {
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
GUI.handleReconnect();
});
});
});
});
});
}
});

pid_and_rc_to_form();
Expand Down

0 comments on commit 7ea40ad

Please sign in to comment.