diff --git a/config b/config index 9f0ac554..4ea1ab08 100755 --- a/config +++ b/config @@ -8,7 +8,7 @@ function transmit_command_aprs { echo "Stopping command and control" sudo systemctl stop command - echo "Transmit start" + 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 @@ -29,8 +29,181 @@ function transmit_command_aprs { echo $STRING sudo touch /home/pi/CubeSatSim/ready sleep 3 -# sudo touch /home/pi/CubeSatSim/ready -# sleep 5 + + 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 +} + +function transmit_command_sstv { + + 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-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 -n "Sending APRS packet to change mode to SSTV" + 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-cw.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=m" + 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 CW" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 3 + + fi + + exit +} + +function transmit_command_beacon { + + 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-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 + + else + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=o" + 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 @@ -166,11 +339,8 @@ if [ "$1" = "" ]; then elif [ "$1" = "-i" ]; then + reboot=1 -## echo "Rebooting CubeSatSim" -## sudo reboot now -# sudo restart cubesatsim -## exit elif [ "$1" = "-a" ]; then @@ -182,17 +352,6 @@ elif [ "$1" = "-a" ]; then transmit_command_aprs -# echo "Transmit mode 1 is APRS" - -# 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 " -# echo $STRING -# sudo touch /home/pi/CubeSatSim/ready -# sleep 5 -# sudo touch /home/pi/CubeSatSim/ready else echo "changing CubeSatSim to AFSK mode" @@ -201,61 +360,56 @@ elif [ "$1" = "-a" ]; then fi elif [ "$1" = "-m" ]; then - echo "changing CubeSatSim to CW mode" - sudo echo "m" > /home/pi/CubeSatSim/.mode - FILE=/home/pi/CubeSatSim/battery_saver - if [ -f "$FILE" ]; then - echo "Safe Mode! Battery saver mode is ON." - # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - else - echo "Battery saver mode is OFF." - # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt + if [ "$1" == "n" ]; then + + transmit_command_cw + + else + + echo "changing CubeSatSim to CW mode" + sudo echo "m" > /home/pi/CubeSatSim/.mode + reboot=1 fi - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit + elif [ "$1" = "-f" ]; then - echo "changing CubeSatSim to FSK mode" - sudo echo "f" > /home/pi/CubeSatSim/.mode -# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit + + if [ "$1" == "n" ]; then + + transmit_command_fsk + + else + + echo "changing CubeSatSim to FSK mode" + sudo echo "f" > /home/pi/CubeSatSim/.mode + reboot=1 + fi + elif [ "$1" = "-b" ]; then - echo "changing CubeSatSim to BPSK mode" - sudo echo "b" > /home/pi/CubeSatSim/.mode -# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit + + if [ "$1" == "n" ]; then + + transmit_command_bpsk + + else + + echo "changing CubeSatSim to BPSK mode" + sudo echo "b" > /home/pi/CubeSatSim/.mode + reboot=1 + fi + elif [ "$1" = "-s" ]; then - echo "changing CubeSatSim to SSTV mode" - sudo echo "s" > /home/pi/CubeSatSim/.mode - FILE=/home/pi/CubeSatSim/battery_saver - if [ -f "$FILE" ]; then - echo "Safe Mode! Battery saver mode ON." -# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - else - echo "Battery saver mode is OFF." -# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt + if [ "$1" == "n" ]; then + + transmit_command_sstv + + else + + echo "changing CubeSatSim to SSTV mode" + sudo echo "s" > /home/pi/CubeSatSim/.mode + reboot=1 fi - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit elif [ "$1" = "-t" ]; then