File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -170,15 +170,17 @@ def range_history_enabled(self) -> bool:
170
170
def start_range_continuous (self , period : int = 100 ) -> None :
171
171
"""Start continuous range mode
172
172
173
- :param int period: Time delay between measurements, in milliseconds
173
+ :param int period: Time delay between measurements, in milliseconds; the value you
174
+ will be floored to the nearest 10 milliseconds (setting to 157 ms sets it to 150
175
+ ms). Range is 10 - 2550 ms.
174
176
"""
175
177
# Set range between measurements
176
- period_reg : int = 0
177
- if period > 10 :
178
- if period < 2250 :
179
- period_reg = ( period // 10 ) - 1
180
- else :
181
- period_reg = 254
178
+ if not 10 <= period <= 2550 :
179
+ raise ValueError (
180
+ "Delay must be in 10 millisecond increments between 10 and 2550 milliseconds"
181
+ )
182
+
183
+ period_reg = ( period // 10 ) - 1
182
184
self ._write_8 (_VL6180X_REG_SYSRANGE_INTERMEASUREMENT_PERIOD , period_reg )
183
185
184
186
# Start continuous range measurement
You can’t perform that action at this time.
0 commit comments