Skip to content

Commit 30f3f8f

Browse files
Andrew SmithAndrew Smith
Andrew Smith
authored and
Andrew Smith
committed
Update to Altitude setter
1 parent 826eed3 commit 30f3f8f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

adafruit_bmp280.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,10 @@ def altitude(self) -> float:
369369
p = self.pressure # in Si units for hPascal
370370
return 44330 * (1.0 - math.pow(p / self.sea_level_pressure, 0.1903))
371371

372-
@property
373-
def p0(self, altitude_m=0.0) -> float:
374-
"""The calculated sea level pressure based on altitude (:attr:`altitude`)
375-
- which you must enter ahead of time)"""
372+
@altitude.setter
373+
def altitude(self, value: float) -> None:
376374
p = self.pressure # in Si units for hPascal
377-
p0 = p / math.pow(1.0 - altitude_m/44330.0, 5.255)
378-
return p0
375+
self.sea_level_pressure = p / math.pow(1.0 - value/44330.0, 5.255)
379376

380377
####################### Internal helpers ################################
381378
def _read_coefficients(self) -> None:

0 commit comments

Comments
 (0)