Merge pull request #410 from alanbjohnston/send-commands

fixes to transmit commands mode
master-psag
Alan Johnston 5 months ago committed by GitHub
commit 03a4789a50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

476
config

@ -1,213 +1,110 @@
#!/bin/bash #!/bin/bash
function transmit_command_aprs { function transmit_command {
FILE=/home/pi/CubeSatSim/transmit_dtmf MODE=$1
if [ -f "$FILE" ]; then echo "CubeSatSim is in Transmit Commands mode"
echo
echo "Stopping command and control"
sudo systemctl stop command
echo "Transmit DTMF start"
gpio write 28 0 # ptt
gpio write 2 1 # tx LED
timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l
gpio write 2 0 # tx LED
gpio write 28 1 #ptt
echo "Transmit stop"
echo "Resuming command and control"
sudo systemctl start command
else
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a"
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
echo $STRING > /home/pi/CubeSatSim/t.txt
echo
echo -n "Sending APRS packet to change mode to APRS "
echo $STRING
sudo touch /home/pi/CubeSatSim/ready
sleep 3
fi
exit
}
function transmit_command_fsk {
FILE=/home/pi/CubeSatSim/transmit_dtmf
if [ -f "$FILE" ]; then
echo "Stopping command and control"
sudo systemctl stop command
echo "Transmit DTMF start"
gpio write 28 0 # ptt
gpio write 2 1 # tx LED
timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-fsk.conf -t 0l
gpio write 2 0 # tx LED
gpio write 28 1 #ptt
echo "Transmit stop"
echo "Resuming command and control"
sudo systemctl start command
else
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=f"
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
echo $STRING > /home/pi/CubeSatSim/t.txt
echo
echo -n "Sending APRS packet to change mode to FSK"
echo $STRING
sudo touch /home/pi/CubeSatSim/ready
sleep 3
fi
exit
}
function transmit_command_bpsk {
FILE=/home/pi/CubeSatSim/transmit_dtmf
if [ -f "$FILE" ]; then
echo "Stopping command and control"
sudo systemctl stop command
echo "Transmit DTMF start"
gpio write 28 0 # ptt
gpio write 2 1 # tx LED
timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-bpsk.conf -t 0l
gpio write 2 0 # tx LED
gpio write 28 1 #ptt
echo "Transmit stop"
echo "Resuming command and control"
sudo systemctl start command
else
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=b"
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
echo $STRING > /home/pi/CubeSatSim/t.txt
echo
echo -n "Sending APRS packet to change mode to BPSK"
echo $STRING
sudo touch /home/pi/CubeSatSim/ready
sleep 3
fi
exit value=`cat /home/pi/CubeSatSim/sim.cfg`
} echo "$value" > /dev/null
set -- $value
function transmit_command_sstv { echo -n "TX Frequency is: "
echo -n ${7}
echo " MHz"
FILE=/home/pi/CubeSatSim/transmit_dtmf FILE=/home/pi/CubeSatSim/transmit_dtmf
if [ -f "$FILE" ]; then if [ -f "$FILE" ]; then
echo "Stopping command and control"
sudo systemctl stop command
echo "Transmit DTMF start"
gpio write 28 0 # ptt
gpio write 2 1 # tx LED
timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-sstv.conf -t 0l
gpio write 2 0 # tx LED
gpio write 28 1 #ptt
echo "Transmit stop"
echo "Resuming command and control"
sudo systemctl start command
else
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=s"
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
echo $STRING > /home/pi/CubeSatSim/t.txt
echo echo
echo -n "Sending APRS packet to change mode to SSTV" echo "Sending DTMF tones to change to mode "$MODE
echo $STRING
sudo touch /home/pi/CubeSatSim/ready
sleep 3
fi case $MODE in
exit a)
} number=1
;;
f)
number=2
;;
b)
number=3
;;
s)
number=4
;;
m)
number=5
;;
e)
number=6
;;
j)
number=7
;;
o)
number=10
;;
*)
number=0
;;
esac
function transmit_command_cw { # echo $number
FILE=/home/pi/CubeSatSim/transmit_dtmf cat /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf.conf > /home/pi/CubeSatSim/direwolf-tmp.conf && echo 'CBEACON dest="DTMF-3" info="'$number' #" delay=0' >> /home/pi/CubeSatSim/direwolf-tmp.conf
if [ -f "$FILE" ]; then
echo "Stopping command and control" # echo "Stopping command and control"
sudo systemctl stop command # sudo systemctl stop command
echo "Transmit DTMF start" # echo "Transmit start"
gpio write 28 0 # ptt gpio write 28 0 # ptt
gpio write 2 1 # tx LED gpio write 2 1 # tx LED
timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-cw.conf -t 0l timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf-tmp.conf -t 0l > /dev/null 2>&1
gpio write 2 0 # tx LED gpio write 2 0 # tx LED
gpio write 28 1 #ptt gpio write 28 1 #ptt
echo "Transmit stop" # echo "Transmit stop"
echo "Resuming command and control" # echo "Resuming command and control"
sudo systemctl start command # sudo systemctl start command
else else
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=m" STRING="$1-11>APCSS:=3901.40N\07704.39WShi hi MODE="$MODE
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
echo $STRING > /home/pi/CubeSatSim/t.txt echo $STRING > /home/pi/CubeSatSim/t.txt
echo echo
echo -n "Sending APRS packet to change mode to CW" echo -n "Sending APRS packet to change mode to "$MODE" "
echo $STRING echo $STRING
sudo touch /home/pi/CubeSatSim/ready sudo touch /home/pi/CubeSatSim/ready
sleep 3 sleep 3
fi fi
exit echo
echo "To change the mode of this CubeSatSim use config -n"
} }
function transmit_command_beacon { function check_restart {
FILE=/home/pi/CubeSatSim/transmit_dtmf
if [ -f "$FILE" ]; then
echo "Stopping command and control"
sudo systemctl stop command
echo "Transmit DTMF start" value=`cat /home/pi/CubeSatSim/.mode`
gpio write 28 0 # ptt echo "$value" > /dev/null
gpio write 2 1 # tx LED set -- $value
timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-beacon.conf -t 0l
gpio write 2 0 # tx LED
gpio write 28 1 #ptt
echo "Transmit stop"
echo "Resuming command and control"
sudo systemctl start command
if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
# echo "Need to restart since batt saver"
else
reboot=1
# echo "Need to reboot"
fi
else else
restart=1
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=o" # echo "Need to restart"
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
echo $STRING > /home/pi/CubeSatSim/t.txt
echo
echo -n "Sending APRS packet to toggle Beacon"
echo $STRING
sudo touch /home/pi/CubeSatSim/ready
sleep 3
fi fi
exit
} }
echo "CubeSatSim v2.1 configuration tool" echo "CubeSatSim v2.1 configuration tool"
@ -218,12 +115,12 @@ echo
sudo modprobe snd-aloop sudo modprobe snd-aloop
# if [ "$2" = "n" ] ; then if [ "$2" = "n" ] ; then
if [ -z "$2" ] ; then #if [ -z "$2" ] ; then # need to swap else if change
noreboot=0
else
noreboot=1 noreboot=1
echo "Reboot disabled" echo "Reboot disabled"
else
noreboot=0
fi fi
# echo "No reboot" # echo "No reboot"
@ -276,6 +173,12 @@ if [ "$1" = "" ]; then
fi fi
echo echo
echo -n "TX Frequency is: "
echo -n ${7}
echo -n " MHz, RX Frequency is: "
echo -n ${8}
echo " MHz"
if [ "$9" = "yes" ] || [ "$9" = "y" ]; then if [ "$9" = "yes" ] || [ "$9" = "y" ]; then
echo "Balloon mode is ON" echo "Balloon mode is ON"
else else
@ -362,22 +265,14 @@ elif [ "$1" = "-a" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_aprs transmit_command "a"
else else
echo "changing CubeSatSim to AFSK mode" echo "changing CubeSatSim to AFSK mode"
check_restart
sudo echo "a" > /home/pi/CubeSatSim/.mode sudo echo "a" > /home/pi/CubeSatSim/.mode
if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
else
reboot=1
fi
else
restart=1
fi
fi fi
elif [ "$1" = "-m" ]; then elif [ "$1" = "-m" ]; then
@ -388,22 +283,14 @@ elif [ "$1" = "-m" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_cw transmit_command "m"
else else
echo "changing CubeSatSim to CW mode" echo "changing CubeSatSim to CW mode"
check_restart
sudo echo "m" > /home/pi/CubeSatSim/.mode sudo echo "m" > /home/pi/CubeSatSim/.mode
if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
else
reboot=1
fi
else
restart=1
fi
fi fi
elif [ "$1" = "-f" ]; then elif [ "$1" = "-f" ]; then
@ -414,7 +301,7 @@ elif [ "$1" = "-f" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_fsk transmit_command "f"
else else
@ -431,7 +318,7 @@ elif [ "$1" = "-b" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_bpsk transmit_command "b"
else else
@ -448,23 +335,14 @@ elif [ "$1" = "-s" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_sstv transmit_command "s"
else else
echo "changing CubeSatSim to SSTV mode" echo "changing CubeSatSim to SSTV mode"
check_restart
sudo echo "s" > /home/pi/CubeSatSim/.mode sudo echo "s" > /home/pi/CubeSatSim/.mode
if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
else
reboot=1
fi
else
restart=1
fi
fi fi
elif [ "$1" = "-t" ]; then elif [ "$1" = "-t" ]; then
@ -727,7 +605,6 @@ elif [ "$1" = "-C" ]; then
elif [ "$1" = "-T" ]; then elif [ "$1" = "-T" ]; then
echo
echo "Change command and control state" echo "Change command and control state"
echo echo
@ -740,7 +617,7 @@ elif [ "$1" = "-T" ]; then
echo echo
if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
echo "Command and control set to OFF" echo "Turning command and control OFF"
sudo rm /home/pi/CubeSatSim/command_control > /dev/null 2>&1 sudo rm /home/pi/CubeSatSim/command_control > /dev/null 2>&1
# reboot=1 # reboot=1
echo "restarting command and control" echo "restarting command and control"
@ -751,21 +628,40 @@ elif [ "$1" = "-T" ]; then
fi fi
else else
echo "Radio command and control is OFF" echo "Radio command and control is OFF"
echo echo
echo "Do you want to set command and control to ON (y/n) " echo "Do you want to set command and control to ON (y/n) "
read reset read reset
echo echo
if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
echo "Command and control set to ON"
sudo touch /home/pi/CubeSatSim/command_control value=`cat /home/pi/CubeSatSim/.mode`
echo "restarting command and control" echo "$value" > /dev/null
# reboot=1 set -- $value
sudo systemctl restart command
echo "restarting transmit" if [ "$1" != "n" ] ; then
sudo systemctl restart transmit echo "Turning command and control ON"
## sudo reboot now
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
echo -n "RX Frequency is: "
echo -n ${8}
echo " MHz"
echo
sudo touch /home/pi/CubeSatSim/command_control
echo "restarting command and control"
# reboot=1
sudo systemctl restart command
echo "restarting transmit"
sudo systemctl restart transmit
## sudo reboot now
else
echo "Can't turn on Command and control in Transmit Commands mode."
fi
fi fi
fi fi
@ -1148,7 +1044,7 @@ elif [ "$1" = "-o" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_beacon transmit_command "o"
else else
echo echo
@ -1187,6 +1083,7 @@ elif [ "$1" = "-o" ]; then
# restart=1 # restart=1
fi fi
fi fi
sleep 3
fi fi
elif [ "$1" = "-H" ]; then elif [ "$1" = "-H" ]; then
@ -1252,102 +1149,119 @@ elif [ "$1" = "-v" ]; then
elif [ "$1" = "-e" ]; then elif [ "$1" = "-e" ]; then
echo "changing CubeSatSim to Repeater mode" value=`cat /home/pi/CubeSatSim/.mode`
sudo echo "e" > /home/pi/CubeSatSim/.mode echo "$value" > /dev/null
set -- $value
if [ "$1" == "n" ]; then
transmit_command "e"
restart=1 else
echo "changing CubeSatSim to Repeater mode"
sudo echo "e" > /home/pi/CubeSatSim/.mode
restart=1
fi
elif [ "$1" = "-n" ]; then elif [ "$1" = "-n" ]; then
echo "changing CubeSatSim to Transmit Commands mode" # echo "changing CubeSatSim to Transmit Commands mode"
new=$2
value=`cat /home/pi/CubeSatSim/.mode` value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null echo "$value" > /dev/null
set -- $value set -- $value
if [ "$1" = "n" ]; then if [ "$1" = "n" ]; then
echo "Turning Transmit Command and Control mode OFF" echo "Turning Transmit Commands mode OFF"
echo "Switching to BPSK mode" if [ "$new" = "a" ] || [ "$new" = "s" ] || [ "$new" = "m" ] ; then
sudo echo "b" > /home/pi/CubeSatSim/.mode check_restart
reboot=1 echo "Switching to mode "$new
sudo echo $new > /home/pi/CubeSatSim/.mode
elif [ "$new" = "f" ] || [ "$new" = "b" ] || [ "$new" = "e" ] || [ "$new" = "j" ] ; then
echo "Switching to mode "$new
sudo echo $new > /home/pi/CubeSatSim/.mode
restart=1
else
echo "Switching to BPSK mode"
sudo echo "b" > /home/pi/CubeSatSim/.mode
reboot=1
fi
sudo systemctl restart command
else else
echo "Turning Transmit Command and Control mode ON" echo "Switching to Transmit Commands mode"
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
echo -n "TX Frequency is: "
echo -n ${7}
echo " MHz"
echo
check_restart
sudo echo "n" > /home/pi/CubeSatSim/.mode sudo echo "n" > /home/pi/CubeSatSim/.mode
restart=1 sudo systemctl stop command
fi fi
elif [ "$1" = "-A" ]; then elif [ "$1" = "-A" ]; then
echo "Transmit APRS control packets to control another CubeSatSim" echo "Transmit APRS Commands to control another CubeSatSim"
echo
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
echo -n "TX Frequency is: "
echo -n ${7}
echo " MHz"
echo echo
value=`cat /home/pi/CubeSatSim/.mode` value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null echo "$value" > /dev/null
set -- $value set -- $value
if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
echo "The CubeSatSim/config -A command can only be run in APRS, SSTV, CW, or Transmit Commands modes."
echo "Switch to one of these modes (a, s, m, or n) then re-run this command."
exit
fi
if [ "$1" != "n" ]; then if [ "$1" != "n" ]; then
sudo systemctl stop cubesatsim sudo systemctl stop cubesatsim
sudo systemctl stop transmit sudo systemctl stop transmit
# sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
sudo python3 -u /home/pi/CubeSatSim/transmit.py x > /dev/null 2>&1 & # Force APRS mode sudo python3 -u /home/pi/CubeSatSim/transmit.py x > /dev/null 2>&1 & # Force APRS mode
fi fi
sudo systemctl stop command
sim="y" MODE="0"
while [ "$sim" = "y" ] while [ "$MODE" != "x" ];
do do
echo "Enter the mode number to change: 1=APRS, 2=FSK, 3=BPSK, 4=SSTV, 5=CW" echo "Enter the mode to change: a=APRS, f=FSK, b=BPSK, s=SSTV, m=CW, e=Repeater, j=FUNcube, o=Beacon on/off x=Exit this mode"
read MODE read MODE
case $MODE in if [ "$MODE" != "x" ]; then
transmit_command $MODE
fi
1)
echo "Mode 1 is APRS"
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a"
;;
2)
echo "Mode 2 is FSK"
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=f"
;;
3)
echo "Mode 3 is BPSK"
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=b"
;;
4)
echo "Mode 4 is SSTV"
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=s"
;;
5)
echo "Mode 5 is CW"
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=m"
;;
*)
echo "Unknown mode"
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=?"
;;
esac
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
echo $STRING > /home/pi/CubeSatSim/t.txt
echo echo
echo -n "Sending APRS packet "
echo $STRING
sudo touch /home/pi/CubeSatSim/ready
sleep 5
sudo touch /home/pi/CubeSatSim/ready
echo
echo "Do you want to send another APRS command packet (y/n) "
read sim
echo
done done
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1
# sudo systemctl restart cubesatsim
if [ "$1" != "n" ]; then value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
if [ "$1" != "n" ] ; then
sudo systemctl restart command
reboot=1 reboot=1
fi fi
@ -1419,16 +1333,16 @@ elif [ "$1" = "-j" ]; then
echo "$value" > /dev/null echo "$value" > /dev/null
set -- $value set -- $value
# if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
# transmit_command_bpsk transmit_command "j"
# else else
echo "changing CubeSatSim to FUNcube mode" echo "changing CubeSatSim to FUNcube mode"
sudo echo "j" > /home/pi/CubeSatSim/.mode sudo echo "j" > /home/pi/CubeSatSim/.mode
restart=1 restart=1
# fi fi
elif [ "$1" = "-h" ]; then elif [ "$1" = "-h" ]; then

