From 065cb227dd9f6016b668484881f475b48af2a3b1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 29 Jul 2026 11:13:28 -0400 Subject: [PATCH] Update pushbutton.py add fflush --- pushbutton.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pushbutton.py b/pushbutton.py index feb2b0bf..6dfb30ef 100644 --- a/pushbutton.py +++ b/pushbutton.py @@ -26,9 +26,9 @@ def change_mode(): 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) + print(result, flush=True) result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) - print(result) + print(result, flush=True) ### os.system("sudo nmcli connection down Hotspot-Manual") print("sudo reboot -h now") os.system("echo 'reboot due to push button!' | wall") @@ -96,9 +96,9 @@ def change_mode(): print("sudo nmcli connection up preconfigured") ### os.system("sudo nmcli connection down preconfigured") result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) - print(result) + print(result, flush=True) result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) - print(result) + print(result, flush=True) ### os.system("sudo nmcli connection down Hotspot-Manual") print("sudo shutdown -h now") os.system("echo 'shutdown due to push button!' | wall") @@ -165,16 +165,16 @@ if not GPIO.input(push_button): # if pushbutton is held down during boot # os.system("sudo nmcli device disconnect wlan0") # os.system("sudo nmcli connection up uuid d437746a-411f-4f02-95ea-7b2f7665d59a") # Hotspot-Manual") result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) - print(result.stdout) + print(result, flush=True) #.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, flush=True) #.stdout) sleep(2) else: result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) - print(result.stdout) + print(result, flush=True) # .stdout) result = subprocess.run(['nmcli', 'connection', 'up', 'preconfigured'], capture_output=True, text=True) - print(result.stdout) + print(result, flush=True) # .stdout) # os.system("sudo nmcli connection up preconfigured") GPIO.setup(powerPin, GPIO.OUT) GPIO.output(powerPin, 1)