@@ -144,7 +144,6 @@ def __init__(self, i2c_bus, address=_LPS2X_DEFAULT_ADDRESS, chip_id=None):
144
144
raise RuntimeError (
145
145
"Failed to find LPS2X! Found chip ID 0x%x" % self ._chip_id
146
146
)
147
-
148
147
self .reset ()
149
148
self .initialize ()
150
149
sleep (0.010 ) # delay 10ms for first reading
@@ -174,8 +173,11 @@ def pressure(self):
174
173
@property
175
174
def temperature (self ):
176
175
"""The current temperature measurement in degrees C"""
176
+
177
177
raw_temperature = self ._raw_temperature
178
- return (raw_temperature / self ._temp_scaling ) + 42.5 # pylint:disable=no-member
178
+ return (
179
+ raw_temperature / self ._temp_scaling # pylint:disable=no-member
180
+ ) + self ._temp_offset # pylint:disable=no-member
179
181
180
182
@property
181
183
def data_rate (self ):
@@ -222,10 +224,10 @@ def __init__(self, i2c_bus, address=_LPS2X_DEFAULT_ADDRESS):
222
224
("LPS25_RATE_25_HZ" , 4 , 25 , None ),
223
225
)
224
226
)
225
-
226
227
super ().__init__ (i2c_bus , address , chip_id = _LPS25HB_CHIP_ID )
227
228
228
229
self ._temp_scaling = 480
230
+ self ._temp_offset = 42.5
229
231
# self._inc_spi_flag = 0x40
230
232
231
233
def initialize (self ):
@@ -249,9 +251,7 @@ class LPS22(LPS2X):
249
251
_reset = RWBit (_LPS22_CTRL_REG2 , 2 )
250
252
_data_rate = RWBits (3 , _LPS22_CTRL_REG1 , 4 )
251
253
252
- def __init__ (
253
- self , i2c_bus , address = _LPS2X_DEFAULT_ADDRESS , chip_id = _LPS22HB_CHIP_ID
254
- ):
254
+ def __init__ (self , i2c_bus , address = _LPS2X_DEFAULT_ADDRESS ):
255
255
# Only adding Class-appropriate rates
256
256
Rate .add_values (
257
257
(
@@ -264,12 +264,12 @@ def __init__(
264
264
)
265
265
)
266
266
267
- super ().__init__ (i2c_bus , address )
267
+ super ().__init__ (i2c_bus , address , chip_id = _LPS22HB_CHIP_ID )
268
268
self ._temp_scaling = 100
269
+ self ._temp_offset = 0
269
270
270
271
def initialize (self ):
271
272
"""Configure the sensor with the default settings. For use after calling `reset()`"""
272
- # self.enabled = True
273
273
self .data_rate = Rate .LPS22_RATE_75_HZ # pylint:disable=no-member
274
274
275
275
# void configureInterrupt(bool activelow, bool opendrain, bool data_ready,
0 commit comments