Retain tethering status between reboots
This commit is contained in:
@@ -316,6 +316,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"StandardFollow", PERSISTENT},
|
{"StandardFollow", PERSISTENT},
|
||||||
{"StandardJerk", PERSISTENT},
|
{"StandardJerk", PERSISTENT},
|
||||||
{"StoppingDistance", PERSISTENT},
|
{"StoppingDistance", PERSISTENT},
|
||||||
|
{"TetheringEnabled", PERSISTENT},
|
||||||
{"UnlimitedLength", PERSISTENT},
|
{"UnlimitedLength", PERSISTENT},
|
||||||
{"Updated", PERSISTENT},
|
{"Updated", PERSISTENT},
|
||||||
{"UpdateSchedule", PERSISTENT},
|
{"UpdateSchedule", PERSISTENT},
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
|
|||||||
tetheringToggle = new ToggleControl(tr("Enable Tethering"), "", "", wifi->isTetheringEnabled());
|
tetheringToggle = new ToggleControl(tr("Enable Tethering"), "", "", wifi->isTetheringEnabled());
|
||||||
list->addItem(tetheringToggle);
|
list->addItem(tetheringToggle);
|
||||||
QObject::connect(tetheringToggle, &ToggleControl::toggleFlipped, this, &AdvancedNetworking::toggleTethering);
|
QObject::connect(tetheringToggle, &ToggleControl::toggleFlipped, this, &AdvancedNetworking::toggleTethering);
|
||||||
|
if (params.getBool("TetheringEnabled")) {
|
||||||
|
tetheringToggle->setVisualOn();
|
||||||
|
uiState()->scene.tethering_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Change tethering password
|
// Change tethering password
|
||||||
ButtonControl *editPasswordButton = new ButtonControl(tr("Tethering Password"), tr("EDIT"));
|
ButtonControl *editPasswordButton = new ButtonControl(tr("Tethering Password"), tr("EDIT"));
|
||||||
@@ -232,6 +236,8 @@ void AdvancedNetworking::refresh() {
|
|||||||
void AdvancedNetworking::toggleTethering(bool enabled) {
|
void AdvancedNetworking::toggleTethering(bool enabled) {
|
||||||
wifi->setTetheringEnabled(enabled);
|
wifi->setTetheringEnabled(enabled);
|
||||||
tetheringToggle->setEnabled(false);
|
tetheringToggle->setEnabled(false);
|
||||||
|
params.putBool("TetheringEnabled", enabled);
|
||||||
|
uiState()->scene.tethering_enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// WifiUI functions
|
// WifiUI functions
|
||||||
|
|||||||
@@ -127,6 +127,10 @@ public:
|
|||||||
QObject::connect(&toggle, &Toggle::stateChanged, this, &ToggleControl::toggleFlipped);
|
QObject::connect(&toggle, &Toggle::stateChanged, this, &ToggleControl::toggleFlipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setVisualOn() {
|
||||||
|
toggle.togglePosition();
|
||||||
|
}
|
||||||
|
|
||||||
void setEnabled(bool enabled) {
|
void setEnabled(bool enabled) {
|
||||||
toggle.setEnabled(enabled);
|
toggle.setEnabled(enabled);
|
||||||
toggle.update();
|
toggle.update();
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ void UIState::updateStatus() {
|
|||||||
started_prev = scene.started;
|
started_prev = scene.started;
|
||||||
scene.world_objects_visible = false;
|
scene.world_objects_visible = false;
|
||||||
emit offroadTransition(!scene.started);
|
emit offroadTransition(!scene.started);
|
||||||
|
wifi->setTetheringEnabled(scene.started && scene.tethering_enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,6 +366,8 @@ UIState::UIState(QObject *parent) : QObject(parent) {
|
|||||||
QObject::connect(timer, &QTimer::timeout, this, &UIState::update);
|
QObject::connect(timer, &QTimer::timeout, this, &UIState::update);
|
||||||
timer->start(1000 / UI_FREQ);
|
timer->start(1000 / UI_FREQ);
|
||||||
|
|
||||||
|
wifi = new WifiManager(this);
|
||||||
|
|
||||||
scene.screen_brightness = params.getInt("ScreenBrightness");
|
scene.screen_brightness = params.getInt("ScreenBrightness");
|
||||||
|
|
||||||
setDefaultParams();
|
setDefaultParams();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "common/mat.h"
|
#include "common/mat.h"
|
||||||
#include "common/params.h"
|
#include "common/params.h"
|
||||||
#include "common/timing.h"
|
#include "common/timing.h"
|
||||||
|
#include "selfdrive/ui/qt/network/wifi_manager.h"
|
||||||
#include "system/hardware/hw.h"
|
#include "system/hardware/hw.h"
|
||||||
|
|
||||||
const int UI_BORDER_SIZE = 30;
|
const int UI_BORDER_SIZE = 30;
|
||||||
@@ -191,6 +192,7 @@ typedef struct UIScene {
|
|||||||
bool road_name_ui;
|
bool road_name_ui;
|
||||||
bool show_driver_camera;
|
bool show_driver_camera;
|
||||||
bool show_fps;
|
bool show_fps;
|
||||||
|
bool tethering_enabled;
|
||||||
bool turn_signal_left;
|
bool turn_signal_left;
|
||||||
bool turn_signal_right;
|
bool turn_signal_right;
|
||||||
bool unlimited_road_ui_length;
|
bool unlimited_road_ui_length;
|
||||||
@@ -261,6 +263,8 @@ private:
|
|||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
bool started_prev = false;
|
bool started_prev = false;
|
||||||
PrimeType prime_type = PrimeType::UNKNOWN;
|
PrimeType prime_type = PrimeType::UNKNOWN;
|
||||||
|
|
||||||
|
WifiManager *wifi = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
UIState *uiState();
|
UIState *uiState();
|
||||||
|
|||||||
0
selfdrive/updated.py
Executable file → Normal file
0
selfdrive/updated.py
Executable file → Normal file
Reference in New Issue
Block a user