Allowing the range to be set externally

This commit is contained in:
Maximilian Giller 2023-10-09 18:18:23 +02:00
parent 4adcbcd9ee
commit a8cf4068db

View file

@ -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