Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/all-in-one-no-pm.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def display_text(variable, data, unit):

# Get the temperature of the CPU for compensation
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
output, _error = process.communicate()
return float(output[output.index('=') + 1:output.rindex("'")])

Expand All @@ -87,7 +87,7 @@ def get_cpu_temperature():
# temperature down, and increase to adjust up
factor = 0.8

cpu_temps = [0] * 5
cpu_temps = [get_cpu_temperature()] * 5

delay = 0.5 # Debounce the proximity tap
mode = 0 # The starting mode
Expand Down
4 changes: 2 additions & 2 deletions examples/all-in-one.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def display_text(variable, data, unit):

# Get the temperature of the CPU for compensation
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
output, _error = process.communicate()
return float(output[output.index('=') + 1:output.rindex("'")])

Expand All @@ -93,7 +93,7 @@ def get_cpu_temperature():
# temperature down, and increase to adjust up
factor = 0.8

cpu_temps = [0] * 5
cpu_temps = [get_cpu_temperature()] * 5

delay = 0.5 # Debounce the proximity tap
mode = 0 # The starting mode
Expand Down
5 changes: 2 additions & 3 deletions examples/compensated-temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@

# Get the temperature of the CPU for compensation
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
output, _error = process.communicate()
output = output.decode()
return float(output[output.index('=') + 1:output.rindex("'")])


# Tuning factor for compensation. Decrease this number to adjust the
# temperature down, and increase to adjust up
factor = 0.8

cpu_temps = [0] * 5
cpu_temps = [get_cpu_temperature()] * 5

while True:
cpu_temp = get_cpu_temperature()
Expand Down
2 changes: 1 addition & 1 deletion examples/luftdaten.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def read_values():

# Get CPU temperature to use for compensation
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
output, _error = process.communicate()
return float(output[output.index('=') + 1:output.rindex("'")])

Expand Down