Kilometers per hour now displayed as km/h (#2032)

Fixes #2031

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
pull/2036/head
Chris 5 years ago committed by GitHub
parent 160c89cde6
commit 1b52930a52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      selfdrive/controls/lib/events.py
  2. 2
      selfdrive/ui/paint.cc

@ -176,7 +176,7 @@ class EngagementAlert(Alert):
def below_steer_speed_alert(CP, sm, metric):
speed = int(round(CP.minSteerSpeed * (CV.MS_TO_KPH if metric else CV.MS_TO_MPH)))
unit = "kph" if metric else "mph"
unit = "km/h" if metric else "mph"
return Alert(
"TAKE CONTROL",
"Steer Unavailable Below %d %s" % (speed, unit),
@ -185,7 +185,7 @@ def below_steer_speed_alert(CP, sm, metric):
def calibration_incomplete_alert(CP, sm, metric):
speed = int(Filter.MIN_SPEED * (CV.MS_TO_KPH if metric else CV.MS_TO_MPH))
unit = "kph" if metric else "mph"
unit = "km/h" if metric else "mph"
return Alert(
"Calibration in Progress: %d%%" % sm['liveCalibration'].calPerc,
"Drive Above %d %s" % (speed, unit),

@ -516,7 +516,7 @@ static void ui_draw_vision_speed(UIState *s) {
snprintf(speed_str, sizeof(speed_str), "%d", (int)speed);
ui_draw_text(s->vg, viz_speed_x + viz_speed_w / 2, 240, speed_str, 96*2.5, COLOR_WHITE, s->font_sans_bold);
ui_draw_text(s->vg, viz_speed_x + viz_speed_w / 2, 320, s->is_metric?"kph":"mph", 36*2.5, COLOR_WHITE_ALPHA(200), s->font_sans_regular);
ui_draw_text(s->vg, viz_speed_x + viz_speed_w / 2, 320, s->is_metric?"km/h":"mph", 36*2.5, COLOR_WHITE_ALPHA(200), s->font_sans_regular);
}
static void ui_draw_vision_event(UIState *s) {

Loading…
Cancel
Save