@ -1,5 +0,0 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="10 #" delay=0

@ -1,5 +0,0 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="3 #" delay=0

@ -1,5 +0,0 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="5 #" delay=0

@ -1,5 +0,0 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="2 #" delay=0

@ -1,5 +0,0 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="4 #" delay=0

@ -2,4 +2,5 @@ ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT MYCALL AMSAT
CHANNEL 0 CHANNEL 0
MODEM 1200 MODEM 1200
CBEACON dest="DTMF-3" info="1 #" delay=0 KISSPORT 8003
AGWPORT 8004

@ -30,7 +30,6 @@ if __name__ == "__main__":
system("echo '\nAPRS Mode!!\n'") system("echo '\nAPRS Mode!!\n'")
mode = 'a' mode = 'a'
change_mode = True change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t1#")) > 0): if ((line.find("DTMF>APDW15:t1#")) > 0):
system("echo '\nAPRS Mode!!\n'") system("echo '\nAPRS Mode!!\n'")
mode = 'a' mode = 'a'
@ -39,7 +38,6 @@ if __name__ == "__main__":
system("echo '\nFSK Mode!!\n'") system("echo '\nFSK Mode!!\n'")
mode = 'f' mode = 'f'
change_mode = True change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t2#")) > 0): if ((line.find("DTMF>APDW15:t2#")) > 0):
system("echo '\nFSK Mode!!\n'") system("echo '\nFSK Mode!!\n'")
mode = 'f' mode = 'f'
@ -48,7 +46,6 @@ if __name__ == "__main__":
system("echo '\nBPSK Mode!!\n'") system("echo '\nBPSK Mode!!\n'")
mode = 'b' mode = 'b'
change_mode = True change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t3#")) > 0): if ((line.find("DTMF>APDW15:t3#")) > 0):
system("echo '\nBPSK Mode!!\n'") system("echo '\nBPSK Mode!!\n'")
mode = 'b' mode = 'b'
@ -57,7 +54,6 @@ if __name__ == "__main__":
system("echo '\nSSTV Mode!!\n'") system("echo '\nSSTV Mode!!\n'")
mode = 's' mode = 's'
change_mode = True change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t4#")) > 0): if ((line.find("DTMF>APDW15:t4#")) > 0):
system("echo '\nSSTV Mode!!\n'") system("echo '\nSSTV Mode!!\n'")
mode = 's' mode = 's'
@ -66,17 +62,14 @@ if __name__ == "__main__":
system("echo '\nCW Mode!!\n'") system("echo '\nCW Mode!!\n'")
mode = 'm' mode = 'm'
change_mode = True change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t5#")) > 0): if ((line.find("DTMF>APDW15:t5#")) > 0):
system("echo '\nCW Mode!!\n'") system("echo '\nCW Mode!!\n'")
mode = 'm' mode = 'm'
change_mode = True change_mode = True
if ((line.find("MODE=e")) > 0): if ((line.find("MODE=e")) > 0):
system("echo '\nRepeater Mode!!\n'") system("echo '\nRepeater Mode!!\n'")
mode = 'e' mode = 'e'
change_mode = True change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t6#")) > 0): if ((line.find("DTMF>APDW15:t6#")) > 0):
system("echo '\nRepeater Mode!!\n'") system("echo '\nRepeater Mode!!\n'")
mode = 'e' mode = 'e'
@ -85,7 +78,6 @@ if __name__ == "__main__":
system("echo '\nFUNcube Mode!!\n'") system("echo '\nFUNcube Mode!!\n'")
mode = 'j' mode = 'j'
change_mode = True change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t7#")) > 0): if ((line.find("DTMF>APDW15:t7#")) > 0):
system("echo '\nFUNcube Mode!!\n'") system("echo '\nFUNcube Mode!!\n'")
mode = 'j' mode = 'j'
@ -94,22 +86,23 @@ if __name__ == "__main__":
system("echo '\nTransmit Commands Mode!!\n'") system("echo '\nTransmit Commands Mode!!\n'")
mode = 'n' mode = 'n'
change_mode = True change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t11#")) > 0): if ((line.find("DTMF>APDW15:t11#")) > 0):
system("echo '\nTransmit Commands Mode!!\n'") system("echo '\nTransmit Commands Mode!!\n'")
mode = 'n' mode = 'n'
change_mode = True change_mode = True
if ((line.find("MODE=o")) > 0): if ((line.find("MODE=o")) > 0):
system("echo '\nBeacon Mode toggle!!\n'") counter = (counter + 1) % 2 # Direwolf prints it twice, only do once
mode = 'o' if (counter == 1):
change_mode = True system("echo '\nBeacon Mode toggle!!\n'")
counter = (counter + 1) % 2 mode = 'o'
change_mode = True
counter = 1
if ((line.find("DTMF>APDW15:t10#")) > 0): if ((line.find("DTMF>APDW15:t10#")) > 0):
system("echo '\nBeacon Mode toggle!!\n'") system("echo '\nBeacon Mode toggle!!\n'")
mode = 'o' mode = 'o'
change_mode = True change_mode = True
# 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.setmode(GPIO.BCM)
GPIO.setwarnings(False) GPIO.setwarnings(False)
@ -261,7 +254,7 @@ if __name__ == "__main__":
GPIO.output(txLed, 0) GPIO.output(txLed, 0)
GPIO.output(powerPin, 0) GPIO.output(powerPin, 0)
system("sudo systemctl stop rpitx") system("sudo systemctl stop transmit")
# system("sudo systemctl stop cubesatsim") # system("sudo systemctl stop cubesatsim")
print("\n/home/pi/CubeSatSim/config -" + mode) print("\n/home/pi/CubeSatSim/config -" + mode)

