We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2de530f commit 2e2340aCopy full SHA for 2e2340a
m5stack/libs/unit/ultrasonic_i2c.py
@@ -26,7 +26,7 @@ def get_target_distance(self, mode=1):
26
data = self.i2c.readfrom(self.i2c_addr, 3)
27
self._distance = ((data[0] << 16) | (data[1] << 8) | data[2]) / 1000
28
except OSError:
29
- pass
+ return -1
30
if mode == 2:
31
self._distance = self._distance / 10
32
return round(self._distance, 2)
0 commit comments