FrogPilot features - Retain tethering status between reboots
This commit is contained in:
parent
fa1abaaea3
commit
9c502c0a41
@ -130,6 +130,10 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
|
||||
tetheringToggle = new ToggleControl(tr("Enable Tethering"), "", "", wifi->isTetheringEnabled());
|
||||
list->addItem(tetheringToggle);
|
||||
QObject::connect(tetheringToggle, &ToggleControl::toggleFlipped, this, &AdvancedNetworking::toggleTethering);
|
||||
if (params.getBool("TetheringEnabled")) {
|
||||
tetheringToggle->refresh();
|
||||
uiState()->scene.tethering_enabled = true;
|
||||
}
|
||||
|
||||
// Change tethering password
|
||||
ButtonControl *editPasswordButton = new ButtonControl(tr("Tethering Password"), tr("EDIT"));
|
||||
@ -224,6 +228,8 @@ void AdvancedNetworking::refresh() {
|
||||
void AdvancedNetworking::toggleTethering(bool enabled) {
|
||||
wifi->setTetheringEnabled(enabled);
|
||||
tetheringToggle->setEnabled(false);
|
||||
params.putBool("TetheringEnabled", enabled);
|
||||
uiState()->scene.tethering_enabled = enabled;
|
||||
}
|
||||
|
||||
// WifiUI functions
|
||||
|
@ -280,6 +280,7 @@ void UIState::updateStatus() {
|
||||
started_prev = scene.started;
|
||||
scene.world_objects_visible = false;
|
||||
emit offroadTransition(!scene.started);
|
||||
wifi->setTetheringEnabled(scene.started && scene.tethering_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,6 +304,8 @@ UIState::UIState(QObject *parent) : QObject(parent) {
|
||||
QObject::connect(timer, &QTimer::timeout, this, &UIState::update);
|
||||
timer->start(1000 / UI_FREQ);
|
||||
|
||||
wifi = new WifiManager(this);
|
||||
|
||||
ui_update_frogpilot_params(this);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "common/mat.h"
|
||||
#include "common/params.h"
|
||||
#include "common/timing.h"
|
||||
#include "selfdrive/ui/qt/network/wifi_manager.h"
|
||||
#include "system/hardware/hw.h"
|
||||
|
||||
#include "selfdrive/frogpilot/ui/qt/widgets/frogpilot_controls.h"
|
||||
@ -184,6 +185,7 @@ typedef struct UIScene {
|
||||
bool map_open;
|
||||
bool online;
|
||||
bool right_hand_drive;
|
||||
bool tethering_enabled;
|
||||
|
||||
int alert_size;
|
||||
|
||||
@ -214,6 +216,9 @@ public:
|
||||
|
||||
QTransform car_space_transform;
|
||||
|
||||
// FrogPilot variables
|
||||
WifiManager *wifi = nullptr;
|
||||
|
||||
signals:
|
||||
void uiUpdate(const UIState &s);
|
||||
void offroadTransition(bool offroad);
|
||||
|
Loading…
x
Reference in New Issue
Block a user