From 1fd7f66a14ee2718cebaad01148f9541b2d221bc Mon Sep 17 00:00:00 2001 From: Comma Device Date: Sat, 22 May 2021 18:42:42 -0700 Subject: [PATCH] fix sidebar network type and signal --- selfdrive/ui/qt/sidebar.cc | 8 ++++---- selfdrive/ui/qt/sidebar.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/selfdrive/ui/qt/sidebar.cc b/selfdrive/ui/qt/sidebar.cc index 9e9377f9ed..198d99be19 100644 --- a/selfdrive/ui/qt/sidebar.cc +++ b/selfdrive/ui/qt/sidebar.cc @@ -54,8 +54,8 @@ void Sidebar::updateState(const UIState &s) { auto &sm = *(s.sm); auto deviceState = sm["deviceState"].getDeviceState(); - setProperty("netType", (int)deviceState.getNetworkType()); - setProperty("netStrength", (int)deviceState.getNetworkStrength()); + setProperty("netType", network_type[deviceState.getNetworkType()]); + setProperty("netStrength", signal_imgs[deviceState.getNetworkStrength()]); auto last_ping = deviceState.getLastAthenaPingTime(); if (last_ping == 0) { @@ -102,11 +102,11 @@ void Sidebar::paintEvent(QPaintEvent *event) { p.drawImage(60, 1080 - 180 - 40, home_img); // network - p.drawImage(58, 196, signal_imgs[net_strength]); + p.drawImage(58, 196, net_strength); configFont(p, "Open Sans", 35, "Regular"); p.setPen(QColor(0xff, 0xff, 0xff)); const QRect r = QRect(50, 247, 100, 50); - p.drawText(r, Qt::AlignCenter, network_type[net_type]); + p.drawText(r, Qt::AlignCenter, net_type); // metrics drawMetric(p, "TEMP", QString("%1°C").arg(temp_val), temp_status, 338); diff --git a/selfdrive/ui/qt/sidebar.h b/selfdrive/ui/qt/sidebar.h index 52e2ee5686..f03871045a 100644 --- a/selfdrive/ui/qt/sidebar.h +++ b/selfdrive/ui/qt/sidebar.h @@ -12,8 +12,8 @@ class Sidebar : public QFrame { Q_PROPERTY(QColor pandaStatus MEMBER panda_status NOTIFY valueChanged); Q_PROPERTY(int tempVal MEMBER temp_val NOTIFY valueChanged); Q_PROPERTY(QColor tempStatus MEMBER temp_status NOTIFY valueChanged); - Q_PROPERTY(cereal::DeviceState::NetworkType netType MEMBER net_type NOTIFY valueChanged); - Q_PROPERTY(cereal::DeviceState::NetworkStrength netStrength MEMBER net_strength NOTIFY valueChanged); + Q_PROPERTY(QString netType MEMBER net_type NOTIFY valueChanged); + Q_PROPERTY(QImage netStrength MEMBER net_strength NOTIFY valueChanged); public: explicit Sidebar(QWidget* parent = 0); @@ -60,6 +60,6 @@ private: QColor panda_status = warning_color; int temp_val = 0; QColor temp_status = warning_color; - cereal::DeviceState::NetworkType net_type; - cereal::DeviceState::NetworkStrength net_strength; + QString net_type; + QImage net_strength; };