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.
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.