File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change 1
1
name =SparkFun VL53L1X 4m Laser Distance Sensor
2
- version =1.2.8
2
+ version =1.2.9
3
3
author =SparkFun Electronics <techsupport@sparkfun.com>
4
4
maintainer =SparkFun Electronics <sparkfun.com>
5
5
sentence =Library for the SparkFun Qwiic 4m Distance Sensor - VL53L1X
Original file line number Diff line number Diff line change @@ -166,28 +166,23 @@ VL53L1X_ERROR VL53L1X::VL53L1X_SetI2CAddress(uint8_t new_address)
166
166
VL53L1X_ERROR VL53L1X::VL53L1X_SensorInit ()
167
167
{
168
168
VL53L1X_ERROR status = 0 ;
169
- uint8_t Addr = 0x00 , tmp = 0 , timeout = 0 ;
169
+ uint8_t Addr = 0x00 , dataReady = 0 , timeout = 0 ;
170
170
171
171
for (Addr = 0x2D ; Addr <= 0x87 ; Addr++)
172
172
{
173
173
status = VL53L1_WrByte (Device, Addr, VL51L1X_DEFAULT_CONFIGURATION[Addr - 0x2D ]);
174
174
}
175
175
status = VL53L1X_StartRanging ();
176
176
177
- delay ( 103 ); // Wait the default intermeasurement period of 103ms before checking for dataready
178
-
179
- while (tmp == 0 )
177
+ // We need to wait at least the default intermeasurement period of 103ms before dataready will occur
178
+ // But if a unit has already been powered and polling, it may happen much faster
179
+ while (dataReady == 0 )
180
180
{
181
- status = VL53L1X_CheckForDataReady (&tmp);
182
- timeout++;
183
- if (timeout > 50 )
184
- {
185
- status = VL53L1_ERROR_TIME_OUT;
186
- return status;
187
- }
181
+ status = VL53L1X_CheckForDataReady (&dataReady);
182
+ if (timeout++ > 150 )
183
+ return VL53L1_ERROR_TIME_OUT;
188
184
delay (1 );
189
185
}
190
- tmp = 0 ;
191
186
status = VL53L1X_ClearInterrupt ();
192
187
status = VL53L1X_StopRanging ();
193
188
status = VL53L1_WrByte (Device, VL53L1_VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND, 0x09 ); /* two bounds VHV */
You can’t perform that action at this time.
0 commit comments