Update visionIPC stream and intrinsic matrix when going onroad (#20947)

* Choose correct vipc stream when going onroad

* whitespace
albatross
Willem Melching 2021-05-18 14:17:38 +02:00 committed by GitHub
parent 39c6ea6d7c
commit ccdec0291d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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