From 2c43f3b15bb17cd58ca321d641b46a9bfc19ffc6 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 4 Oct 2023 02:42:20 +0000 Subject: [PATCH] ui: Use local variables for cereal --- selfdrive/ui/qt/onroad.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index d9973c663a..31ac6f2ff7 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -1654,6 +1654,8 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { const UIScene &scene = s->scene; SubMaster &sm = *(s->sm); + const auto car_state = sm["carState"].getCarState(); + // Shane's colored lanelines for (int i = 0; i < std::size(scene.lane_line_vertices); ++i) { if (i == 1 || i == 2) { @@ -1683,12 +1685,12 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // paint path QLinearGradient bg(0, height(), 0, height() / 4); - if (madsEnabled || sm["carState"].getCarState().getCruiseState().getEnabled()) { + if (madsEnabled || car_state.getCruiseState().getEnabled()) { if (steerOverride && latActive) { bg.setColorAt(0.0, QColor::fromHslF(20 / 360., 0.94, 0.51, 0.17)); bg.setColorAt(0.5, QColor::fromHslF(20 / 360., 1.0, 0.68, 0.17)); bg.setColorAt(1.0, QColor::fromHslF(20 / 360., 1.0, 0.68, 0.0)); - } else if (!(latActive || sm["carState"].getCarState().getCruiseState().getEnabled())) { + } else if (!(latActive || car_state.getCruiseState().getEnabled())) { bg.setColorAt(0, whiteColor()); bg.setColorAt(1, whiteColor(0)); } else if (sm["controlsState"].getControlsState().getExperimentalMode()) {