From a8cf4068db9f021128cfd9a76b4fc2b5e6ddd379 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Mon, 9 Oct 2023 18:18:23 +0200 Subject: [PATCH] Allowing the range to be set externally --- src/sensors/vl53l1x_sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sensors/vl53l1x_sensor.py b/src/sensors/vl53l1x_sensor.py index 487d724..89d1843 100644 --- a/src/sensors/vl53l1x_sensor.py +++ b/src/sensors/vl53l1x_sensor.py @@ -22,7 +22,7 @@ class VL53L1XSensor(ToFSensor): def __init__(self) -> None: super().__init__() - def open(self) -> None: + def open(self, ranging_mode: int = 2) -> None: self.sensor = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=0x29) self.sensor.open() @@ -32,7 +32,7 @@ class VL53L1XSensor(ToFSensor): # If you uncomment the line below to set a budget you # should use `tof.start_ranging(0)` # tof.set_timing(66000, 70) - self.ranging = 2 + self.ranging = ranging_mode # 0 = Unchanged # 1 = Short Range # 2 = Medium Range