Repository navigation
Fix CPU temperature reading on Rapsberry Pi - #4
Conversation
|
Thanks again for the PR. I think my comment from the parent issue sums up my thoughts on this. I think I'll hold off on reviewing this until you can let us know what your plans are with respect to our discussion. |
| network = await SI.networkStats(); | ||
| try { | ||
| cpuTemp = await SI.cpuTemperature(); | ||
| if (!cpuTemp.cores.length && cpuTemp.max > 0) { |
There was a problem hiding this comment.
I'm wondering if there is a better way to check if the cpuTemp.max is valid in this condition.
The issue is that a temperature of zero degrees, or even negative degrees is technically a perfectly valid temperature.
However, even the module we're using sets the default to -1°C, so we may not have a choice in this matter. If the module can't get the max value, it'll still return -1°C which is sadly a valid temperature.
Let's just hope for now that no one using Doppler on a Raspberry Pi is experimenting with LN2 cooling, or lives in the Artic Circle.
This PR changes the cpu temperature reading to use the max temperature provided by systeminformation instead of manually calculating it from the core temperature array. On the RPi, the cores array is actually empty, but the max temperature is provided.
Note that I could only verify the change on an RPi, since on my Windows machine it doesn't return any temperature reading at all.