2021-03-07 04:20 AM
The function VL53L1X_SetDistanceThreshold has as a comment that the parameter IntOnNoTarget should no longer be used. I also found in my tests that the configuration has no effect. Can someone provide more information on this?
// @param IntOnNoTarget = 0 (No longer used - just use 0)
VL53L1X_ERROR VL53L1X_SetDistanceThreshold(uint16_t dev, uint16_t ThreshLow, uint16_t ThreshHigh, uint8_t Window, uint8_t IntOnNoTarget);
What I also found that the GPIO interrupt "above" is not triggered without a wall / ceiling in the background of the measuring range.
How to reproduce?
However, if you do not remove your hand to the side, but upwards away from the sensor, the interrupt is recognized. Is that a weakness of ToF or of the sensor? Can you set a timeout within the sensor so that an interrupt is triggered?
2021-03-08 07:40 AM
When the sensor gets an answer and there is a threshold set, a bit of logic decides if the interrupt should be triggered based on the result of the range.
But if the range fails for some reason there is no 'answer' and so the interrupt logic is not called.
Using the p-Nucleo-53l1A1 evaluation board, I see using short range, when there is no target one gets an RangeStatus of 4.
RangeStatus 4 is VL53L1_RANGESTATUS_OUTOFBOUNDS_FAIL, which sounds reasonable as there is no target.
One could, in your situation, use a threshold to detect the initial presence of the hand.
Then disable thresholds and pay attention to each range result looking for either a range above 30cm or a RangeStatus=4.
At that point you can do whatever you have to do when the hand leaves and go back to threshold mode.
One other thing you might try - change the mode from short to long.
You won't get any 4 errors in long mode.
However other errors pop up and you might be back where you started.
But if you have the Eval kit these tests are quick an easy.