limit icon flickering in UI (#21132)

pull/21134/head
Adeeb Shihadeh 4 years ago committed by GitHub
parent 4b6ec3bca6
commit 2ddfd82913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      selfdrive/ui/paint.cc
  2. 5
      selfdrive/ui/ui.cc
  3. 2
      selfdrive/ui/ui.h

@ -211,7 +211,7 @@ static void ui_draw_vision_speed(UIState *s) {
} }
static void ui_draw_vision_event(UIState *s) { static void ui_draw_vision_event(UIState *s) {
if ((*s->sm)["controlsState"].getControlsState().getEngageable()) { if (s->scene.engageable) {
// draw steering wheel // draw steering wheel
const int radius = 96; const int radius = 96;
const int center_x = s->viz_rect.right() - radius - bdr_s * 2; const int center_x = s->viz_rect.right() - radius - bdr_s * 2;
@ -226,8 +226,7 @@ static void ui_draw_vision_face(UIState *s) {
const int radius = 96; const int radius = 96;
const int center_x = s->viz_rect.x + radius + (bdr_s * 2); const int center_x = s->viz_rect.x + radius + (bdr_s * 2);
const int center_y = s->viz_rect.bottom() - footer_h / 2; const int center_y = s->viz_rect.bottom() - footer_h / 2;
bool is_active = (*s->sm)["driverMonitoringState"].getDriverMonitoringState().getIsActiveMode(); ui_draw_circle_image(s, center_x, center_y, radius, "driver_face", s->scene.dm_active);
ui_draw_circle_image(s, center_x, center_y, radius, "driver_face", is_active);
} }
static void ui_draw_vision_header(UIState *s) { static void ui_draw_vision_header(UIState *s) {

@ -129,6 +129,11 @@ static void update_state(UIState *s) {
SubMaster &sm = *(s->sm); SubMaster &sm = *(s->sm);
UIScene &scene = s->scene; UIScene &scene = s->scene;
// update engageability and DM icons at 2Hz
if (sm.frame % (UI_FREQ / 2) == 0) {
scene.engageable = sm["controlsState"].getControlsState().getEngageable();
scene.dm_active = sm["driverMonitoringState"].getDriverMonitoringState().getIsActiveMode();
}
if (sm.updated("radarState")) { if (sm.updated("radarState")) {
std::optional<cereal::ModelDataV2::XYZTData::Reader> line; std::optional<cereal::ModelDataV2::XYZTData::Reader> line;
if (sm.rcv_frame("modelV2") > 0) { if (sm.rcv_frame("modelV2") > 0) {

@ -94,6 +94,8 @@ typedef struct UIScene {
line_vertices_data lane_line_vertices[4]; line_vertices_data lane_line_vertices[4];
line_vertices_data road_edge_vertices[2]; line_vertices_data road_edge_vertices[2];
bool dm_active, engageable;
// lead // lead
vertex_data lead_vertices[2]; vertex_data lead_vertices[2];

Loading…
Cancel
Save