Retain hotspot/tether: Fix initialization (#293)

* Retain hotspot/tether: Fix initialization

* init before manager starts

* simpler
This commit is contained in:
Jason Wen
2023-09-25 01:14:48 -04:00
committed by GitHub
parent 9cab2802ea
commit 8d75ca9a7b
3 changed files with 5 additions and 4 deletions
+1
View File
@@ -255,6 +255,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"HideVEgoUi", PERSISTENT},
{"HkgSmoothStop", PERSISTENT},
{"HotspotOnBoot", PERSISTENT},
{"HotspotOnBootConfirmed", PERSISTENT},
{"LastCarModel", PERSISTENT},
{"LastSpeedLimitSignTap", PERSISTENT},
{"LiveTorque", PERSISTENT},
+3 -3
View File
@@ -267,6 +267,9 @@ def main() -> None:
# SystemExit on sigterm
signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(1))
if Params().get_bool("HotspotOnBoot") and Params().get_bool("HotspotOnBootConfirmed"):
os.system('nmcli con up Hotspot')
try:
manager_thread()
except Exception:
@@ -286,9 +289,6 @@ def main() -> None:
cloudlog.warning("shutdown")
HARDWARE.shutdown()
if params.get_bool("HotspotOnBoot"):
os.system('nmcli con up Hotspot')
if __name__ == "__main__":
unblock_stdout()
+1 -1
View File
@@ -201,7 +201,7 @@ void AdvancedNetworking::refresh() {
}
void AdvancedNetworking::toggleTethering(bool enabled) {
params.putBool("HotspotOnBoot", enabled);
params.putBool("HotspotOnBootConfirmed", enabled);
wifi->setTetheringEnabled(enabled);
tetheringToggle->setEnabled(false);
}