diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 654cb17839..35e654d8ba 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -245,7 +245,19 @@ static void update_status(UIState *s) { s->scene.is_rhd = Params().getBool("IsRHD"); s->scene.end_to_end = Params().getBool("EndToEndToggle"); - s->vipc_client = s->scene.driver_view ? s->vipc_client_front : s->vipc_client_rear; + s->wide_camera = Hardware::TICI() ? Params().getBool("EnableWideCamera") : false; + + // Update intrinsics matrix after possible wide camera toggle change + ui_resize(s, s->fb_w, s->fb_h); + + // Choose vision ipc client + if (s->scene.driver_view) { + s->vipc_client = s->vipc_client_front; + } else if (s->wide_camera){ + s->vipc_client = s->vipc_client_wide; + } else { + s->vipc_client = s->vipc_client_rear; + } } else { s->vipc_client->connected = false; } @@ -269,8 +281,10 @@ QUIState::QUIState(QObject *parent) : QObject(parent) { ui_state.last_frame = nullptr; ui_state.wide_camera = Hardware::TICI() ? Params().getBool("EnableWideCamera") : false; - ui_state.vipc_client_rear = new VisionIpcClient("camerad", ui_state.wide_camera ? VISION_STREAM_RGB_WIDE : VISION_STREAM_RGB_BACK, true); + ui_state.vipc_client_rear = new VisionIpcClient("camerad", VISION_STREAM_RGB_BACK, true); ui_state.vipc_client_front = new VisionIpcClient("camerad", VISION_STREAM_RGB_FRONT, true); + ui_state.vipc_client_wide = new VisionIpcClient("camerad", VISION_STREAM_RGB_WIDE, true); + ui_state.vipc_client = ui_state.vipc_client_rear; // update timer diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 48b212a977..53686c00eb 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -102,6 +102,7 @@ typedef struct UIState { VisionIpcClient * vipc_client; VisionIpcClient * vipc_client_front; VisionIpcClient * vipc_client_rear; + VisionIpcClient * vipc_client_wide; VisionBuf * last_frame; // framebuffer