Added basical ryzenadj value management and execution.

This commit is contained in:
Quentin Decaunes 2019-02-27 21:04:28 +01:00
parent d7ca8e78b8
commit 8d4e32e841
2 changed files with 63 additions and 8 deletions

View File

@ -21,7 +21,7 @@
<li class="uk-container"> <li class="uk-container">
<form> <form action="#">
<ul uk-accordion="multiple: true"> <ul uk-accordion="multiple: true">
<li> <li>
<a class="uk-accordion-title" href="#">STAPM Limit (W)</a> <a class="uk-accordion-title" href="#">STAPM Limit (W)</a>
@ -89,6 +89,7 @@
</div> </div>
</li> </li>
</ul> </ul>
<button class="uk-button uk-button-default" onClick="applyRyzenSettings()">Apply</button>
</form> </form>
</li> </li>

View File

@ -17,10 +17,64 @@ ready(function(){
} }
} }
}); });
/*
stapm_limit_w_range function getCurrentWorkingDirectory() {
ppt_fast_limit_w_range return require('electron').remote.app.getAppPath();
ppt_slow_limit_w_range }
temperature_limit_c_range
vrm_current_m_a_range function decimalToHexString(number) {
*/ if (number < 0)
{
number = 0xFFFFFFFF + number + 1;
}
return number.toString(16).toUpperCase();
}
function applyRyzenSettings(e) {
const settings = {
"--stapm-limit=": document.getElementById('stapm_limit_w').value,
"--fast-limit=": document.getElementById('ppt_fast_limit_w').value,
"--slow-limit=": document.getElementById('ppt_slow_limit_w').value,
"--tctl-temp=": document.getElementById('temperature_limit_c').value,
"--vrmmax-current=": document.getElementById('vrm_current_m_a').value,
};
console.log(settings);
const child = require('child_process').execFile;
const executablePath = getCurrentWorkingDirectory() + "\\bin\\ryzenadj.exe";
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) {
console.log(err)
console.log(data.toString());
});
}