File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -288,6 +288,6 @@ def sealevel_pressure(self):
288
288
289
289
@sealevel_pressure .setter
290
290
def sealevel_pressure (self , val ):
291
- # Convert to bars of pressure and write to the sealevel register.
292
- bars = val // 2
291
+ # Convert from hectopascals to bars of pressure and write to the sealevel register.
292
+ bars = int ( val * 50 )
293
293
self ._write_u16_be (_MPL3115A2_BAR_IN_MSB , bars )
Original file line number Diff line number Diff line change 21
21
# This value has to be looked up from your local weather forecast or meteorological
22
22
# reports. It will change day by day and even hour by hour with weather
23
23
# changes. Remember altitude estimation from barometric pressure is not exact!
24
- # Set this to a value in pascals :
25
- sensor .sealevel_pressure = 102250
24
+ # Set this to a value in hectopascals :
25
+ sensor .sealevel_pressure = 1022.5
26
26
27
27
# Main loop to read the sensor values and print them every second.
28
28
while True :
You can’t perform that action at this time.
0 commit comments