Added One-Shot Ranging trigger #41
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been exploring sweeping the ROI around to get a "2d" lidar out of each VL53L1x and found that with continuous ranging (StartRanging/StopRanging), the sensor wasn't "taking" the updated ROI consistantly.
I tried waiting for a reading to complete, then stopping the ranging operation in the gap between the timing budget and inter-measurement period, but this was really fragile and would frequently stop working and I'd get results from the wrong SPAD ROI, even though reading the SPAD ROI showed the correct number (which I might put in as another PR with some ROI setting improvements I'm working on).
I think it's just a problem in the internal sensor state machine, where calling stop doesn't take effect immediately, and the ROI settings applied when ranging is active don't work (the datasheet errata talks about how setting ROI when ranging is invalid, but doesn't elaborate).
With this method, I can 100% reliably set the ROI, trigger ranging, then get a single result in a loop, wheras before I had to start, get the results, and stop all spaced out by carefully tuned magic delay numbers.
I tried to match the existing code style in each file, but I'm open to suggestions.