@@ -197,7 +197,7 @@ def _poll_reg1(self, mask):
197197
198198 @property
199199 def pressure (self ):
200- """Read the barometric pressure detected by the sensor in Pascals ."""
200+ """Read the barometric pressure detected by the sensor in Hectopascals ."""
201201 # First poll for a measurement to be finished.
202202 self ._poll_reg1 (_MPL3115A2_CTRL_REG1_OST )
203203 # Set control bits for pressure reading.
@@ -254,7 +254,7 @@ def altitude(self):
254254
255255 @property
256256 def temperature (self ):
257- """Read the temperature as measured by the sensor in degrees Celsius."""
257+ """Read the temperature as measured by the sensor in Celsius."""
258258 # First poll for a measurement to be finished.
259259 self ._poll_reg1 (_MPL3115A2_CTRL_REG1_OST )
260260 # Initatiate a one-shot measurement
@@ -278,16 +278,16 @@ def temperature(self):
278278 def sealevel_pressure (self ):
279279 """Read and write the pressure at sea-level used to calculate altitude.
280280 You must look this up from a local weather or meteorological report for
281- the best accuracy. This is a value in Pascals .
281+ the best accuracy. This is a value in Hectopascals .
282282 """
283283 # Read the sea level pressure in bars.
284284 self ._read_into (_MPL3115A2_BAR_IN_MSB , self ._BUFFER , count = 2 )
285- # Reconstruct 16-bit value and scale back to pascals .
285+ # Reconstruct 16-bit value and scale back to Hectopascals .
286286 pressure = (self ._BUFFER [0 ] << 8 ) | self ._BUFFER [1 ]
287- return pressure * 2.0
287+ return pressure * 2.0 / 100
288288
289289 @sealevel_pressure .setter
290290 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 )
293293 self ._write_u16_be (_MPL3115A2_BAR_IN_MSB , bars )
0 commit comments