diff --git a/selfdrive/ui/qt/network/networking.cc b/selfdrive/ui/qt/network/networking.cc index d7cdddff4..f09589492 100644 --- a/selfdrive/ui/qt/network/networking.cc +++ b/selfdrive/ui/qt/network/networking.cc @@ -6,7 +6,6 @@ #include #include -#include "selfdrive/ui/ui.h" #include "selfdrive/ui/qt/qt_window.h" #include "selfdrive/ui/qt/util.h" #include "selfdrive/ui/qt/widgets/controls.h" @@ -290,6 +289,15 @@ WifiUI::WifiUI(QWidget *parent, WifiManager* wifi) : QWidget(parent), wifi(wifi) color: #696969; } )"); + + // FrogPilot variables + QObject::connect(uiState(), &UIState::uiUpdate, this, &WifiUI::updateState); +} + +void WifiUI::updateState(const UIState &s) { + if (!isVisible() || s.sm->frame % UI_FREQ != 0) return; + + refresh(); } void WifiUI::refresh() { diff --git a/selfdrive/ui/qt/network/networking.h b/selfdrive/ui/qt/network/networking.h index 9b6af005e..b835de50d 100644 --- a/selfdrive/ui/qt/network/networking.h +++ b/selfdrive/ui/qt/network/networking.h @@ -6,6 +6,7 @@ #include "selfdrive/ui/qt/widgets/input.h" #include "selfdrive/ui/qt/widgets/ssh_keys.h" #include "selfdrive/ui/qt/widgets/toggle.h" +#include "selfdrive/ui/ui.h" class WifiItem : public QWidget { Q_OBJECT @@ -45,6 +46,9 @@ private: ListWidget *wifi_list_widget = nullptr; std::vector wifi_items; + // FrogPilot widgets + void updateState(const UIState &s); + signals: void connectToNetwork(const Network n);