Skip to content

Commit 1b3592d

Browse files
committed
Update gain and error description to use tables
1 parent 96132c8 commit 1b3592d

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

adafruit_vl6180x.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,22 @@ def _read_range_continuous(self) -> int:
232232
def read_lux(self, gain: int) -> float:
233233
"""Read the lux (light value) from the sensor and return it. Must
234234
specify the gain value to use for the lux reading:
235-
- ALS_GAIN_1 = 1x
236-
- ALS_GAIN_1_25 = 1.25x
237-
- ALS_GAIN_1_67 = 1.67x
238-
- ALS_GAIN_2_5 = 2.5x
239-
- ALS_GAIN_5 = 5x
240-
- ALS_GAIN_10 = 10x
241-
- ALS_GAIN_20 = 20x
242-
- ALS_GAIN_40 = 40x
235+
236+
================= =====
237+
Setting Value
238+
================= =====
239+
``ALS_GAIN_1`` 1x
240+
``ALS_GAIN_1_25`` 1.25x
241+
``ALS_GAIN_1_67`` 1.67x
242+
``ALS_GAIN_2_5`` 2.5x
243+
``ALS_GAIN_5`` 5x
244+
``ALS_GAIN_10`` 10x
245+
``ALS_GAIN_20`` 20x
246+
``ALS_GAIN_40`` 40x
247+
================= =====
243248
244249
:param int gain: The gain value to use
250+
245251
"""
246252
reg = self._read_8(_VL6180X_REG_SYSTEM_INTERRUPT_CONFIG)
247253
reg &= ~0x38
@@ -290,17 +296,22 @@ def range_status(self) -> int:
290296
"""Retrieve the status/error from a previous range read. This will
291297
return a constant value such as:
292298
293-
- ERROR_NONE - No error
294-
- ERROR_SYSERR_1 - System error 1 (see datasheet)
295-
- ERROR_SYSERR_5 - System error 5 (see datasheet)
296-
- ERROR_ECEFAIL - ECE failure
297-
- ERROR_NOCONVERGE - No convergence
298-
- ERROR_RANGEIGNORE - Outside range ignored
299-
- ERROR_SNR - Too much noise
300-
- ERROR_RAWUFLOW - Raw value underflow
301-
- ERROR_RAWOFLOW - Raw value overflow
302-
- ERROR_RANGEUFLOW - Range underflow
303-
- ERROR_RANGEOFLOW - Range overflow
299+
===================== ==============================
300+
Error Description
301+
===================== ==============================
302+
``ERROR_NONE`` No error
303+
``ERROR_SYSERR_1`` System error 1 (see datasheet)
304+
``ERROR_SYSERR_5`` System error 5 (see datasheet)
305+
``ERROR_ECEFAIL`` ECE failure
306+
``ERROR_NOCONVERGE`` No convergence
307+
``ERROR_RANGEIGNORE`` Outside range ignored
308+
``ERROR_SNR`` Too much noise
309+
``ERROR_RAWUFLOW`` Raw value underflow
310+
``ERROR_RAWOFLOW`` Raw value overflow
311+
``ERROR_RANGEUFLOW`` Range underflow
312+
``ERROR_RANGEOFLOW`` Range overflow
313+
===================== ==============================
314+
304315
"""
305316
return self._read_8(_VL6180X_REG_RESULT_RANGE_STATUS) >> 4
306317

0 commit comments

Comments
 (0)