|
|
|
|
@ -88,7 +88,12 @@ def change_mode():
|
|
|
|
|
sleep(0.65)
|
|
|
|
|
if GPIO.input(push_button):
|
|
|
|
|
print("sudo nmcli connection up preconfigured")
|
|
|
|
|
os.system("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)
|
|
|
|
|
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 shutdown -h now")
|
|
|
|
|
os.system("echo 'shutdown due to push button!' | wall")
|
|
|
|
|
GPIO.setwarnings(False)
|
|
|
|
|
@ -146,8 +151,31 @@ 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 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")
|
|
|
|
|
# # os.system("sudo nmcli connection modify Hotspot-Manual wifi-sec.key-mgmt wpa-psk wifi-sec.psk 'YourPassword123' ipv4.method shared")
|
|
|
|
|
# os.system("sudo nmcli connection down uuid 335c2e13-cab4-40bf-a297-7ff2535ec214") # preconfigured")
|
|
|
|
|
# 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)
|
|
|
|
|
# os.system("sudo nmcli connection up Hotspot-Manual")
|
|
|
|
|
result = subprocess.run(['nmcli', 'connection', 'up', 'Hotspot-Manual'], capture_output=True, text=True)
|
|
|
|
|
print(result.stdout)
|
|
|
|
|
sleep(2)
|
|
|
|
|
else:
|
|
|
|
|
result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True)
|
|
|
|
|
print(result.stdout)
|
|
|
|
|
result = subprocess.run(['nmcli', 'connection', 'up', 'preconfigured'], capture_output=True, text=True)
|
|
|
|
|
print(result.stdout)
|
|
|
|
|
# os.system("sudo nmcli connection up preconfigured")
|
|
|
|
|
GPIO.setup(powerPin, GPIO.OUT)
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
while (True):
|
|
|
|
|
|