AP_RangeFinder: Change division to multiplication

This commit is contained in:
muramura 2024-04-20 19:21:04 +09:00 committed by Peter Barker
parent 5b56d9104d
commit b85ecb9526
2 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ bool AP_RangeFinder_BLPing::get_reading(float &reading_m)
}
if (protocol.parse_byte(b) == PingProtocol::MessageId::DISTANCE_SIMPLE) {
averageStruct.count++;
averageStruct.sum_cm += protocol.get_distance_mm()/10.0f;
averageStruct.sum_cm += protocol.get_distance_mm()*0.1f;
}
}

View File

@ -78,7 +78,7 @@ bool AP_RangeFinder_LeddarVu8::get_reading(float &reading_m)
} else {
// if only out of range readings return larger of
// driver defined maximum range for the model and user defined max range + 1m
reading_m = MAX(LEDDARVU8_DIST_MAX_CM, max_distance_cm() + LEDDARVU8_OUT_OF_RANGE_ADD_CM)/100.0f;
reading_m = MAX(LEDDARVU8_DIST_MAX_CM, max_distance_cm() + LEDDARVU8_OUT_OF_RANGE_ADD_CM)*0.01f;
}
return true;
}