FrogPilot features - Check for new networks once a second

This commit is contained in:
FrogAi
2024-07-05 17:20:12 -07:00
parent 0309f08924
commit 16ecc22a63
2 changed files with 13 additions and 1 deletions
+9 -1
View File
@@ -6,7 +6,6 @@
#include <QScrollBar>
#include <QStyle>
#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() {
+4
View File
@@ -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<WifiItem*> wifi_items;
// FrogPilot widgets
void updateState(const UIState &s);
signals:
void connectToNetwork(const Network n);