diff --git a/qwiic_vl53l1x.py b/qwiic_vl53l1x.py index e1f6459..3cfc7f3 100644 --- a/qwiic_vl53l1x.py +++ b/qwiic_vl53l1x.py @@ -601,6 +601,27 @@ def init_sensor(self, address): + # VL53L1X_api_core.h functions + ############################################################################### + ############################################################################### + + def soft_reset(self): + """ + This function causes the device to perform a soft reset + """ + self_status = 0 + + self.status = self.__i2cWrite(self.address, SOFT_RESET, 0, 1) + if (not self.status): + time.sleep(0.001) + if (not self.status): + self.status = self.__i2cWrite(self.address, SOFT_RESET, 1, 1) + + return self.status + + + + # VL53L1X_api.h functions ############################################################################### ############################################################################### @@ -654,7 +675,7 @@ def sensor_init(self): while(tmp == 0): tmp = self.check_for_data_ready() timeout = timeout + 1 - if (timeout > 50): + if (timeout > 500): self.status = VL53L1_ERROR_TIME_OUT return self.status