Skip to content

Commit

Permalink
Fixed bug that caused the initialization to hang if the chip had alre…
Browse files Browse the repository at this point in the history
…ady been started from a previous run. This is fixed by soft-restarting the chip.
  • Loading branch information
SkibbleBip committed Oct 29, 2023
1 parent 1f07c7b commit 59fe037
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/VL53L1X.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ VL53L1X::VL53L1X(
decimal(0.0) {}

void VL53L1X::initialize() {
// TODO: soft-restart, GPIO restart (?)
// TODO: GPIO restart (?)

//soft restart, as if chip is already previously started on init,
//then this method hangs
this->i2cBus.write8(this->address, SOFT_RESET, 0x0);
this->i2cBus.write8(this->address, SOFT_RESET, 0x1);

// Write the default configuration, registers 0x2D to 0x87
for (uint8_t configAddr = 0x2D; configAddr <= 0x87; configAddr++) {
Expand Down

0 comments on commit 59fe037

Please sign in to comment.