diff --git a/README.md b/README.md index a649a4f8..608132c6 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ See the Wiki Software Install page for more details: https://github.com/alanbjoh There are two ways to get the CubeSatSim(TM) software for your Pi. -One option is to download the disk image file and write it to a 16GB micro SD card or larger. The image is based on Raspberry Pi OS (Rasbian) Lite, dated December 2020. All software is installed, you just need to login to change your password and set your amateur radio callsign if you have one. You can run the ./update.sh script to update all packages and update and compile the latest CubeSatSim software. +One option is to download the disk image file and write it to a 16GB micro SD card or larger. The image is based on Raspberry Pi OS (Bulleye) Lite. All software is installed, you just need to login to change your password and set your amateur radio callsign if you have one. You can run the ./update.sh script to update all packages and update and compile the latest CubeSatSim software. -The other option is to start with a Raspberry Pi OS (Rasbian) image (Bullseye or Buster works) and run the installation script ./install.sh which will install and compile all the related software. This includes the following packages: +The other option is to start with a Raspberry Pi OS (Rasbian) image (only Bullseye works, Bookworm or Trixie are not compatible) and run the installation script ./install.sh which will install and compile all the related software. This includes the following packages: - wiringpi - git - libasound2-dev @@ -36,11 +36,23 @@ See the Wiki Software Install page for details: [https://github.com/alanbjohnsto ## Installation Script Option Steps -CubeSatSim runs on the Bullseye or Buster version of Raspberry Pi OS (Desktop or Lite), although a Pi Zero or Pi Zero W should only run Lite. Your Pi will need to have internet access to update settings and install packages. +CubeSatSim runs on the Bullseye version of Raspberry Pi OS (Desktop or Lite), although a Pi Zero or Pi Zero W should only run Lite. Your Pi will need to have internet access to update settings and install packages. + +For the status of our efforts to get the code running on Bookworm, see https://github.com/alanbjohnston/CubeSatSim/discussions/389 + +Here is a Bullseye Pi OS image that works: https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2023-05-03/ Here is the file download link: https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2023-05-03/2023-05-03-raspios-bullseye-armhf-full.img.xz + +You can use this with the Raspberry Pi Imager, but under `OS` you need to choose the `Use Custom` option at the very bottom of the list, then select the downloaded image `2023-05-03-raspios-bullseye-armhf-full.img.xz` + +Unfortunately, Customization is not supported with a Custom image, so you can't preset your username, password, localization, and WiFi settings. + +So after you write this image to your microSD card, you will need to connect a monitor and keyboard to your Pi Zero 2 to set these things (make sure you set `pi` as the username). After that, you can connect it to your WiFi and turn on ssh and vnc for remote access. + +You can then follow the software installation steps and it work work. The only hiccup is that if you run the installer script while running the Desktop, the Direwolf installation will freeze. But you can just cycle the power to the Pi Zero 2, then run the installer script again and it will complete successfully. Alternatively, if you use `sudo raspi-config` to change to Boot to Console (System/ Boot Auto Login/ Console or Console Auto Login) then the installer script will complete without any issues. *Note:* CubeSatSim expects to be installed as the `pi` user and references many paths in `/home/pi/*`. Installing as a different user will result in configuration files not saving along with many other issues. -To get the software follow these steps: +To install the software follow these steps: `sudo apt-get update` diff --git a/config b/config index ac46cb60..87788e8f 100755 --- a/config +++ b/config @@ -1,213 +1,110 @@ #!/bin/bash -function transmit_command_aprs { +function transmit_command { - 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-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 - - - - 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 + MODE=$1 + echo "CubeSatSim is in Transmit Commands mode" + echo + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value - - 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 { + echo -n "TX Frequency is: " + echo -n ${7} + echo " MHz" 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 + echo "Sending DTMF tones to change to mode "$MODE - fi - - exit -} + case $MODE in + + 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 - if [ -f "$FILE" ]; then + 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 - echo "Stopping command and control" - sudo systemctl stop command +# echo "Stopping command and control" +# sudo systemctl stop command - echo "Transmit DTMF start" +# echo "Transmit 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 + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf-tmp.conf -t 0l > /dev/null 2>&1 gpio write 2 0 # tx LED gpio write 28 1 #ptt - echo "Transmit stop" +# echo "Transmit stop" - echo "Resuming command and control" - sudo systemctl start command +# echo "Resuming command and control" +# sudo systemctl start command 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 echo $STRING > /home/pi/CubeSatSim/t.txt echo - echo -n "Sending APRS packet to change mode to CW" + echo -n "Sending APRS packet to change mode to "$MODE" " echo $STRING sudo touch /home/pi/CubeSatSim/ready sleep 3 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" - 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 + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + 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 - - 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 - - exit + restart=1 +# echo "Need to restart" + fi } echo @@ -342,6 +239,12 @@ if [ "$1" = "" ]; then echo "Random Failure Mode is OFF" fi + 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 echo "Balloon mode is ON" else @@ -428,22 +331,14 @@ elif [ "$1" = "-a" ]; then if [ "$1" == "n" ]; then - transmit_command_aprs + transmit_command "a" else echo "changing CubeSatSim to AFSK mode" + check_restart 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 elif [ "$1" = "-m" ]; then @@ -454,22 +349,14 @@ elif [ "$1" = "-m" ]; then if [ "$1" == "n" ]; then - transmit_command_cw + transmit_command "m" else echo "changing CubeSatSim to CW mode" + check_restart 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 elif [ "$1" = "-f" ]; then @@ -480,7 +367,7 @@ elif [ "$1" = "-f" ]; then if [ "$1" == "n" ]; then - transmit_command_fsk + transmit_command "f" else @@ -497,7 +384,7 @@ elif [ "$1" = "-b" ]; then if [ "$1" == "n" ]; then - transmit_command_bpsk + transmit_command "b" else @@ -514,23 +401,14 @@ elif [ "$1" = "-s" ]; then if [ "$1" == "n" ]; then - transmit_command_sstv + transmit_command "s" else echo "changing CubeSatSim to SSTV mode" + check_restart 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 elif [ "$1" = "-t" ]; then @@ -794,7 +672,6 @@ elif [ "$1" = "-C" ]; then elif [ "$1" = "-T" ]; then - echo echo "Change command and control state" echo @@ -807,7 +684,7 @@ elif [ "$1" = "-T" ]; then echo 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 # reboot=1 echo "restarting command and control" @@ -818,21 +695,40 @@ elif [ "$1" = "-T" ]; then fi else - echo "Radio command and control is OFF" + echo "Radio command and control is OFF" echo echo "Do you want to set command and control to ON (y/n) " read reset echo if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then - echo "Command and control set to ON" - 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 + + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + + if [ "$1" != "n" ] ; then + echo "Turning command and control ON" + + 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 @@ -1216,7 +1112,7 @@ elif [ "$1" = "-o" ]; then if [ "$1" == "n" ]; then - transmit_command_beacon + transmit_command "o" else echo @@ -1255,6 +1151,7 @@ elif [ "$1" = "-o" ]; then # restart=1 fi fi + sleep 3 fi elif [ "$1" = "-H" ]; then @@ -1320,102 +1217,119 @@ elif [ "$1" = "-v" ]; then elif [ "$1" = "-e" ]; then - echo "changing CubeSatSim to Repeater mode" - sudo echo "e" > /home/pi/CubeSatSim/.mode + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value - restart=1 + if [ "$1" == "n" ]; then + + transmit_command "e" + + else + + echo "changing CubeSatSim to Repeater mode" + sudo echo "e" > /home/pi/CubeSatSim/.mode + restart=1 + fi 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` echo "$value" > /dev/null set -- $value if [ "$1" = "n" ]; then - echo "Turning Transmit Command and Control mode OFF" - echo "Switching to BPSK mode" - sudo echo "b" > /home/pi/CubeSatSim/.mode - reboot=1 + echo "Turning Transmit Commands mode OFF" + if [ "$new" = "a" ] || [ "$new" = "s" ] || [ "$new" = "m" ] ; then + check_restart + 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 - 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 - restart=1 + sudo systemctl stop command fi 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 value=`cat /home/pi/CubeSatSim/.mode` echo "$value" > /dev/null 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 sudo systemctl stop cubesatsim 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 fi + sudo systemctl stop command - sim="y" + MODE="0" - while [ "$sim" = "y" ] + while [ "$MODE" != "x" ]; 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 - - case $MODE in - - 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 -n "Sending APRS packet " - echo $STRING - sudo touch /home/pi/CubeSatSim/ready - sleep 5 - sudo touch /home/pi/CubeSatSim/ready + + if [ "$MODE" != "x" ]; then + transmit_command $MODE + fi echo - echo "Do you want to send another APRS command packet (y/n) " - read sim - echo + 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 fi @@ -1487,16 +1401,16 @@ elif [ "$1" = "-j" ]; then echo "$value" > /dev/null set -- $value -# if [ "$1" == "n" ]; then + if [ "$1" == "n" ]; then -# transmit_command_bpsk + transmit_command "j" -# else + else echo "changing CubeSatSim to FUNcube mode" sudo echo "j" > /home/pi/CubeSatSim/.mode restart=1 -# fi + fi elif [ "$1" = "-M" ]; then diff --git a/direwolf/direwolf-transmit-dtmf-beacon.conf b/direwolf/direwolf-transmit-dtmf-beacon.conf deleted file mode 100644 index 6c022dea..00000000 --- a/direwolf/direwolf-transmit-dtmf-beacon.conf +++ /dev/null @@ -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 diff --git a/direwolf/direwolf-transmit-dtmf-bpsk.conf b/direwolf/direwolf-transmit-dtmf-bpsk.conf deleted file mode 100644 index a0ae9b54..00000000 --- a/direwolf/direwolf-transmit-dtmf-bpsk.conf +++ /dev/null @@ -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 diff --git a/direwolf/direwolf-transmit-dtmf-cw.conf b/direwolf/direwolf-transmit-dtmf-cw.conf deleted file mode 100644 index 8629754f..00000000 --- a/direwolf/direwolf-transmit-dtmf-cw.conf +++ /dev/null @@ -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 diff --git a/direwolf/direwolf-transmit-dtmf-fsk.conf b/direwolf/direwolf-transmit-dtmf-fsk.conf deleted file mode 100644 index f197e583..00000000 --- a/direwolf/direwolf-transmit-dtmf-fsk.conf +++ /dev/null @@ -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 diff --git a/direwolf/direwolf-transmit-dtmf-sstv.conf b/direwolf/direwolf-transmit-dtmf-sstv.conf deleted file mode 100644 index c58cb77f..00000000 --- a/direwolf/direwolf-transmit-dtmf-sstv.conf +++ /dev/null @@ -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 diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf.conf similarity index 68% rename from direwolf/direwolf-transmit-dtmf-aprs.conf rename to direwolf/direwolf-transmit-dtmf.conf index 786102cd..a2fdd69c 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf.conf @@ -2,4 +2,5 @@ ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 -CBEACON dest="DTMF-3" info="1 #" delay=0 +KISSPORT 8003 +AGWPORT 8004 diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index ad4ef5cf..cfa58788 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -30,7 +30,6 @@ if __name__ == "__main__": system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True - counter = (counter + 1) % 2 if ((line.find("DTMF>APDW15:t1#")) > 0): system("echo '\nAPRS Mode!!\n'") mode = 'a' @@ -39,7 +38,6 @@ if __name__ == "__main__": system("echo '\nFSK Mode!!\n'") mode = 'f' change_mode = True - counter = (counter + 1) % 2 if ((line.find("DTMF>APDW15:t2#")) > 0): system("echo '\nFSK Mode!!\n'") mode = 'f' @@ -48,7 +46,6 @@ if __name__ == "__main__": system("echo '\nBPSK Mode!!\n'") mode = 'b' change_mode = True - counter = (counter + 1) % 2 if ((line.find("DTMF>APDW15:t3#")) > 0): system("echo '\nBPSK Mode!!\n'") mode = 'b' @@ -57,7 +54,6 @@ if __name__ == "__main__": system("echo '\nSSTV Mode!!\n'") mode = 's' change_mode = True - counter = (counter + 1) % 2 if ((line.find("DTMF>APDW15:t4#")) > 0): system("echo '\nSSTV Mode!!\n'") mode = 's' @@ -66,17 +62,14 @@ if __name__ == "__main__": system("echo '\nCW Mode!!\n'") mode = 'm' change_mode = True - counter = (counter + 1) % 2 if ((line.find("DTMF>APDW15:t5#")) > 0): system("echo '\nCW Mode!!\n'") mode = 'm' change_mode = True - if ((line.find("MODE=e")) > 0): system("echo '\nRepeater Mode!!\n'") mode = 'e' change_mode = True - counter = (counter + 1) % 2 if ((line.find("DTMF>APDW15:t6#")) > 0): system("echo '\nRepeater Mode!!\n'") mode = 'e' @@ -85,7 +78,6 @@ if __name__ == "__main__": system("echo '\nFUNcube Mode!!\n'") mode = 'j' change_mode = True - counter = (counter + 1) % 2 if ((line.find("DTMF>APDW15:t7#")) > 0): system("echo '\nFUNcube Mode!!\n'") mode = 'j' @@ -94,22 +86,23 @@ if __name__ == "__main__": system("echo '\nTransmit Commands Mode!!\n'") mode = 'n' change_mode = True - counter = (counter + 1) % 2 if ((line.find("DTMF>APDW15:t11#")) > 0): system("echo '\nTransmit Commands Mode!!\n'") mode = 'n' change_mode = True if ((line.find("MODE=o")) > 0): - system("echo '\nBeacon Mode toggle!!\n'") - mode = 'o' - change_mode = True - counter = (counter + 1) % 2 + counter = (counter + 1) % 2 # Direwolf prints it twice, only do once + if (counter == 1): + system("echo '\nBeacon Mode toggle!!\n'") + mode = 'o' + change_mode = True + counter = 1 if ((line.find("DTMF>APDW15:t10#")) > 0): system("echo '\nBeacon Mode toggle!!\n'") mode = 'o' 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 GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) @@ -261,7 +254,7 @@ if __name__ == "__main__": GPIO.output(txLed, 0) GPIO.output(powerPin, 0) - system("sudo systemctl stop rpitx") + system("sudo systemctl stop transmit") # system("sudo systemctl stop cubesatsim") print("\n/home/pi/CubeSatSim/config -" + mode) diff --git a/install b/install index 414e39d0..5168645f 100755 --- a/install +++ b/install @@ -13,6 +13,23 @@ echo -e "\ninstallation script for CubeSatSim v2.2\n" sleep 10 fi +if [[ $(grep 'bullseye' /etc/os-release) ]]; then + echo "Bullseye detected, installation continuing." +else + echo "Your Pi OS version is not Bullseye." + echo "The software installation will likely not work." + echo "See the README.md for how to install using Bullseye." + echo + + echo "Are you sure you want to continue the installation (y/n)?" + + read -r ANS + + if [ "$ANS" = "n" ]; then + exit 1 + fi +fi + FILE=/home/pi/CubeSatSim/sim.cfg if [ -f "$FILE" ]; then echo "$FILE exists." @@ -21,6 +38,13 @@ else echo "AMSAT 1 0.0 0.0" > /home/pi/CubeSatSim/sim.cfg fi +if [[ $(grep 'cubesatsim' /etc/motd) ]]; then + echo "motd already updated" +else + echo "updating motd" + sudo sh -c 'cat /home/pi/CubeSatSim/motd.txt >> /etc/motd' +fi + FILE=/home/pi/CubeSatSim/command_tx if [ -f "$FILE" ]; then echo "$FILE exists." @@ -67,7 +91,7 @@ sudo dpkg -i debian-template/wiringpi-2.61-1.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial libusb-1.0 +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial libusb-1.0-0 libusb-1.0-0-dev sudo pip3 install --upgrade setuptools @@ -135,6 +159,8 @@ git clone https://github.com/csete/fcdctl.git cd fcdctl make fcdpp +cd + git clone https://github.com/alanbjohnston/PiSSTVpp.git cd PiSSTVpp @@ -293,7 +319,7 @@ if [ $changed -eq 1 ]; then echo -e "Current sim.cfg configuration file:" echo echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} - echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" + echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" echo echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 > /home/pi/CubeSatSim/sim.cfg diff --git a/motd.txt b/motd.txt new file mode 100644 index 00000000..09ff7ac9 --- /dev/null +++ b/motd.txt @@ -0,0 +1,11 @@ + +This Raspberry Pi has the CubeSatSim v2.x software installed +and runs automatically as systemd cubesatsim.service. For more +information see https://CubeSatSim.org. To update +to the latest version, enter this command: + +CubeSatSim/update + +To see configuration options, enter this command: + +CubeSatSim/config diff --git a/transmit.py b/transmit.py index 786fc94e..9da35b2d 100644 --- a/transmit.py +++ b/transmit.py @@ -369,6 +369,7 @@ if __name__ == "__main__": print("Can't read callsign from sim.cfg file, defaulting to AMSAT") file.close() + no_command = True try: f = open("/home/pi/CubeSatSim/command_control", "r") f.close() @@ -377,15 +378,17 @@ if __name__ == "__main__": GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected if GPIO.input(squelch) == False: print("squelch not set correctly, no command input!") - no_command = True else: - print("command and control is activated") - no_command = False -# system("/home/pi/CubeSatSim/command &") - system("sudo systemctl start command") + if (mode != 'n') and (mode != 'x'): + print("command and control is activated") + no_command = False + 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: print("command and control not activated") - no_command = True + print(callsign) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 @@ -465,8 +468,9 @@ if __name__ == "__main__": if (mode == 'a'): print("AFSK") else: - GPIO.output(powerPin, 0) +# GPIO.output(powerPin, 0) print("Transmit APRS Commands") + system("sudo systemctl stop command") # while True: # sleep(0.1) if (mode != 'n'): diff --git a/update b/update index c942f9fb..41b2db9c 100755 --- a/update +++ b/update @@ -182,33 +182,6 @@ if [ ! -d "/home/pi/PiSSTVpp" ]; then sudo raspi-config nonint do_camera 0 - - FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg - if [ ! -f "$FILE" ]; then - echo "Copying SSTV image 1." - cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg - fi - - FILE=/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg - if [ ! -f "$FILE" ]; then - echo "Copying SSTV image 2." - cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg - fi - -# echo "You need to reboot to complete this update. Reboot now (y/n)?" - -# read -r ANS - -# if [ "$ANS" = "y" ]; then - -# sudo reboot now - -# else - -# echo "The CubeSatSim software may not work correctly until you reboot." - -# fi - fi if [ ! -d "/home/pi/rpitx" ]; then @@ -235,7 +208,7 @@ if [ ! -d "/home/pi/WiringPi" ]; then cd - git clone https://github.com/PinkFreud/WiringPi + git clone https://github.com/alanbjohnston/WiringPi cd WiringPi ./build debian @@ -405,15 +378,15 @@ cd /home/pi/ssdv sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt' FLAG=1 - cd /home/pi/pi-power-button - git pull --no-rebase - git checkout reboot-mode-change - script/install +# cd /home/pi/pi-power-button +# git pull --no-rebase +# git checkout reboot-mode-change +# script/install -# sudo apt-get update && sudo apt-get dist-upgrade -y - sudo apt-get update -y - sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil - sudo pip3 install -y adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow +## sudo apt-get update && sudo apt-get dist-upgrade -y +# sudo apt-get update -y +# sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil +# sudo pip3 install -y adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow fi