-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflash_firmware.py
More file actions
41 lines (30 loc) · 1.51 KB
/
flash_firmware.py
File metadata and controls
41 lines (30 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## This script requires soldering wires from the Station G2 "restart" and "firmware" button traces to a relay
import RPi.GPIO as GPIO
import time
# Define GPIO pins for the relay channels
FIRMWARE_BUTTON_PIN = 6 # GPIO06 for the firmware button
RESTART_BUTTON_PIN = 5 # GPIO05 for the restart button
# Setup GPIO
GPIO.setmode(GPIO.BCM) # Use BCM pin numbering
GPIO.setup(FIRMWARE_BUTTON_PIN, GPIO.OUT)
GPIO.setup(RESTART_BUTTON_PIN, GPIO.OUT)
GPIO.output(FIRMWARE_BUTTON_PIN, GPIO.HIGH) # Relay off = HIGH for normally open
GPIO.output(RESTART_BUTTON_PIN, GPIO.HIGH) # Relay off = HIGH for normally open
def flash_firmware():
try:
GPIO.output(FIRMWARE_BUTTON_PIN, GPIO.LOW) # Press firmware button (activate relay)
print("Firmware button pressed and held.")
time.sleep(0.5) # Wait a moment before pressing restart
GPIO.output(RESTART_BUTTON_PIN, GPIO.LOW) # Press restart button
print("Restart button pressed.")
time.sleep(1) # Hold restart button for 1 second
GPIO.output(RESTART_BUTTON_PIN, GPIO.HIGH) # Release restart button
print("Restart button released.")
print("Holding firmware button for 5 seconds.") # Hold firmware button 5 additional seconds
time.sleep(5)
GPIO.output(FIRMWARE_BUTTON_PIN, GPIO.HIGH) # Release firmware button
print("Firmware button released. Radio should be in firmware flashing mode.")
finally:
GPIO.cleanup()
if __name__ == "__main__":
flash_firmware()