Skip to content

Commit e9d2a0e

Browse files
committed
int get_avg_range_bottom_mm() {
1 parent 423878c commit e9d2a0e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/sensor_tof_matrix.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ class SensorTofMatrix{
164164
return bottom_max;
165165
}
166166

167+
int get_avg_range_bottom_mm() {
168+
169+
int16_t _avg = 0;
170+
uint8_t n = 0;
171+
172+
for (int i=(_size==4?12:48); i < (_size==4?15:63) ;i++) {
173+
_avg += results.distance_mm[i];
174+
n++;
175+
}
176+
177+
return _avg/n;
178+
}
179+
167180
int get_min_range_left_mm() {
168181

169182
int16_t _min = results.distance_mm[0];

0 commit comments

Comments
 (0)