Further quirks with VL53L1X distance sensor

I think the problems were down to the way I was initialising the script. I’ve moved things around a bit and now have both sensors working fine on all three initialisation parameter values for tof.start_ranging() 1,2 and 3. So I think this can be closed!!!

(I’ve just bought a second VL53L1X sensor. As previously noted, I had problems with the first one in running a modified graph.py script which sent the resulting range to Sonic Pi via OSC calls using the python-osc library. I am running the script under python3.

I had a sort of “jitter” although that is not perhaps the right word. Essentially when there was nothing in range the clamped max range of 800 would periodically alternate with the previous last reading below 800. This did not happen with version 0.0.1 of the python library for the sensor. The solution for the first sensor I had was to change the tof.start_ranging parameter from 1 to 2.

The second sensor I received had a different version number. It was ProductRevisionMajor 1, ProductRevisionMinor 9, ie an older version, whereas the first one was ProductRevisionMajor 1, ProductRevisionMinor 15.
The second sensor does not behave in the script when started with tof.start_ranging parameter 1 or 2, but works fine with using parameter 3.
So effectively I have to tailor the script depending upon which sensor I am using, which is rather tedious.)

Until now I had no idea the sensors had different revisions- in fact I’m more inclined to believe that’s a bug in the library or the i2c transport than an actually different hardware revision.

I haven’t had time to look into this in any depth yet, but it clearly needs doing. I’d also like to get to the bottom of how to use multiple sensors simultaneously- IE setting different i2c addresses.