|
|
|
@ -1,12 +1,21 @@
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
from os import system
|
|
|
|
from os import system
|
|
|
|
import RPi.GPIO as GPIO
|
|
|
|
# import RPi.GPIO as GPIO
|
|
|
|
from RPi.GPIO import output
|
|
|
|
# from RPi.GPIO import output
|
|
|
|
from time import sleep
|
|
|
|
from time import sleep
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
logging.basicConfig(format='%(message)s')
|
|
|
|
logging.basicConfig(format='%(message)s')
|
|
|
|
# logging.warning('CC-Warning!')
|
|
|
|
# logging.warning('CC-Warning!')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def blink(times):
|
|
|
|
|
|
|
|
for i in range(times):
|
|
|
|
|
|
|
|
system("gpio write 27 0")
|
|
|
|
|
|
|
|
# GPIO.output(27, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
system("gpio write 27 1")
|
|
|
|
|
|
|
|
# GPIO.output(27, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
powerPin = 16
|
|
|
|
powerPin = 16
|
|
|
|
txLed = 17
|
|
|
|
txLed = 17
|
|
|
|
@ -104,141 +113,33 @@ if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
# if ((debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice
|
|
|
|
# if ((debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice
|
|
|
|
if (debug_mode == False) and (change_mode == True): # skip every other APRS command since Direwolf prints them twice
|
|
|
|
if (debug_mode == False) and (change_mode == True): # skip every other APRS command since Direwolf prints them twice
|
|
|
|
GPIO.setmode(GPIO.BCM)
|
|
|
|
|
|
|
|
GPIO.setwarnings(False)
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
GPIO.setup(powerPin, GPIO.OUT)
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
print("GPIO powerPin setup problem")
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
GPIO.setup(txLed, GPIO.OUT)
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
print("GPIO txLed setup problem")
|
|
|
|
|
|
|
|
if (mode == 'f'):
|
|
|
|
if (mode == 'f'):
|
|
|
|
GPIO.output(powerPin, 0) # blink two times
|
|
|
|
blink(2)
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
elif (mode == 'b'):
|
|
|
|
elif (mode == 'b'):
|
|
|
|
GPIO.output(powerPin, 0) # blink three times
|
|
|
|
blink(3)
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
elif (mode == 's'):
|
|
|
|
elif
|
|
|
|
GPIO.output(powerPin, 0) # blink four times
|
|
|
|
blink(4)
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
elif (mode == 'm'):
|
|
|
|
elif (mode == 'm'):
|
|
|
|
GPIO.output(powerPin, 0) # blink five times
|
|
|
|
blink(5)
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1);
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
elif (mode == 'e'):
|
|
|
|
elif (mode == 'e'):
|
|
|
|
GPIO.output(powerPin, 0) # blink six times
|
|
|
|
blink6)
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1);
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
elif (mode == 'j'):
|
|
|
|
elif (mode == 'j'):
|
|
|
|
GPIO.output(powerPin, 0) # blink seven times
|
|
|
|
blink(7)
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1);
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
elif (mode == 'a'):
|
|
|
|
elif (mode == 'a'):
|
|
|
|
mode = 'a'
|
|
|
|
mode = 'a'
|
|
|
|
GPIO.output(powerPin, 0) # blink one time
|
|
|
|
blink(1)
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
@ -257,8 +158,12 @@ if __name__ == "__main__":
|
|
|
|
print("Command_count: ")
|
|
|
|
print("Command_count: ")
|
|
|
|
print(command_count)
|
|
|
|
print(command_count)
|
|
|
|
|
|
|
|
|
|
|
|
GPIO.output(txLed, 0)
|
|
|
|
# GPIO.output(txLed, 0)
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
# GPIO.output(powerPin, 0)
|
|
|
|
|
|
|
|
system("gpio write 27 0")
|
|
|
|
|
|
|
|
system("gpio write 0 0")
|
|
|
|
|
|
|
|
system("gpio write 2 0")
|
|
|
|
|
|
|
|
|
|
|
|
system("sudo systemctl stop transmit")
|
|
|
|
system("sudo systemctl stop transmit")
|
|
|
|
# system("sudo systemctl stop cubesatsim")
|
|
|
|
# system("sudo systemctl stop cubesatsim")
|
|
|
|
|
|
|
|
|
|
|
|
|