Update pushbutton.py cleanup diff

master-bw
Alan Johnston 2 months ago committed by GitHub
parent 0f470314f3
commit 5f5e7e7e53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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)

Loading…
Cancel
Save

Powered by TurnKey Linux.