Skip to content

Commit

Permalink
Merge pull request #91 from w1ld3r/main
Browse files Browse the repository at this point in the history
Add support for ARM CPU temperature
  • Loading branch information
mathoudebine authored Nov 27, 2022
2 parents 216ed70 + d634325 commit ab5d8e0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions library/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def load():
@staticmethod
def is_temperature_available():
try:
if 'coretemp' in psutil.sensors_temperatures() or 'k10temp' in psutil.sensors_temperatures():
sensors_temps = psutil.sensors_temperatures()
if 'coretemp' in sensors_temps or 'k10temp' in sensors_temps or 'cpu_thermal' in sensors_temps:
return True
else:
return False
Expand All @@ -159,12 +160,16 @@ def is_temperature_available():
@staticmethod
def temperature():
cpu_temp = 0
if 'coretemp' in psutil.sensors_temperatures():
sensors_temps = psutil.sensors_temperatures()
if 'coretemp' in sensors_temps:
# Intel CPU
cpu_temp = psutil.sensors_temperatures()['coretemp'][0].current
elif 'k10temp' in psutil.sensors_temperatures():
cpu_temp = sensors_temps['coretemp'][0].current
elif 'k10temp' in sensors_temps:
# AMD CPU
cpu_temp = psutil.sensors_temperatures()['k10temp'][0].current
cpu_temp = sensors_temps['k10temp'][0].current
elif 'cpu_thermal' in sensors_temps:
# ARM CPU
cpu_temp = sensors_temps['cpu_thermal'][0].current

if THEME_DATA['STATS']['CPU']['TEMPERATURE']['TEXT'].get("SHOW", False):
display.lcd.DisplayText(
Expand Down Expand Up @@ -756,4 +761,4 @@ def stats():
background_image=get_full_path(THEME_DATA['PATH'],
THEME_DATA['STATS']['DATE']['HOUR']['TEXT'].get("BACKGROUND_IMAGE",
None))
)
)

0 comments on commit ab5d8e0

Please sign in to comment.