Skip to content

Commit 0a0b727

Browse files
committed
Match descriptive terms to Python f-string rounding
1 parent d523ede commit 0a0b727

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

micropython/examples/pico_enviro/enviro_all.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def adjust_to_sea_pressure(pressure_hpa, temperature, altitude):
6363

6464
def describe_pressure(pressure_hpa):
6565
"""Convert pressure into barometer-type description."""
66+
pressure_hpa += 0.5
6667
if pressure_hpa < 970:
6768
description = "storm"
6869
elif 970 <= pressure_hpa < 990:
@@ -80,6 +81,7 @@ def describe_pressure(pressure_hpa):
8081

8182
def describe_humidity(corrected_humidity):
8283
"""Convert relative humidity into good/bad description."""
84+
corrected_humidity += 0.5
8385
if 40 < corrected_humidity < 60:
8486
description = "good"
8587
else:
@@ -89,6 +91,7 @@ def describe_humidity(corrected_humidity):
8991

9092
def describe_light(lux):
9193
"""Convert light level in lux to descriptive value."""
94+
lux += 0.5
9295
if lux < 50:
9396
description = "dark"
9497
elif 50 <= lux < 100:

0 commit comments

Comments
 (0)