File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -304,16 +304,16 @@ def initialize(self):
304304 # ltr.configInterrupt(true, LTR390_MODE_UVS);
305305
306306 def _reset (self ):
307- try :
308- self . _reset_bit = True
309- except OSError :
310- # The write to the reset bit will fail because it seems to not ACK before it resets
311- pass
312-
313- sleep ( 0.1 )
314- # check that reset is complete w/ the bit unset
315- if self . _reset_bit :
316- raise RuntimeError ( "Unable to reset sensor" )
307+ # The LTR390 software reset is ill behaved and can leave I2C bus in bad state.
308+ # Instead, just manually set register reset values per datasheet.
309+ with self . i2c_device as i2c :
310+ i2c . write ( bytes (( _CTRL , 0x00 )))
311+ i2c . write ( bytes (( _MEAS_RATE , 0x22 )))
312+ i2c . write ( bytes (( _GAIN , 0x01 )))
313+ i2c . write ( bytes (( _INT_CFG , 0x10 )) )
314+ i2c . write ( bytes (( _INT_PST , 0x00 )))
315+ i2c . write ( bytes (( _THRESH_UP , 0xFF , 0xFF , 0x0F )))
316+ i2c . write ( bytes (( _THRESH_LOW , 0x00 , 0x00 , 0x00 )) )
317317
318318 @property
319319 def _mode (self ):
You can’t perform that action at this time.
0 commit comments