From 3ff03359858788c2aaef9de6fd38af3c4de1deec Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 30 Jul 2023 21:52:28 +0200 Subject: [PATCH] Restored fallback CPU temp reading method --- app/HardwareControl.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/HardwareControl.cs b/app/HardwareControl.cs index 27bbaf0c..62ee6683 100644 --- a/app/HardwareControl.cs +++ b/app/HardwareControl.cs @@ -209,7 +209,19 @@ public static class HardwareControl lastUpdate = last; cpuTemp = Program.acpi.DeviceGet(AsusACPI.Temp_CPU); - //Debug.WriteLine(cpuTemp); + + if (cpuTemp < 0) try + { + using (var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true)) + { + cpuTemp = ct.NextValue() - 273; + } + } + catch (Exception ex) + { + Debug.WriteLine("Failed reading CPU temp :" + ex.Message); + } + return cpuTemp; }