ryzen-controller/js/app.js

71 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-02-28 02:16:11 +07:00
ready(function(){
2019-03-03 00:33:11 +07:00
const settings = require('electron-settings');
document.isStarting = true;
registerRepeaterForAllInput();
registerEventListenerForSettingsInput();
checkForAdminRights();
2019-02-28 14:11:03 +07:00
preFillSettings();
2019-03-01 00:23:05 +07:00
loadLatestUsedSettings();
2019-03-01 21:38:59 +07:00
displayVersion();
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
displayOptionDescription();
recreateShortcut();
2019-03-08 02:00:12 +07:00
updatePresetList();
2019-03-08 19:02:14 +07:00
checkForNewRelease();
document.isStarting = false;
2019-03-03 00:33:11 +07:00
settings.set('settings', {
...settings.get('settings'),
first_launch: false
});
2019-02-28 02:16:11 +07:00
});
/**
* Will create and handle ryzenadj.exe execution.
*/
2019-03-01 00:39:33 +07:00
function applyRyzenSettings() {
2019-03-08 02:00:12 +07:00
const settings = getCurrentSettings("ryzenadjArgs");
const child = require('child_process').execFile;
2019-02-28 14:11:03 +07:00
const executablePath = getRyzenAdjExecutablePath();
var parameters = [];
for (const option in settings) {
if (settings.hasOwnProperty(option)) {
let value = settings[option];
switch (option) {
case "--stapm-limit=":
case "--fast-limit=":
case "--slow-limit=":
value = value * 1000;
break;
case "--tctl-temp=":
value = value;
break;
case "--vrmmax-current=":
value = '0x' + decimalToHexString(value * 1000);
break;
default:
break;
}
parameters.push('' + option + value);
}
}
child(executablePath, parameters, function(err, data) {
var output = data.toString();
if (err) {
notification('danger', err + '<br/>' + output);
}
else if (output) {
notification('success', 'Ryzenadj output:<br/>' + output);
2019-03-01 00:23:05 +07:00
saveLatestUsedSettings();
}
});
}