Skip to content

wants : change for three distance modes #11

Open
@halcyon1945

Description

@halcyon1945

Hi,
this issue is feature request .

VL53L1X chip datasheet say distance_mode has three enums.
short,middle and long.
but this library set only two. short and long.

@property
def distance_mode(self):
"""The distance mode. 1=short, 2=long."""
mode = self._read_register(_PHASECAL_CONFIG__TIMEOUT_MACROP)[0]
if mode == 0x14:
return 1 # short distance
if mode == 0x0A:
return 2 # long distance
return None # unknown
@distance_mode.setter
def distance_mode(self, mode):
if mode == 1:
# short distance
self._write_register(_PHASECAL_CONFIG__TIMEOUT_MACROP, b"\x14")
self._write_register(_RANGE_CONFIG__VCSEL_PERIOD_A, b"\x07")
self._write_register(_RANGE_CONFIG__VCSEL_PERIOD_B, b"\x05")
self._write_register(_RANGE_CONFIG__VALID_PHASE_HIGH, b"\x38")
self._write_register(_SD_CONFIG__WOI_SD0, b"\x07\x05")
self._write_register(_SD_CONFIG__INITIAL_PHASE_SD0, b"\x06\x06")
elif mode == 2:
# long distance
self._write_register(_PHASECAL_CONFIG__TIMEOUT_MACROP, b"\x0A")
self._write_register(_RANGE_CONFIG__VCSEL_PERIOD_A, b"\x0F")
self._write_register(_RANGE_CONFIG__VCSEL_PERIOD_B, b"\x0D")
self._write_register(_RANGE_CONFIG__VALID_PHASE_HIGH, b"\xB8")
self._write_register(_SD_CONFIG__WOI_SD0, b"\x0F\x0D")
self._write_register(_SD_CONFIG__INITIAL_PHASE_SD0, b"\x0E\x0E")
else:
raise ValueError("Unsupported mode.")

could your change for three mode?

see this datasheet and section 2.5.1 Distance mode.
https://www.st.com/resource/en/datasheet/vl53l1x.pdf

thanks.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions