mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-29 23:43:47 +08:00
Retain hotspot/tether: Fix initialization (#293)
* Retain hotspot/tether: Fix initialization * init before manager starts * simpler
This commit is contained in:
@@ -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},
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user