Moved options data to a global file.

This commit is contained in:
Quentin DECAUNES 2019-06-05 18:08:00 +02:00
parent 52ad83863d
commit ab3eba8fee
5 changed files with 155 additions and 63 deletions

View File

@ -31,76 +31,76 @@
<ul class="uk-switcher uk-margin-remove" uk-height-viewport="expand: true" style="position:relative;"> <ul class="uk-switcher uk-margin-remove" uk-height-viewport="expand: true" style="position:relative;">
<li class="uk-margin-top uk-margin-bottom uk-container" id="controller-tab"> <li class="uk-margin-top uk-margin-bottom uk-container" id="controller-tab">
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_stapm_time_ms">STAPM Constant Time (Sec.)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_stapm_time_ms"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input " type="number" min="1" max="3600" value="1" id="stapm_time_ms" repeat="stapm_time_ms_range"> <input class="uk-input " type="number" id="stapm_time_ms" repeat="stapm_time_ms_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="1" max="3600" value="0" repeat="stapm_time_ms" id="stapm_time_ms_range"> <input class="uk-range" type="range" repeat="stapm_time_ms" id="stapm_time_ms_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_stapm_limit_w">STAPM Limit (W)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_stapm_limit_w"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="5" max="60" value="20" id="stapm_limit_w" repeat="stapm_limit_w_range"> <input class="uk-input" type="number" id="stapm_limit_w" repeat="stapm_limit_w_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="5" max="60" value="20" repeat="stapm_limit_w" id="stapm_limit_w_range"> <input class="uk-range" type="range" repeat="stapm_limit_w" id="stapm_limit_w_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_ppt_fast_limit_w">PPT Fast Limit (W)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_ppt_fast_limit_w"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="5" max="60" value="25" id="ppt_fast_limit_w" repeat="ppt_fast_limit_w_range"> <input class="uk-input" type="number" id="ppt_fast_limit_w" repeat="ppt_fast_limit_w_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="5" max="60" value="25" repeat="ppt_fast_limit_w" id="ppt_fast_limit_w_range"> <input class="uk-range" type="range" repeat="ppt_fast_limit_w" id="ppt_fast_limit_w_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_ppt_slow_limit_w">PPT Slow Limit (W)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_ppt_slow_limit_w"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="5" max="60" value="10" id="ppt_slow_limit_w" repeat="ppt_slow_limit_w_range"> <input class="uk-input" type="number" id="ppt_slow_limit_w" repeat="ppt_slow_limit_w_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="5" max="60" value="10" repeat="ppt_slow_limit_w" id="ppt_slow_limit_w_range"> <input class="uk-range" type="range" repeat="ppt_slow_limit_w" id="ppt_slow_limit_w_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_temperature_limit_c">Temperature Limit (°C)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_temperature_limit_c"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="50" max="100" value="80" id="temperature_limit_c" repeat="temperature_limit_c_range"> <input class="uk-input" type="number" id="temperature_limit_c" repeat="temperature_limit_c_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="50" max="100" value="80" repeat="temperature_limit_c" id="temperature_limit_c_range"> <input class="uk-range" type="range" repeat="temperature_limit_c" id="temperature_limit_c_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_vrm_current_m_a">VRM Current (A)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_vrm_current_m_a"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="20" max="75" value="30" id="vrm_current_m_a" repeat="vrm_current_m_a_range"> <input class="uk-input" type="number" id="vrm_current_m_a" repeat="vrm_current_m_a_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="20" max="75" value="30" repeat="vrm_current_m_a" id="vrm_current_m_a_range"> <input class="uk-range" type="range" repeat="vrm_current_m_a" id="vrm_current_m_a_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_min_fclk_frequency">Minimum transmission frequency (Mhz)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_min_fclk_frequency"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="800" max="1600" value="800" step="10" id="min_fclk_frequency" repeat="min_fclk_frequency_range"> <input class="uk-input" type="number" step="10" id="min_fclk_frequency" repeat="min_fclk_frequency_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="800" max="1600" value="800" step="10" repeat="min_fclk_frequency" id="min_fclk_frequency_range"> <input class="uk-range" type="range" step="10" repeat="min_fclk_frequency" id="min_fclk_frequency_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_max_fclk_frequency">Maximum transmission frequency (Mhz)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_max_fclk_frequency"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="800" max="1600" value="1200" step="10" id="max_fclk_frequency" repeat="max_fclk_frequency_range"> <input class="uk-input" type="number" step="10" id="max_fclk_frequency" repeat="max_fclk_frequency_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="800" max="1600" value="1200" step="10" repeat="max_fclk_frequency" id="max_fclk_frequency_range"> <input class="uk-range" type="range" step="10" repeat="max_fclk_frequency" id="max_fclk_frequency_range">
</div> </div>
</div> </div>
<p class="uk-margin"> <p class="uk-margin">
@ -110,49 +110,49 @@
</li> </li>
<li class="uk-margin-top uk-margin-bottom uk-container" id="experimental-tab"> <li class="uk-margin-top uk-margin-bottom uk-container" id="experimental-tab">
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_psi0_current_limit">PSI0 Current Limit (mA)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_psi0_current_limit"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="20" max="100" value="20" id="psi0_current_limit" repeat="psi0_current_limit_range"> <input class="uk-input" type="number" id="psi0_current_limit" repeat="psi0_current_limit_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="20" max="100" value="20" repeat="psi0_current_limit" id="psi0_current_limit_range"> <input class="uk-range" type="range" repeat="psi0_current_limit" id="psi0_current_limit_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_min_gfxclk_frequency">Minimum GFX Clock Frequency (Mhz)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_min_gfxclk_frequency"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="150" max="1300" value="150" id="min_gfxclk_frequency" repeat="min_gfxclk_frequency_range"> <input class="uk-input" type="number" id="min_gfxclk_frequency" repeat="min_gfxclk_frequency_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="150" max="1300" value="150" repeat="min_gfxclk_frequency" id="min_gfxclk_frequency_range"> <input class="uk-range" type="range" repeat="min_gfxclk_frequency" id="min_gfxclk_frequency_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_max_gfxclk_frequency">Maximum GFX Clock Frequency (Mhz)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_max_gfxclk_frequency"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="150" max="1300" value="1100" id="max_gfxclk_frequency" repeat="max_gfxclk_frequency_range"> <input class="uk-input" type="number" id="max_gfxclk_frequency" repeat="max_gfxclk_frequency_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="150" max="1300" value="1100" repeat="max_gfxclk_frequency" id="max_gfxclk_frequency_range"> <input class="uk-range" type="range" repeat="max_gfxclk_frequency" id="max_gfxclk_frequency_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_min_socclk_frequency">Minimum SOC Clock Frequency (Mhz)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_min_socclk_frequency"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="1000" max="3700" value="1000" step="100" id="min_socclk_frequency" repeat="min_socclk_frequency_range"> <input class="uk-input" type="number" step="100" id="min_socclk_frequency" repeat="min_socclk_frequency_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="1000" max="3700" value="1000" step="100" repeat="min_socclk_frequency" id="min_socclk_frequency_range"> <input class="uk-range" type="range" step="100" repeat="min_socclk_frequency" id="min_socclk_frequency_range">
</div> </div>
</div> </div>
<h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_max_socclk_frequency">Maximum SOC Clock Frequency (Mhz)</label></h3> <h3><label><input class="uk-checkbox uk-margin-small-right" type="checkbox" id="apply_max_socclk_frequency"><span class="option-label"></span></label></h3>
<div class="uk-grid-small" uk-grid> <div class="uk-grid-small" uk-grid>
<div class="uk-width-1-6"> <div class="uk-width-1-6">
<input class="uk-input" type="number" min="1000" max="3700" value="3700" step="100" id="max_socclk_frequency" repeat="max_socclk_frequency_range"> <input class="uk-input" type="number" step="100" id="max_socclk_frequency" repeat="max_socclk_frequency_range">
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<input class="uk-range" type="range" min="1000" max="3700" value="3700" step="100" repeat="max_socclk_frequency" id="max_socclk_frequency_range"> <input class="uk-range" type="range" step="100" repeat="max_socclk_frequency" id="max_socclk_frequency_range">
</div> </div>
</div> </div>
<p class="uk-margin"> <p class="uk-margin">

