File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -170,15 +170,16 @@ 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 will be floored
174
+ to the nearest 10 milliseconds (setting to 157 ms sets it to 150 ms). Range is 10 - 2550 ms.
174
175
"""
175
176
# 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
177
+ if not 10 <= period <= 2550 :
178
+ raise ValueError (
179
+ "Delay must be in 10 millisecond increments between 10 and 2550 milliseconds"
180
+ )
181
+
182
+ period_reg = ( period // 10 ) - 1
182
183
self ._write_8 (_VL6180X_REG_SYSRANGE_INTERMEASUREMENT_PERIOD , period_reg )
183
184
184
185
# Start continuous range measurement
You can’t perform that action at this time.
0 commit comments