Skip to content

Commit 2e2340a

Browse files
Tinyu-Zhaolbuque
authored andcommitted
lib/unit: Fixed the abnormal reading of weight_i2c.
Signed-off-by: tinyu <[email protected]>
1 parent 2de530f commit 2e2340a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

m5stack/libs/unit/ultrasonic_i2c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def get_target_distance(self, mode=1):
2626
data = self.i2c.readfrom(self.i2c_addr, 3)
2727
self._distance = ((data[0] << 16) | (data[1] << 8) | data[2]) / 1000
2828
except OSError:
29-
pass
29+
return -1
3030
if mode == 2:
3131
self._distance = self._distance / 10
3232
return round(self._distance, 2)

0 commit comments

Comments
 (0)