Show N/A instead of 0KHz when CPU frequency is not available.

This commit is contained in:
Arnavion
2019-08-10 11:37:35 -07:00
parent 1d5e6a27a0
commit 1acfb0a752
2 changed files with 18 additions and 12 deletions

View File

@ -193,10 +193,10 @@ double Platform_setCPUValues(Meter* this, int cpu) {
percent = CLAMP(percent, 0.0, 100.0);
if (isnan(percent)) percent = 0.0;
v[CPU_METER_FREQUENCY] = 0;
v[CPU_METER_FREQUENCY] = -1;
if (this->pl->settings->showCPUFrequency) {
char filename[63+1];
xSnprintf(filename, 63, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", cpu - 1);
char filename[64];
xSnprintf(filename, sizeof(filename), "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", cpu - 1);
FILE* fd = fopen(filename, "r");
if (fd) {
unsigned int cpuFrequency;