Question
Range Status 6 with VL53L1X
Hi
I'm getting range status 6 while I'm reading the sensor, which corresponds to (No Update) Status.
Test code (kept the necessary debugging prints):
int16_t getDistance(void)
{
int status = VL53L1_StartMeasurement(Dev);
uint8_t firstTimeInterrupt = 1;
static VL53L1_RangingMeasurementData_t RangingData;
do /* interrupt mode */
{
__WFI();
// SENSOR_DEBUGF("got an interrupt,IntCount=%d\n", IntCount));
if (IntCount != 0)
{ // Is this necessary ? >> yes.
IntCount = 0;
if (firstTimeInterrupt == 0)
{
status = VL53L1_GetRangingMeasurementData(Dev, &RangingData);
if (status == 0)
{
Serial.printf("Status:%d\tD=%d\tSignalC=%u\tAmbientC=%u\n", RangingData.RangeStatus, RangingData.RangeMilliMeter,
RangingData.SignalRateRtnMegaCps / 65536.0, RangingData.AmbientRateRtnMegaCps / 65336.0);
}
status = VL53L1_ClearInterruptAndStartMeasurement(Dev);
return RangingData.RangeMilliMeter;
}
else
{ /* Must not read data at the first interrupt, must clear interrupt and start measurement */
status = VL53L1_ClearInterruptAndStartMeasurement(Dev);
firstTimeInterrupt = 0;
}
}
} while (1);
}What's interesting is the sensor reads and correctly prints the range:
> Status:6 D=60 SignalC=0 AmbientC=1076956160
The used library is: STSW-IMG007_v2.4.5.
