Skip to content

Commit

Permalink
Decode CPU temperature for Python 3 support
Browse files Browse the repository at this point in the history
This ports the changes from pimoroni/enviroplus-python#23 , where this same function is copied.
  • Loading branch information
LionsPhil authored Apr 12, 2021
1 parent 97c80ce commit 0a274d3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions examples/compensated-temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
output, _error = process.communicate()
output = output.decode()
return float(output[output.index('=') + 1:output.rindex("'")])

factor = 0.6 # Smaller numbers adjust temp down, vice versa
Expand Down

0 comments on commit 0a274d3

Please sign in to comment.