adafruit/Adafruit_CircuitPython_VL53L0X

Cannot turn vl53l0x on after shutdown

Closed this issue · 6 comments

Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit Feather M4 Express with samd51j19

The VL53L0X does not appear to return from shutdown mode. When SHDN has been brought low, and then high, the next read of the sensor will hang. See wiring here:

Vl53L0x

Code is:

lee_vl53L0x.txt

Documentation at:
https://learn.adafruit.com/adafruit-vl53l0x-micro-lidar-distance-sensor-breakout/pinouts

seems to indicate this pin is already pulled high. Does the board require additional pull-up in circuit? Is there a fault in the library?

I've transferred this issue to the driver repo. It's probably better asked on the forum as well: https://forums.adafruit.com/viewforum.php?f=60 Issues are usually just for fixing confirmed faults in a library.

whenever you shut down the sensor, you'll need to fully reinitialize it - that's done in sensor = adafruit_vl53l0x.VL53L0X(i2c) so the object will need to be recreated

Would it work to refactor all that init stuff out into a separate function that could then be called without recreating?

i think for now its best to just re-create, the old one will get garbage collected :)

Would it work to refactor all that init stuff out into a separate function that could then be called without recreating?

I wouldn't expose an init() directly. If anything, I'd take in the shutdown digitalio and then have a property for shutdown. That way the driver can manage shutdown and re-init internally.

I think we can close this. It's not really a bug. @tannewt 's suggestion would be good if having this driver manage the GPIO attached to XSHUT (SHDN) was desired. But @ladyada 's suggestion is easiest and should work with current driver.

If there really is a need or desire to manage XSHUT here, can reopen as a "feature request".