fix sidebar network type and signal

pull/20999/head
Comma Device 4 years ago
parent 179ff6e7ae
commit 1fd7f66a14
  1. 8
      selfdrive/ui/qt/sidebar.cc
  2. 8
      selfdrive/ui/qt/sidebar.h

@ -54,8 +54,8 @@ void Sidebar::updateState(const UIState &s) {
auto &sm = *(s.sm); auto &sm = *(s.sm);
auto deviceState = sm["deviceState"].getDeviceState(); auto deviceState = sm["deviceState"].getDeviceState();
setProperty("netType", (int)deviceState.getNetworkType()); setProperty("netType", network_type[deviceState.getNetworkType()]);
setProperty("netStrength", (int)deviceState.getNetworkStrength()); setProperty("netStrength", signal_imgs[deviceState.getNetworkStrength()]);
auto last_ping = deviceState.getLastAthenaPingTime(); auto last_ping = deviceState.getLastAthenaPingTime();
if (last_ping == 0) { if (last_ping == 0) {
@ -102,11 +102,11 @@ void Sidebar::paintEvent(QPaintEvent *event) {
p.drawImage(60, 1080 - 180 - 40, home_img); p.drawImage(60, 1080 - 180 - 40, home_img);
// network // network
p.drawImage(58, 196, signal_imgs[net_strength]); p.drawImage(58, 196, net_strength);
configFont(p, "Open Sans", 35, "Regular"); configFont(p, "Open Sans", 35, "Regular");
p.setPen(QColor(0xff, 0xff, 0xff)); p.setPen(QColor(0xff, 0xff, 0xff));
const QRect r = QRect(50, 247, 100, 50); 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 // metrics
drawMetric(p, "TEMP", QString("%1°C").arg(temp_val), temp_status, 338); drawMetric(p, "TEMP", QString("%1°C").arg(temp_val), temp_status, 338);

@ -12,8 +12,8 @@ class Sidebar : public QFrame {
Q_PROPERTY(QColor pandaStatus MEMBER panda_status NOTIFY valueChanged); Q_PROPERTY(QColor pandaStatus MEMBER panda_status NOTIFY valueChanged);
Q_PROPERTY(int tempVal MEMBER temp_val NOTIFY valueChanged); Q_PROPERTY(int tempVal MEMBER temp_val NOTIFY valueChanged);
Q_PROPERTY(QColor tempStatus MEMBER temp_status NOTIFY valueChanged); Q_PROPERTY(QColor tempStatus MEMBER temp_status NOTIFY valueChanged);
Q_PROPERTY(cereal::DeviceState::NetworkType netType MEMBER net_type NOTIFY valueChanged); Q_PROPERTY(QString netType MEMBER net_type NOTIFY valueChanged);
Q_PROPERTY(cereal::DeviceState::NetworkStrength netStrength MEMBER net_strength NOTIFY valueChanged); Q_PROPERTY(QImage netStrength MEMBER net_strength NOTIFY valueChanged);
public: public:
explicit Sidebar(QWidget* parent = 0); explicit Sidebar(QWidget* parent = 0);
@ -60,6 +60,6 @@ private:
QColor panda_status = warning_color; QColor panda_status = warning_color;
int temp_val = 0; int temp_val = 0;
QColor temp_status = warning_color; QColor temp_status = warning_color;
cereal::DeviceState::NetworkType net_type; QString net_type;
cereal::DeviceState::NetworkStrength net_strength; QImage net_strength;
}; };

Loading…
Cancel
Save