@ -338,6 +338,7 @@ if __name__ == "__main__":
print("Can't read callsign from sim.cfg file, defaulting to AMSAT") print("Can't read callsign from sim.cfg file, defaulting to AMSAT")
file.close() file.close()
no_command = True
try: try:
f = open("/home/pi/CubeSatSim/command_control", "r") f = open("/home/pi/CubeSatSim/command_control", "r")
f.close() f.close()
@ -346,15 +347,17 @@ if __name__ == "__main__":
GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected
if GPIO.input(squelch) == False: if GPIO.input(squelch) == False:
print("squelch not set correctly, no command input!") print("squelch not set correctly, no command input!")
no_command = True
else: else:
print("command and control is activated") if (mode != 'n') and (mode != 'x'):
no_command = False print("command and control is activated")
# system("/home/pi/CubeSatSim/command &") no_command = False
system("sudo systemctl start command") system("sudo systemctl start command")
else:
print("Command and control not activated since Transmit Commands mode")
txc = True # Transmit commands only works with FM transceiver, so bypass Battery Saver if activated
except: except:
print("command and control not activated") print("command and control not activated")
no_command = True
print(callsign) print(callsign)
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
@ -421,8 +424,9 @@ if __name__ == "__main__":
if (mode == 'a'): if (mode == 'a'):
print("AFSK") print("AFSK")
else: else:
GPIO.output(powerPin, 0) # GPIO.output(powerPin, 0)
print("Transmit APRS Commands") print("Transmit APRS Commands")
system("sudo systemctl stop command")
# while True: # while True:
# sleep(0.1) # sleep(0.1)
if (mode != 'n'): if (mode != 'n'):

Loading…
Cancel
Save

Powered by TurnKey Linux.