AP_RangeFinder: fixed cm to meter comparison

thanks to EShamaev for this fix (see PR #1352)
This commit is contained in:
Andrew Tridgell 2015-04-30 11:26:36 +10:00
parent 75c9689a64
commit 4c4a4f9ea5
1 changed files with 2 additions and 2 deletions

View File

@ -107,8 +107,8 @@ void AP_RangeFinder_analog::update(void)
dist_m = 0; dist_m = 0;
} }
dist_m = scaling / (v - offset); dist_m = scaling / (v - offset);
if (isinf(dist_m) || dist_m > max_distance_cm) { if (isinf(dist_m) || dist_m > max_distance_cm * 0.01f) {
dist_m = max_distance_cm * 0.01; dist_m = max_distance_cm * 0.01f;
} }
break; break;
} }