Fix cpu temp detection

This commit is contained in:
Linus Dierheimer
2022-06-16 14:39:01 +02:00
parent a33e296656
commit 481affa50a
3 changed files with 13 additions and 10 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
--cursor-format "Theme: {}; Size: {}"
--terminal-format "Process: {}; Path: {}; Exe: {}"
--terminal-font-format "Raw: {}; Name: {}; Size: {}; Styles: {}; Pretty: {}"
--cpu-format "Name: {}; Pretty: {}; Vendor: {}; Logical online: {}; Logical configured: {}; Physical: {}; Cores: {}; bios: {}; temperature: {}; scaling max: {}; scaling min: {}; info max: {}; info min: {}; cpuinfo: {}; frequency: {}"
--cpu-format "Name: {}; Pretty: {}; Vendor: {}; Logical online: {}; Logical configured: {}; Physical: {}; Cores: {}; temperature: {}; bios: {}; scaling max: {}; scaling min: {}; info max: {}; info min: {}; cpuinfo: {}; frequency: {}"
--cpu-usage-format "Percentage: {}"
--gpu-format "Vendor: {}; Vendor pretty: {}; Name: {}; Name pretty: {}; Driver: {}"
--memory-format "Used: {}; Total: {}; Percentage: {}"
+1
View File
@@ -72,6 +72,7 @@ static inline bool formatArgSet(const FFformatarg* arg)
{
return arg->value != NULL && (
(arg->type == FF_FORMAT_ARG_TYPE_DOUBLE && *(double*)arg->value > 0) ||
(arg->type == FF_FORMAT_ARG_TYPE_DOUBLE && *(double*)arg->value == *(double*)arg->value) || //NaN
(arg->type == FF_FORMAT_ARG_TYPE_INT && *(int*)arg->value > 0) ||
(arg->type == FF_FORMAT_ARG_TYPE_STRBUF && ((FFstrbuf*)arg->value)->length > 0) ||
(arg->type == FF_FORMAT_ARG_TYPE_STRING && *(const char*)arg->value != '\0') ||
+11 -9
View File
@@ -150,19 +150,21 @@ void ffPrintCPU(FFinstance* instance)
ffStrbufSubstrBeforeFirstC(&namePretty, '@'); //Cut the speed output in the name as we append our own
ffStrbufTrimRight(&namePretty, ' '); //If we removed the @ in previous step there was most likely a space before it
const FFTempsResult *temps = ffDetectTemps(&instance);
const FFTempsResult *temps = ffDetectTemps(instance);
double cpuTemp = 0.0/0.0; //NaN
for(uint32_t i = 0; i< temps->values.length; i++)
for(uint32_t i = 0; i < temps->values.length; i++)
{
FFTempValue *v = ffListGet(&temps->values, i);
if(
ffStrbufFirstIndexS(&v->name, "cpu") == v->name.length &&
ffStrbufCompS(&v->name, "k10temp") != 0 &&
ffStrbufCompS(&v->name, "coretemp") != 0
) break;
FFTempValue* value = ffListGet(&temps->values, i);
cpuTemp = (double) parseLong(&v->value) / 1000.0;
if(
ffStrbufFirstIndexS(&value->name, "cpu") < value->name.length ||
ffStrbufCompS(&value->name, "k10temp") == 0 ||
ffStrbufCompS(&value->name, "coretemp") == 0
) {
cpuTemp = (double) parseLong(&value->value) / 1000.0;
break;
}
}
FFstrbuf cpu;