summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-02-14 10:18:08 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-02-14 10:53:33 +0100
commit09a4248c50708c1e54d32b3a260112d29ea268c1 (patch)
tree3956f057dd391efc3438b3f2aa42bf1f1ced5591 /src/driver
parent87c9f081f972443fdbb4bae724f2a1978dc70139 (diff)
bme680-max44009-logger: improve resilience against bad wiring
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/max44009.cc4
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];