Skip to content

Commit 3d75699

Browse files
committed
Wait one intermeasurement period at POR before attempting init.
Fix for issue #37.
1 parent 50bfe62 commit 3d75699

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/vl53l1x_class.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ VL53L1X_ERROR VL53L1X::VL53L1X_SensorInit()
173173
status = VL53L1_WrByte(Device, Addr, VL51L1X_DEFAULT_CONFIGURATION[Addr - 0x2D]);
174174
}
175175
status = VL53L1X_StartRanging();
176+
177+
delay(103); //Wait the default intermeasurement period of 103ms before checking for dataready
178+
176179
while (tmp == 0)
177180
{
178181
status = VL53L1X_CheckForDataReady(&tmp);
@@ -182,6 +185,7 @@ VL53L1X_ERROR VL53L1X::VL53L1X_SensorInit()
182185
status = VL53L1_ERROR_TIME_OUT;
183186
return status;
184187
}
188+
delay(1);
185189
}
186190
tmp = 0;
187191
status = VL53L1X_ClearInterrupt();

0 commit comments

Comments
 (0)