From ab5eef3a1217a2fd09a7d8457899574826387c85 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Mon, 11 Jan 2021 14:51:21 +0100 Subject: [PATCH] ui.cc: fix driverview (#19723) old-commit-hash: 92257e4dfff411cd981ef7bad964531813d3f37f --- selfdrive/ui/ui.cc | 7 +++++-- selfdrive/ui/ui.hpp | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 5a6f2be935..53c97da869 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -72,8 +72,9 @@ void ui_init(UIState *s) { ui_nvg_init(s); s->last_frame = nullptr; - s->vipc_client = new VisionIpcClient("camerad", VISION_STREAM_RGB_BACK, true); - + s->vipc_client_rear = new VisionIpcClient("camerad", VISION_STREAM_RGB_BACK, true); + s->vipc_client_front = new VisionIpcClient("camerad", VISION_STREAM_RGB_FRONT, true); + s->vipc_client = s->vipc_client_rear; } template @@ -236,6 +237,8 @@ static void ui_read_params(UIState *s) { void ui_update_vision(UIState *s) { if (!s->vipc_client->connected && s->started) { + s->vipc_client = s->scene.frontview ? s->vipc_client_front : s->vipc_client_rear; + if (s->vipc_client->connect(false)){ ui_init_vision(s); } diff --git a/selfdrive/ui/ui.hpp b/selfdrive/ui/ui.hpp index 5707bdb64c..e359f3bcfa 100644 --- a/selfdrive/ui/ui.hpp +++ b/selfdrive/ui/ui.hpp @@ -138,6 +138,8 @@ typedef struct UIScene { typedef struct UIState { VisionIpcClient * vipc_client; + VisionIpcClient * vipc_client_front; + VisionIpcClient * vipc_client_rear; VisionBuf * last_frame; // framebuffer