Description
I have a Trinket M0 with the module connected to gpio pins 0/2 and gpio pin 3 as a pwm output for an LED (through a transistor). Circuitpython bundle build is 3.x dated 20180809 with the 3.0.0 uf2 firmware.
For some reason with the default configuration the sensor is taking approximately 2 seconds to take a reading:
sensor distance 8191mm, time 2.08398
sensor distance 257mm, time 2.08203
sensor distance 190mm, time 2.08203
sensor distance 294mm, time 2.08179
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_vl53l0x.VL53L0X(i2c)
#sensor.measurement_timing_budget = 20000
while True:
start = time.monotonic()
distance = sensor.range
print("sensor distance " + str(distance) + "mm, time " + str(time.monotonic() - start))
Dropping the timing budget to 20ms helps by roughly 300ms and in both modes there is the occasional fast read:
sensor distance 8191mm, time 1.76489
sensor distance 8190mm, time 0.0290527
sensor distance 8190mm, time 1.76611
sensor distance 149mm, time 1.76904
sensor distance 212mm, time 1.76587
sensor distance 296mm, time 1.76392
sensor distance 8190mm, time 1.76611
Any idea what would cause such a delay?