Signal threshold not working as expected?
I'm using a VL53L1X ToF sensor to measure distance with the Ultra Lite driver. I've lowered the signal threshold to 400 because that value seems to cover most valid measurements. When I read the current signal value using GetSignalRate(). When my signal rate is, for example, 600, I still get range status 2 (signalfail). What causes this?
Code I use to measure:
Sensor->Begin();
Sensor->SetTimingBudgetInMs(500);
Sensor->SetSignalThreshold(400);
Sensor->StartRanging();
Sensor->getDistanceOptimal(DistanceMM, SensorStatus);
Sensor->StopRanging();And my getDistanceOptimal() method:
this->SetDistanceMode(EDistanceMode::Short);
uint8_t dataReady = false;
while(!dataReady) {
this->CheckForDataReady(&dataReady);
//code for 5 ms delay here
}
this->GetDistanceInMm(&distance);
this->GetRangeStatus(&status);
//Retry with higher distancemode
if(status != ERangeStatus::RangeValid) {
this->SetDistanceMode(EDistanceMode::Long);
//code for 100ms delay here
this->ClearInterrupt();
while(!dataReady) {
this->CheckForDataReady(&dataReady);
//code for 5ms delay here
}
this->GetDistanceInMm(&distance);
this->GetRangeStatus(&status);
}
this->ClearInterrupt();