Skip to content

Commit

Permalink
ui/map_instructions: round <500 distances (commaai#29333)
Browse files Browse the repository at this point in the history
round
  • Loading branch information
sshane authored and Edison-CBS committed Aug 11, 2023
1 parent c20fef7 commit 8af79fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions selfdrive/ui/qt/maps/map_instructions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ QString MapInstructions::getDistance(float d) {
d = std::max(d, 0.0f);
if (uiState()->scene.is_metric) {
return (d > 500) ? QString::number(d / 1000, 'f', 1) + tr(" km")
: QString::number(50 * int(d / 50)) + tr(" m");
: QString::number(50 * qRound(d / 50)) + tr(" m");
} else {
float feet = d * METER_TO_FOOT;
return (feet > 500) ? QString::number(d * METER_TO_MILE, 'f', 1) + tr(" mi")
: QString::number(50 * int(feet / 50)) + tr(" ft");
: QString::number(50 * qRound(feet / 50)) + tr(" ft");
}
}

Expand Down

0 comments on commit 8af79fc

Please sign in to comment.