diff --git a/js/app.js b/js/app.js
index 47e167b..44faaa2 100644
--- a/js/app.js
+++ b/js/app.js
@@ -2,6 +2,7 @@ ready(function(){
registerRepeaterForAllInput();
checkForAdminRights();
preFillSettings();
+ loadLatestUsedSettings();
});
/**
@@ -55,6 +56,7 @@ function applyRyzenSettings(e) {
}
else if (output) {
notification('success', 'Ryzenadj output:
' + output);
+ saveLatestUsedSettings();
}
});
diff --git a/js/methods.js b/js/methods.js
index 5822a99..a480530 100644
--- a/js/methods.js
+++ b/js/methods.js
@@ -149,4 +149,39 @@ function appendLog(message) {
var log_area = document.getElementById('logs');
log_area.value += message + "\n";
console.log(message);
-}
\ No newline at end of file
+}
+
+/**
+ * Will save the latest used settings.
+ */
+function saveLatestUsedSettings() {
+ var inputs = document.querySelectorAll('#controller-tab input');
+ var latest_controller_tabs_settings = {};
+ inputs.forEach(element => {
+ let id = element.id;
+ let value = element.value;
+ latest_controller_tabs_settings[id] = value;
+ });
+ const settings = require('electron-settings');
+ let ret = settings.set("latest_controller_tabs_settings", latest_controller_tabs_settings);
+ appendLog(`saveLatestUsedSettings(): ${JSON.stringify(latest_controller_tabs_settings)}`);
+ appendLog(`saveLatestUsedSettings(): ${JSON.stringify(ret)}`);
+}
+
+/**
+ * Will load the latest settings and refresh the controller tab's values.
+ */
+function loadLatestUsedSettings() {
+ const settings = require('electron-settings');
+ var latest_controller_tabs_settings = settings.get("latest_controller_tabs_settings");
+ appendLog(`loadLatestUsedSettings(): ${JSON.stringify(latest_controller_tabs_settings)}`);
+ for (const id in latest_controller_tabs_settings) {
+ if (latest_controller_tabs_settings.hasOwnProperty(id)) {
+ const value = latest_controller_tabs_settings[id];
+ let input = document.getElementById(id);
+ if (input) {
+ input.value = value;
+ }
+ }
+ }
+}