Skip to content

Commit fc3d004

Browse files
authored
Merge pull request adafruit#1090 from dglaude/patch-1
rounding temperature as last operation
2 parents ae29f01 + ede05ba commit fc3d004

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

PyPortal_User_Interface/code.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,12 @@ def switch_view(what_view):
338338
light = light_sensor.value
339339

340340
if adt: # Only if we have the temperature sensor
341-
tempC = round(adt.temperature)
341+
tempC = adt.temperature
342342
else: # No temperature sensor
343-
tempC = round(microcontroller.cpu.temperature)
343+
tempC = microcontroller.cpu.temperature
344344

345345
tempF = tempC * 1.8 + 32
346-
sensor_data.text = 'Touch: {}\nLight: {}\n Temp: {}°F'.format(touch, light, tempF)
346+
sensor_data.text = 'Touch: {}\nLight: {}\n Temp: {:.0f}°F'.format(touch, light, tempF)
347347

348348
# ------------- Handle Button Press Detection ------------- #
349349
if touch: # Only do this if the screen is touched

0 commit comments

Comments
 (0)