pololu / vl53l0x-arduino

Pololu Arduino library for VL53L0X time-of-flight distance sensor
https://www.pololu.com/product/2490
Other
346 stars 162 forks source link

Keep i2c error as bit flag which TwoWire::endTransmission() returns #49

Open dodo5522 opened 3 years ago

dodo5522 commented 3 years ago

last_status is reasonable solution to get the last status of i2c trnasmittion, but in some cases, the last_status is overwritten by calling read/write register API more than once. For instance, init(), startContinuous(), etc.

Especially on Arduino IDE 1.8.13, new error code 5 (i2c timeout) is added to Wire.endTransmission() by merging this PR https://github.com/arduino/ArduinoCore-avr/pull/107 .

You can distinguish what error occurs and use them depending on the situation.