Merge branch 'master-psag' into pi-sensors-auto-gps

pi-sensors-auto-gps
Alan Johnston 2 weeks ago committed by GitHub
commit 683e071ad0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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. 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 - wiringpi
- git - git
- libasound2-dev - libasound2-dev
@ -36,11 +36,23 @@ See the Wiki Software Install page for details: [https://github.com/alanbjohnsto
## Installation Script Option Steps ## 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. *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` `sudo apt-get update`

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
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
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
echo -n "TX Frequency is: "
STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=b" echo -n ${7}
sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 echo " MHz"
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 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 value=`cat /home/pi/CubeSatSim/.mode`
if [ -f "$FILE" ]; then echo "$value" > /dev/null
set -- $value
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
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 fi
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
} }
echo echo
@ -342,6 +239,12 @@ if [ "$1" = "" ]; then
echo "Random Failure Mode is OFF" echo "Random Failure Mode is OFF"
fi 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 if [ "$9" = "yes" ] || [ "$9" = "y" ]; then
echo "Balloon mode is ON" echo "Balloon mode is ON"
else else
@ -428,22 +331,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
@ -454,22 +349,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
@ -480,7 +367,7 @@ elif [ "$1" = "-f" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_fsk transmit_command "f"
else else
@ -497,7 +384,7 @@ elif [ "$1" = "-b" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_bpsk transmit_command "b"
else else
@ -514,23 +401,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
@ -794,7 +672,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
@ -807,7 +684,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"
@ -818,21 +695,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
@ -1216,7 +1112,7 @@ elif [ "$1" = "-o" ]; then
if [ "$1" == "n" ]; then if [ "$1" == "n" ]; then
transmit_command_beacon transmit_command "o"
else else
echo echo
@ -1255,6 +1151,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
@ -1320,102 +1217,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
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 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
1) fi
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
echo 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
@ -1487,16 +1401,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" = "-M" ]; then elif [ "$1" = "-M" ]; 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)

@ -13,6 +13,23 @@ echo -e "\ninstallation script for CubeSatSim v2.2\n"
sleep 10 sleep 10
fi 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 FILE=/home/pi/CubeSatSim/sim.cfg
if [ -f "$FILE" ]; then if [ -f "$FILE" ]; then
echo "$FILE exists." echo "$FILE exists."
@ -21,6 +38,13 @@ else
echo "AMSAT 1 0.0 0.0" > /home/pi/CubeSatSim/sim.cfg echo "AMSAT 1 0.0 0.0" > /home/pi/CubeSatSim/sim.cfg
fi 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 FILE=/home/pi/CubeSatSim/command_tx
if [ -f "$FILE" ]; then if [ -f "$FILE" ]; then
echo "$FILE exists." echo "$FILE exists."
@ -67,7 +91,7 @@ sudo dpkg -i debian-template/wiringpi-2.61-1.deb
cd cd
#changed to python3-smbus #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 sudo pip3 install --upgrade setuptools
@ -135,6 +159,8 @@ git clone https://github.com/csete/fcdctl.git
cd fcdctl cd fcdctl
make fcdpp make fcdpp
cd
git clone https://github.com/alanbjohnston/PiSSTVpp.git git clone https://github.com/alanbjohnston/PiSSTVpp.git
cd PiSSTVpp cd PiSSTVpp
@ -293,7 +319,7 @@ if [ $changed -eq 1 ]; then
echo -e "Current sim.cfg configuration file:" echo -e "Current sim.cfg configuration file:"
echo echo
echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} 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
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 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 echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 > /home/pi/CubeSatSim/sim.cfg

@ -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

@ -369,6 +369,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()
@ -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 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
@ -465,8 +468,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'):

@ -182,33 +182,6 @@ if [ ! -d "/home/pi/PiSSTVpp" ]; then
sudo raspi-config nonint do_camera 0 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 fi
if [ ! -d "/home/pi/rpitx" ]; then if [ ! -d "/home/pi/rpitx" ]; then
@ -235,7 +208,7 @@ if [ ! -d "/home/pi/WiringPi" ]; then
cd cd
git clone https://github.com/PinkFreud/WiringPi git clone https://github.com/alanbjohnston/WiringPi
cd WiringPi cd WiringPi
./build debian ./build debian
@ -405,15 +378,15 @@ cd /home/pi/ssdv
sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt' sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt'
FLAG=1 FLAG=1
cd /home/pi/pi-power-button # cd /home/pi/pi-power-button
git pull --no-rebase # git pull --no-rebase
git checkout reboot-mode-change # git checkout reboot-mode-change
script/install # script/install
# sudo apt-get update && sudo apt-get dist-upgrade -y ## sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get update -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 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 pip3 install -y adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow
fi fi

Loading…
Cancel
Save

Powered by TurnKey Linux.