|
|
@ -155,7 +155,7 @@ static void ui_draw_vision_maxspeed(UIState *s) { |
|
|
|
const int SET_SPEED_NA = 255; |
|
|
|
const int SET_SPEED_NA = 255; |
|
|
|
float maxspeed = (*s->sm)["controlsState"].getControlsState().getVCruise(); |
|
|
|
float maxspeed = (*s->sm)["controlsState"].getControlsState().getVCruise(); |
|
|
|
const bool is_cruise_set = maxspeed != 0 && maxspeed != SET_SPEED_NA; |
|
|
|
const bool is_cruise_set = maxspeed != 0 && maxspeed != SET_SPEED_NA; |
|
|
|
if (is_cruise_set && !s->scene.is_metric) { maxspeed *= 0.6225; } |
|
|
|
if (is_cruise_set && !s->scene.is_metric) { maxspeed *= KM_TO_MILE; } |
|
|
|
|
|
|
|
|
|
|
|
const Rect rect = {bdr_s * 2, int(bdr_s * 1.5), 184, 202}; |
|
|
|
const Rect rect = {bdr_s * 2, int(bdr_s * 1.5), 184, 202}; |
|
|
|
ui_fill_rect(s->vg, rect, COLOR_BLACK_ALPHA(100), 30.); |
|
|
|
ui_fill_rect(s->vg, rect, COLOR_BLACK_ALPHA(100), 30.); |
|
|
@ -172,7 +172,7 @@ static void ui_draw_vision_maxspeed(UIState *s) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void ui_draw_vision_speed(UIState *s) { |
|
|
|
static void ui_draw_vision_speed(UIState *s) { |
|
|
|
const float speed = std::max(0.0, (*s->sm)["carState"].getCarState().getVEgo() * (s->scene.is_metric ? 3.6 : 2.2369363)); |
|
|
|
const float speed = std::max(0.0, (*s->sm)["carState"].getCarState().getVEgo() * (s->scene.is_metric ? MS_TO_KPH : MS_TO_MPH)); |
|
|
|
const std::string speed_str = std::to_string((int)std::nearbyint(speed)); |
|
|
|
const std::string speed_str = std::to_string((int)std::nearbyint(speed)); |
|
|
|
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE); |
|
|
|
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE); |
|
|
|
ui_draw_text(s, s->fb_w/2, 210, speed_str.c_str(), 96 * 2.5, COLOR_WHITE, "sans-bold"); |
|
|
|
ui_draw_text(s, s->fb_w/2, 210, speed_str.c_str(), 96 * 2.5, COLOR_WHITE, "sans-bold"); |
|
|
|