View File

@ -10,7 +10,7 @@ ready(function(){
checkForAdminRights(); checkForAdminRights();
displayVersion(); displayVersion();
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically')); reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
displayOptionDescription(); displayOptionData();
if (require('os').platform() === 'win32') { if (require('os').platform() === 'win32') {
recreateShortcut(); recreateShortcut();
} }

View File

@ -353,14 +353,28 @@ function reApplyPeriodically(seconds) {
/** /**
* Display tooltip on each options. * Display tooltip on each options.
*/ */
function displayOptionDescription() { function displayOptionData() {
const options_description = require('./js/options_description.json'); const options_data = require('./js/options_data.json');
for (const option in options_description) { for (const option in options_data) {
if (options_description.hasOwnProperty(option)) { if (options_data.hasOwnProperty(option)) {
const description = options_description[option]; const label = options_data[option].label;
const node = document.getElementById(option).parentElement.parentElement.previousElementSibling; const description = options_data[option].description;
node.setAttribute('uk-tooltip', description); const min = options_data[option].min;
UIkit.tooltip(node); const max = options_data[option].max;
const default_value = options_data[option].default;
const title_container = document.getElementById(option).parentElement.parentElement.previousElementSibling;
const title = title_container.getElementsByClassName('option-label');
const inputs = title_container.nextElementSibling.getElementsByTagName('input');
title_container.setAttribute('uk-tooltip', description);
UIkit.tooltip(title_container);
title[0].innerHTML = label;
for (const input of inputs) {
input.setAttribute('min', min);
input.setAttribute('max', max);
input.value = default_value;
}
} }
} }
} }

93
js/options_data.json Normal file
View File

@ -0,0 +1,93 @@
{
"psi0_current_limit": {
"description": "The limit of current we let the motherboard deliver to the PSI0.",
"label": "PSI0 Current Limit (mA)",
"min": "20",
"max": "100",
"default": "20"
},
"stapm_time_ms": {
"description": "Skin Temperature Aware Power Management. This will define the boost period to be used.",
"label": "STAPM Constant Time (Sec.)",
"min": "1",
"max": "3600",
"default": "900"
},
"stapm_limit_w": {
"description": "Skin Temperature Aware Power Management. This will define the socket power package limit which is used to manage the device boost period.",
"label": "STAPM Limit (W)",
"min": "5",
"max": "60",
"default": "20"
},
"ppt_fast_limit_w": {
"description": "The amount of power the CPU can draw while boost levels on.",
"label": "PPT Fast Limit (W)",
"min": "5",
"max": "60",
"default": "25"
},
"ppt_slow_limit_w": {
"description": "The amount of power the CPU can draw while boost levels off.",
"label": "PPT Slow Limit (W)",
"min": "5",
"max": "60",
"default": "10"
},
"temperature_limit_c": {
"description": "The temperature the CPU can reach before boost levels off.",
"label": "Temperature Limit (°C)",
"min": "50",
"max": "100",
"default": "75"
},
"vrm_current_m_a": {
"description": "The limit of current we let the motherboard deliver to the CPU.",
"label": "VRM Current (A)",
"min": "20",
"max": "75",
"default": "30"
},
"max_fclk_frequency": {
"description": "Fabric is AMD's marketing term for the bus connection that connects processor dies (GPU/CPU). This define the bus's max. clock limit.",
"label": "Maximum transmission frequency (Mhz)",
"min": "800",
"max": "1600",
"default": "1200"
},
"min_fclk_frequency": {
"description": "Fabric is AMD's marketing term for the bus connection that connects processor dies (GPU/CPU). This define the bus's min. clock limit.",
"label": "Minimum transmission frequency (Mhz)",
"min": "800",
"max": "1600",
"default": "800"
},
"max_gfxclk_frequency": {
"description": "The maximum clock speed the integrated GPU is allowed to run at.",
"label": "Maximum GFX Clock Frequency (Mhz)",
"min": "400",
"max": "1300",
"default": "1100"
},
"min_gfxclk_frequency": {
"description": "The minimum clock speed the integrated GPU is allowed to run at.",
"label": "Minimum GFX Clock Frequency (Mhz)",
"min": "400",
"max": "1300",
"default": "400"
},
"max_socclk_frequency": {
"description": "The maximum clock speed the CPU is allowed to run at.",
"label": "Maximum SOC Clock Frequency (Mhz)",
"min": "200",
"max": "750",
"default": "600"
},
"min_socclk_frequency": {
"description": "The minimum clock speed the CPU is allowed to run at.",
"label": "Minimum SOC Clock Frequency (Mhz)",
"min": "200",
"max": "750",
"default": "200"
}
}

View File

@ -1,15 +0,0 @@
{
"psi0_current_limit": "The limit of current we let the motherboard deliver to the PSI0.",
"stapm_time_ms": "Skin Temperature Aware Power Management. This will define the boost period to be used.",
"stapm_limit_w": "Skin Temperature Aware Power Management. This will define the socket power package limit which is used to manage the device boost period.",
"ppt_fast_limit_w": "The amount of power the CPU can draw while boost levels on.",
"ppt_slow_limit_w": "The amount of power the CPU can draw while boost levels off.",
"temperature_limit_c": "The temperature the CPU can reach before boost levels off.",
"vrm_current_m_a": "The limit of current we let the motherboard deliver to the CPU.",
"max_fclk_frequency": "Fabric is AMD's marketing term for the bus connection that connects processor dies (GPU/CPU). This define the bus's max. clock limit.",
"min_fclk_frequency": "Fabric is AMD's marketing term for the bus connection that connects processor dies (GPU/CPU). This define the bus's min. clock limit.",
"max_gfxclk_frequency": "The maximum clock speed the integrated GPU is allowed to run at.",
"min_gfxclk_frequency": "The minimum clock speed the integrated GPU is allowed to run at.",
"max_socclk_frequency": "The maximum clock speed the CPU is allowed to run at.",
"min_socclk_frequency": "The minimum clock speed the CPU is allowed to run at."
}