Skip to content

Commit 4db93da

Browse files
committed
Change data_available to data_ready to match other VL series sensor drivers
1 parent eff83d4 commit 4db93da

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

adafruit_vl53l0x.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __init__(self, i2c, address=41, io_timeout_s=0):
145145
self._i2c = i2c
146146
self._device = i2c_device.I2CDevice(i2c, address)
147147
self.io_timeout_s = io_timeout_s
148-
self._data_available = False
148+
self._data_ready = False
149149
# Check identification registers for expected values.
150150
# From section 3.2 of the datasheet.
151151
if (
@@ -530,13 +530,13 @@ def range(self):
530530
return self.read_range()
531531

532532
@property
533-
def data_available(self):
533+
def data_ready(self):
534534
"""Check if data is available from the sensor. If true a call to .range
535535
will return quickly. If false, calls to .range will wait for the sensor's
536536
next reading to be available."""
537-
if not self._data_available:
538-
self._data_available = self._read_u8(_RESULT_INTERRUPT_STATUS) & 0x07 != 0
539-
return self._data_available
537+
if not self._data_ready:
538+
self._data_ready = self._read_u8(_RESULT_INTERRUPT_STATUS) & 0x07 != 0
539+
return self._data_ready
540540

541541
def do_range_measurement(self):
542542
"""Perform a single reading of the range for an object in front of the
@@ -572,7 +572,7 @@ def read_range(self):
572572
# Adapted from readRangeContinuousMillimeters in pololu code at:
573573
# https://github.com/pololu/vl53l0x-arduino/blob/master/VL53L0X.cpp
574574
start = time.monotonic()
575-
while not self.data_available:
575+
while not self.data_ready:
576576
if (
577577
self.io_timeout_s > 0
578578
and (time.monotonic() - start) >= self.io_timeout_s
@@ -582,7 +582,7 @@ def read_range(self):
582582
# fractional ranging is not enabled
583583
range_mm = self._read_u16(_RESULT_RANGE_STATUS + 10)
584584
self._write_u8(_SYSTEM_INTERRUPT_CLEAR, 0x01)
585-
self._data_available = False
585+
self._data_ready = False
586586
return range_mm
587587

588588
@property

0 commit comments

Comments
 (0)