File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11name =SparkFun VL53L1X 4m Laser Distance Sensor
2- version =1.2.2
2+ version =1.2.3
33author =SparkFun Electronics <techsupport@sparkfun.com>
44maintainer =SparkFun Electronics <sparkfun.com>
55sentence =Library for the SparkFun Qwiic 4m Distance Sensor - VL53L1X
Original file line number Diff line number Diff line change @@ -173,14 +173,20 @@ VL53L1X_ERROR VL53L1X::VL53L1X_SetI2CAddress(uint8_t new_address)
173173VL53L1X_ERROR VL53L1X::VL53L1X_SensorInit ()
174174{
175175 VL53L1X_ERROR status = 0 ;
176- uint8_t Addr = 0x00 , tmp=0 ;
176+ uint8_t Addr = 0x00 , tmp=0 , timeout = 0 ;
177177
178178 for (Addr = 0x2D ; Addr <= 0x87 ; Addr++){
179179 status = VL53L1_WrByte (Device, Addr, VL51L1X_DEFAULT_CONFIGURATION[Addr - 0x2D ]);
180180 }
181181 status = VL53L1X_StartRanging ();
182182 while (tmp==0 ){
183- status = VL53L1X_CheckForDataReady (&tmp);
183+ status = VL53L1X_CheckForDataReady (&tmp);
184+ timeout++;
185+ if (timeout > 50 )
186+ {
187+ status = VL53L1_ERROR_TIME_OUT;
188+ return status;
189+ }
184190 }
185191 tmp = 0 ;
186192 status = VL53L1X_ClearInterrupt ();
You can’t perform that action at this time.
0 commit comments