diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-02-14 10:18:08 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-02-14 10:53:33 +0100 |
commit | 09a4248c50708c1e54d32b3a260112d29ea268c1 (patch) | |
tree | 3956f057dd391efc3438b3f2aa42bf1f1ced5591 /src/driver | |
parent | 87c9f081f972443fdbb4bae724f2a1978dc70139 (diff) |
bme680-max44009-logger: improve resilience against bad wiring
Diffstat (limited to 'src/driver')
-rw-r--r-- | src/driver/max44009.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/driver/max44009.cc b/src/driver/max44009.cc index d09188c..e124787 100644 --- a/src/driver/max44009.cc +++ b/src/driver/max44009.cc @@ -19,7 +19,9 @@ float MAX44009::getLux() txbuf[0] = 0x03; txbuf[1] = 0x04; - i2c.xmit(address, 2, txbuf, 2, rxbuf); + if (i2c.xmit(address, 2, txbuf, 2, rxbuf) != 0) { + return -1; + } luxHigh = rxbuf[0]; luxLow = rxbuf[1]; |