From af73d6084d5ac77935282442c909432eebd676d1 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sat, 19 Oct 2024 04:16:34 +0800 Subject: [PATCH] ui: revert the 'alive' check to compare with scene.started_frame (#33794) Revert the 'alive' check to compare with scene.started_frame --- selfdrive/ui/qt/onroad/hud.cc | 2 +- selfdrive/ui/qt/onroad/model.cc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/selfdrive/ui/qt/onroad/hud.cc b/selfdrive/ui/qt/onroad/hud.cc index 50b563b228..c63962caf6 100644 --- a/selfdrive/ui/qt/onroad/hud.cc +++ b/selfdrive/ui/qt/onroad/hud.cc @@ -13,7 +13,7 @@ void HudRenderer::updateState(const UIState &s) { status = s.status; const SubMaster &sm = *(s.sm); - if (!sm.alive("carState")) { + if (sm.rcv_frame("carState") < s.scene.started_frame) { is_cruise_set = false; set_speed = SET_SPEED_NA; speed = 0.0; diff --git a/selfdrive/ui/qt/onroad/model.cc b/selfdrive/ui/qt/onroad/model.cc index d1e3c7bde2..5263f4cede 100644 --- a/selfdrive/ui/qt/onroad/model.cc +++ b/selfdrive/ui/qt/onroad/model.cc @@ -14,9 +14,11 @@ static int get_path_length_idx(const cereal::XYZTData::Reader &line, const float } void ModelRenderer::draw(QPainter &painter, const QRect &surface_rect) { - auto &sm = *(uiState()->sm); + auto *s = uiState(); + auto &sm = *(s->sm); // Check if data is up-to-date - if (!(sm.alive("liveCalibration") && sm.alive("modelV2"))) { + if (sm.rcv_frame("liveCalibration") < s->scene.started_frame || + sm.rcv_frame("modelV2") < s->scene.started_frame) { return; }