Skip to content

Commit 19efbfe

Browse files
committed
feat(bme280): Raise on NVM copy timeout in _wait_boot.
1 parent d1d9845 commit 19efbfe

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/bme280/bme280/device.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
SOFT_RESET_CMD,
1717
STATUS_IM_UPDATE,
1818
)
19-
from bme280.exceptions import BME280InvalidDevice, BME280NotFound
19+
from bme280.exceptions import BME280Error, BME280InvalidDevice, BME280NotFound
2020

2121

2222
class BME280(object):
@@ -74,11 +74,12 @@ def _configure_default(self):
7474
)
7575

7676
def _wait_boot(self, timeout_ms=50):
77-
"""Wait for NVM data copy to complete."""
77+
"""Wait for NVM data copy to complete. Raises on timeout."""
7878
for _ in range(timeout_ms // 5):
7979
if not (self._read_reg(REG_STATUS) & STATUS_IM_UPDATE):
8080
return
8181
sleep_ms(5)
82+
raise BME280Error("BME280 NVM copy timeout")
8283

8384
def device_id(self):
8485
"""Read chip ID register. Expected: 0x60."""

0 commit comments

Comments
 (0)