|
|
|
@ -26,7 +26,15 @@ class Table:
|
|
|
|
|
|
|
|
|
|
Might return False if measuring error. |
|
|
|
|
""" |
|
|
|
|
distance = self.hcsr04.distance_cm() |
|
|
|
|
|
|
|
|
|
distances = [] |
|
|
|
|
|
|
|
|
|
# Measure a bunch of times... |
|
|
|
|
for x in range(0, 20): |
|
|
|
|
distances.append(self.hcsr04.distance_cm()) |
|
|
|
|
|
|
|
|
|
# Take the longest distance, I've not seen any that is too far |
|
|
|
|
distance = max(distances) |
|
|
|
|
|
|
|
|
|
if distance > 0: |
|
|
|
|
return distance |
|
|
|
|