Skip to content

Commit 5e1ccd6

Browse files
committed
added constants to altitude formula
1 parent cfad2e7 commit 5e1ccd6

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/clue/adafruit_clue.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,16 @@ def altitude(self):
423423
print("Altitude: {:.1f}m".format(clue.altitude))
424424
"""
425425
# National Oceanic and Atmospheric Administration (NOAA) formula for converting atmospheric pressure to pressure altitude.
426-
altitude = 44330 * (
427-
1.0
426+
OUTSIDE_MULTIPLER_CONSTANT = 44330
427+
POWER_CONSTANT = 0.1903
428+
WHOLE_CONSTANT = 1
429+
430+
altitude = OUTSIDE_MULTIPLER_CONSTANT * (
431+
WHOLE_CONSTANT
428432
- math.pow(
429433
self.__state[CONSTANTS.CLUE_STATE.PRESSURE]
430434
/ self.__state[CONSTANTS.CLUE_STATE.SEA_LEVEL_PRESSURE],
431-
0.1903,
435+
POWER_CONSTANT,
432436
)
433437
)
434438
return altitude

0 commit comments

Comments
 (0)