Skip to content

Adding waiting time as option #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions adafruit_bmp3xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@

**Hardware:**

* `Adafruit BMP388 <https://www.adafruit.com/product/3966>`_
* `Adafruit BMP388 - Precision Barometric Pressure and Altimeter
<https://www.adafruit.com/product/3966>`_ (Product ID: 3966)

**Software and Dependencies:**

* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
https://circuitpython.org/downloads

* Adafruit's Bus Device library:
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice

# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
"""

import time
Expand Down Expand Up @@ -66,6 +69,7 @@ def __init__(self):
self._read_coefficients()
self.reset()
self.sea_level_pressure = 1013.25
self._wait_time = 0.002 # change this value to have faster reads if needed
"""Sea level pressure in hPa."""

@property
Expand Down Expand Up @@ -141,7 +145,7 @@ def _read(self):

# Wait for *both* conversions to complete
while self._read_byte(_REGISTER_STATUS) & 0x60 != 0x60:
time.sleep(0.002)
time.sleep(self._wait_time)

# Get ADC values
data = self._read_register(_REGISTER_PRESSUREDATA, 6)
Expand Down