From 5f5e7e7e53e3b63944653829ae92eb0acc285373 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 29 Jul 2026 10:56:21 -0400 Subject: [PATCH] Update pushbutton.py cleanup diff --- pushbutton.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pushbutton.py b/pushbutton.py index 8686f878..feb2b0bf 100644 --- a/pushbutton.py +++ b/pushbutton.py @@ -24,6 +24,12 @@ def change_mode(): txPin = 27 sleep(0.75) if GPIO.input(push_button): +### os.system("sudo nmcli connection down preconfigured") + result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) + print(result) + result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) + print(result) +### os.system("sudo nmcli connection down Hotspot-Manual") print("sudo reboot -h now") os.system("echo 'reboot due to push button!' | wall") GPIO.setwarnings(False) @@ -151,12 +157,6 @@ if not GPIO.input(push_button): # if pushbutton is held down during boot sleep(0.3) GPIO.output(powerPin, 0) print("sudo nmcli device wifi hotspot con-name HotSpot ifname wlan0 ssid CubeSat password amsatao7") -### os.system("sudo nmcli connection down preconfigured") - result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) - print(result) - result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) - print(result) -### os.system("sudo nmcli connection down Hotspot-Manual") ## os.system("sudo nmcli device wifi hotspot con-name HotSpot ifname wlan0 ssid CubeSat password amsatao7") # os.system("sudo nmcli c add type wifi ifname wlan0 con-name Hotspot-Manual ssid MyHotspot") # os.system("sudo nmcli connection modify Hotspot-Manual 802-11-wireless.mode ap 802-11-wireless.band bg") @@ -168,7 +168,7 @@ if not GPIO.input(push_button): # if pushbutton is held down during boot print(result.stdout) # os.system("sudo nmcli connection up Hotspot-Manual") result = subprocess.run(['nmcli', 'connection', 'up', 'Hotspot-Manual'], capture_output=True, text=True) - print(result.stdout) + print(result.stdout) sleep(2) else: result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True)