From 159a83a4124a886ab9748e70615e8de9d4fc69fa Mon Sep 17 00:00:00 2001 From: IrvingGao <1729854488@qq.com> Date: Mon, 27 May 2024 23:22:57 +0800 Subject: [PATCH] bash --- start_hotpots.sh | 7 +++---- wifi_manager.py | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/start_hotpots.sh b/start_hotpots.sh index 33a3090..8296765 100644 --- a/start_hotpots.sh +++ b/start_hotpots.sh @@ -1,4 +1,3 @@ -sudo python3 wifi_manager.py -cd .. -cd TakwayPlatform -sudo python3 ws_client.py \ No newline at end of file +python3 wifi_manager.py +cd ~/TakwayPlatform/ +python3 ws_client.py \ No newline at end of file diff --git a/wifi_manager.py b/wifi_manager.py index bbeaa0d..c140ee5 100644 --- a/wifi_manager.py +++ b/wifi_manager.py @@ -205,7 +205,8 @@ def load_saved_wifi(): def save_wifi(ssid, password): wifi_list = load_saved_wifi() - wifi_list.append({'ssid': ssid, 'password': password}) + if ssid not in [item['ssid'] for item in wifi_list]: + wifi_list.append({'ssid': ssid, 'password': password}) with open('wifi_list.json', 'w') as f: json.dump(wifi_list, f)