ArcadeRenegade / SidebarDiagnostics

A simple sidebar for Windows desktop that displays hardware diagnostic information.
GNU General Public License v3.0
2.29k stars 201 forks source link

Fixed temperature check for AMD core chiplet dies (CCDs). #396

Closed schiffy91 closed 2 years ago

schiffy91 commented 2 years ago

Bug: The temperature sensor for Ryzen Architecture CPUs "CCDs Max (Tdie)" was being overridden by the generic "CPU" sensor

Context: _tempSensor is just initialized to null before the Ryzen temperature check, which will default to null if it's unsuccessful (e.g. Intel CPU). The problem is: We override the Ryzen CPU temperature reading with the way Intel CPUs measures temperature from _board; we also never use _board on Intel CPUs since _tempSensor will be null.

How things should work:

1) If AMD Ryzen CPU, use its architecture-specific CPU temperature reading 2) Otherwise, try and read from the _board 3) Lastly, try and read from _hardware

How things currently work:

Right now, on an AMD CPU: We perform 1 successfully, and then immediately override it with 2 Right now, on an Intel CPU, We perform 1 unsuccessfully, we're ineligible for 2, and then we default to 3.

Solution:

My solution should make the above work as intended by only pursuing 2 if 1 fails (right now, 2 is pursued if and only if 1 succeeds, which defeats the purpose of 1 and 2).

Testing:

I've tested this, and it runs as expected on my 5950x -- temps align with Ryzen Master temps. If someone has an Intel processor, it'd be great to validate that's still WAI.

ArcadeRenegade commented 2 years ago

Thanks for this PR. Honestly I don't have an AMD CPU so I just had to guess.