2024-09-16 06:54 AM
I am getting occasional readings from this sensor of zero(0) reading result with the error code 31. According to the header file this error corresponds to:
#define VL53L1X_WARNING_OFFSET_CAL_MISSING_SAMPLES ((VL53L1X_Error) - 31)
/*!< Thrown if there is less than the requested number of
* valid samples. */
This is not during Calibration offset process, which we do use, but at run time after SetOffset using the stored offset value.
Very confused why I would get this error, occasionally, at run time?
Thanks,
Will
2024-09-16 08:00 AM
That is strange indeed. Something is happening somewhere as that bit combination is not in the hardware of the device. I found nothing in all the documentation I have that shows you can get a 31.
So if the hardware is not throwing a 31, then you have to dig through the code to see what is going on.
Sorry to leave you with homework, but I have no clues as to what could be going on.
Perhaps you could add a check right after the range status is being read to see if you could trap something.
-john
2024-09-16 10:10 AM
The #define I show is taken from the vl53l1x.h file. How is that not in the hardware at all? The header file is from ST.
2024-09-16 03:23 PM
The API I use to return the status is the same I use to return the reading:
VL53L1X_ERROR VL53L1X_GetResult(VL53L1X_Result_t *pResult)
Would this change your answer?
2024-09-17 08:33 AM
Hi John,
One change to my original posting, I miswrote what the sensor reading. It is in fact 32256 not Zero.
Does this tell you anything more?
Thanks,
Will