Merge pull request #348 from alanbjohnston/pacsat-1

Pacsat changes
pull/405/head
Alan Johnston 1 year ago committed by GitHub
commit 5e42437bbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -48,11 +48,11 @@ if [[ $(arecord -l | grep "USB Audio Device") ]] && [ -f "$FILE" ]; then
echo "debug mode"
direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
direwolf -P+ -D1 -r 48000 -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
else
direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
direwolf -P+ -D1 -r 48000 -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
fi
else

@ -210,7 +210,7 @@ function transmit_command_beacon {
exit
}
echo "CubeSatSim v2.0 configuration tool"
echo "CubeSatSim v2.1 configuration tool"
echo
# echo $1
# echo $2
@ -257,6 +257,10 @@ if [ "$1" = "" ]; then
else
echo -n "APRS"
fi
elif [ "$1" = "p" ]; then
echo "Mode is Pacsat"
elif [ "$1" = "P" ]; then
echo "Mode is Pacsat Ground Station"
else
echo
fi
@ -1416,11 +1420,44 @@ elif [ "$1" = "-g" ]; then
elif [ "$1" = "-G" ]; then
echo "Changing to Pacsat mode"
echo
sudo systemctl stop cubesatsim
sudo systemctl stop transmit
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
echo "changing CubeSatSim to Pacsat mode"
sudo echo "p" > /home/pi/CubeSatSim/.mode
if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
else
reboot=1
fi
else
restart=1
fi
elif [ "$1" = "-I" ]; then
echo "Changing to Pacsat Ground Station mode"
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
echo "changing CubeSatSim to Pacsat mode"
sudo echo "P" > /home/pi/CubeSatSim/.mode
if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
else
reboot=1
fi
else
restart=1
fi
/home/pi/CubeSatSim/pacsat.sh
elif [ "$1" = "-h" ]; then
@ -1459,6 +1496,7 @@ elif [ "$1" = "-h" ]; then
echo " -L Change microphone level for command and control"
echo " -g Reset configuration back to default settings"
echo " -G Change to Pacsat mode"
echo " -I Changing to Pacsat Ground Station mode"
echo
exit

@ -1,2 +1,7 @@
ADEVICE hw:CARD=Device,DEV=0 default
DTMF
MYCALL AMSAT
CHANNEL 0
MODEM 1200
FULLDUP OFF
TXDELAY 0

@ -0,0 +1,7 @@
ADEVICE plughw:CARD=Device,DEV=0 plughw:CARD=Device,DEV=0
PTT GPIO 20
MYCALL AMSAT
CHANNEL 0
MODEM 1200
FULLDUP OFF
TXDELAY 0

@ -1,5 +1,6 @@
ADEVICE hw:CARD=Device,DEV=0 plughw:CARD=Headphones,DEV=0
ADEVICE plughw:CARD=Device,DEV=0 plughw:CARD=Headphones,DEV=0
PTT GPIO 20
MYCALL AMSAT
CHANNEL 0
MODEM 1200
FULLDUP OFF

@ -0,0 +1,8 @@
MYCALL AMSAT
ADEVICE plughw:CARD=Device,DEV=0 plughw:CARD=Device,DEV=0
PTT GPIO 20
CHANNEL 0
MODEM 1200
KISSPORT 8100
FULLDUP OFF
TXDELAY 0

@ -2,3 +2,6 @@ MYCALL AMSAT
ADEVICE plughw:CARD=Device,DEV=0 plughw:CARD=Headphones,DEV=0
PTT GPIO 20
KISSPORT 8100
FULLDUP OFF
CHANNEL 0
MODEM 1200

@ -2,3 +2,4 @@ MYCALL AMSAT
ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=Headphones,DEV=0
PTT GPIO 20
KISSPORT 8100
FULLDUP OFF

@ -4,10 +4,9 @@
sudo modprobe snd-aloop
/home/pi/CubeSatSim/config -I
sudo systemctl stop cubesatsim &>/dev/null
sudo systemctl stop transmit &>/dev/null
sudo systemctl stop command &>/dev/null
sudo systemctl stop openwebrx &>/dev/null
@ -33,178 +32,48 @@ sudo killall -9 zenity &>/dev/null
echo
frequency=$(zenity --list 2>/dev/null --width=410 --height=360 --title="Packet Decoding with Direwolf" --text="Choose the frequency for packet decoding" --column="kHz" --column="Application" 144390 "APRS US 2m" 434900 "CubeSatSim" 144800 "APRS European 2m" 145175 "APRS Australian 2m" Other "Choose another frequency" 145825 "APRS on ISS" 437100 "Serenity CubeSat 4800 bps" Serenity "Test Serenity CubeSat decoding with WAV file" APRS "Test APRS decoding with CubeSatSim WAV file")
#echo $frequency
if [ -z "$frequency" ]; then
echo "No choice made. Exiting."
sleep 3
exit
#echo "Choose the number for the packet decoding option:"
#echo
#echo "1. APRS US 2m (144390 kHz)"
#echo "2. CubeSatSim (434900 kHz)"
#echo "3. APRS European 2m (144800 kHz)"
#echo "4. APRS Australian 2m (145175 kHz)"
#echo "5. APRS on another frequency"
#echo "6. APRS on ISS (145825 kHz)"
#echo "7. Serenity CubeSat 4800 bps (437.1 MHz)"
#echo "8. Test Serenity CubeSat decoding with WAV file"
#echo "9. Test APRS decoding with CubeSatSim WAV file"
#echo
#read -r choice
fi
if [ "$choice" = "1" ] || [ "$frequency" = "144390" ]; then
frequency=144390000
elif [ "$choice" = "2" ] || [ "$frequency" = "434900" ] ; then
frequency=434900000
echo
echo "If your CubeSatSim is transmitting in APRS mode (mode 1) then you should see packets."
echo
elif [ "$choice" = "3" ] || [ "$frequency" = "144800" ]; then
frequency=144800000
elif [ "$choice" = "4" ] || [ "$frequency" = "145175" ]; then
frequency=145175000
elif [ "$choice" = "5" ] || [ "$frequency" = "Other" ] ; then
echo
echo "Enter the frequency in kiloHertz"
echo
read -r frequency
frequency=$frequency"000"
#echo $frequency
elif [ "$choice" = "6" ] || [ "$frequency" = "145825" ] ; then
frequency=145825000
echo
echo "If the ISS is overhead and in APRS mode (see tracking application such as Gpredict), you will see packets."
echo
elif [ "$choice" = "7" ] || [ "$frequency" = "437100" ] ; then
frequency=437100000
echo
echo "If the Serenity CubeSat is overhead and transmitting (see tracking application such as Gpredict), you will see packets."
echo
elif [ "$choice" = "8" ] || [ "$frequency" = "Serenity" ] ; then
echo "A recorded WAV file will play and you should see some packets decoded"
echo
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
set -- $value
# aplay -D hw:0,0 /home/pi/CubeSatSim/groundstation/WAV/SDRSharp_20210830_200034Z_437097377Hz_AF.wav &
# aplay -D hw:${2:0:1},0,0 /home/pi/CubeSatSim/groundstation/WAV/SDRSharp_20210830_200034Z_437097377Hz_AF.wav &
aplay -D hw:0,0 /home/pi/CubeSatSim/groundstation/WAV/beacon_test_2.wav &
aplay -D hw:${2:0:1},0,0 /home/pi/CubeSatSim/groundstation/WAV/beacon_test_2.wav &
timeout 30 direwolf -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf-4800.conf -r 48000 -t 0
echo
echo "Test complete. This window will close in 10 seconds."
sleep 5
exit
elif [ "$choice" = "8" ] || [ "$frequency" = "APRS" ] ; then
echo "A recorded APRS WAV file from the CubeSatSim will play and you should see a packet decoded."
echo
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
set -- $value
#aplay -D hw:0,0 /home/pi/CubeSatSim/telem.wav &
(while true; do (sleep 2 && aplay -D hw:0,0 /home/pi/CubeSatSim/telem.wav &>/dev/null); done) &
#aplay -D hw:${2:0:1},0,0 /home/pi/CubeSatSim/telem.wav &
(while true; do (sleep 2 && aplay -D hw:${2:0:1},0,0 /home/pi/CubeSatSim/telem.wav &>/dev/null); done) &
timeout 30 direwolf -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -r 48000 -t 0
echo
echo "Test complete. This window will close in 10 seconds."
sleep 5
exit
#fi
fi
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
echo "Receive frequency is $8 MHz"
echo "Transmit frequency is $7 MHz"
echo
echo "To change, quit and type CubeSatSim/config -F"
echo
frequency="$8e6"
echo "Note that the 'Tuned to' frequency will be different from the chosen frequency due to the way SDRs work."
echo
if [ "$choice" = "7" ] || [ "$choice" = "8" ] || [ "$frequency" = "Serenity" ] || [ "$frequency" = "437100000" ] ; then
if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
echo -e "Auto decoding 4800 bps AX.25 packets on $frequency Hz"
direwolf -qd -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf-4800.conf -t 0 &
echo -e "Direwolf using USB Sound Card (FM Transceiver) on $frequency Hz"
direwolf -qd -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf-fm-pacsat-jp14.conf -t 0 &
else
if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
echo -e "Direwolf using USB Sound Card (FM Transceiver) on $frequency Hz"
direwolf -qd -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf-fm-pacsat.conf -t 0 &
else
echo -e "Direwolf using RTL-SDR on $frequency Hz"
direwolf -r 48000 -qd -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf-pacsat.conf -t 0 &
echo -e "Direwolf using RTL-SDR on $frequency Hz"
direwolf -r 48000 -qd -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf-pacsat.conf -t 0 &
sleep 5
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
set -- $value
#rtl_fm -M fm -f 144.39M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -D hw:0,0 -r 48000 -t raw -f S16_LE -c 1 &
sleep 5
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
set -- $value
#rtl_fm -M fm -f 144.39M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -D hw:0,0 -r 48000 -t raw -f S16_LE -c 1 &
fi
fi
cd /home/pi/Desktop/PacSatGround_0.46m_linux/
sudo setsid java -Xmx512M -jar PacSatGround.jar "/home/pi/PacSatGround" &
sudo setsid java -Xmx512M -jar PacSatGround.jar "/home/pi/PacSatGround"
sleep 5
fi

@ -179,6 +179,8 @@ cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46m/* /home/pi/Desktop/PacSatGr
mkdir /home/pi/PacSatGround
sudo usermod -a -G gpio pi
sudo apt-get install default-jdk -y
cd

@ -25,7 +25,7 @@
int main(int argc, char * argv[]) {
printf("\n\nCubeSatSim v2.0 starting...\n\n");
printf("\n\nCubeSatSim v2.1 starting...\n\n");
wiringPiSetup();
@ -233,8 +233,14 @@ int main(int argc, char * argv[]) {
printf("Mode is Repeater\n");
} else if ( mode_string == 'n') {
mode = TXCOMMAND;
printf("Mode is Transmit Command\n");
} else {
printf("Mode is Transmit Command\n");
} else if ( mode_string == 'p') {
mode = PACSAT;
printf("Mode is Pacsat\n");
} else if ( mode_string == 'P') {
mode = PACSATGND;
printf("Mode is Pacsat Ground Station\n");
} else {
printf("Mode is BPSK\n");
}
}
@ -869,7 +875,7 @@ int main(int argc, char * argv[]) {
} else if ((mode == FSK) || (mode == BPSK)) {// FSK or BPSK
get_tlm_fox();
} else { // SSTV
} else { // SSTV or PACSAT or PACSATGND
// fprintf(stderr, "Sleeping\n");
sleep(30);
}
@ -2205,7 +2211,7 @@ if (setting == ON) {
pclose(command);
fprintf(stderr,"Turning Safe Mode ON\n");
fprintf(stderr,"Turning Battery saver mode ON\n");
if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
if ((mode == AFSK) || (mode == SSTV) || (mode == CW) || (mode == PACSAT)) {
command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r");
pclose(command);
command = popen("sudo reboot now", "r");
@ -2221,7 +2227,7 @@ if (setting == ON) {
FILE *command = popen("rm /home/pi/CubeSatSim/battery_saver", "r");
pclose(command);
fprintf(stderr,"Turning Battery saver mode OFF\n");
if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
if ((mode == AFSK) || (mode == SSTV) || (mode == CW) || (mode == PACSAT)) {
command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r");
pclose(command);
command = popen("sudo reboot now", "r");

@ -108,8 +108,10 @@ FILE *telem_file;
#define BPSK 3
#define SSTV 4
#define CW 5
#define PACSAT 6
#define REPEATER 11
#define TXCOMMAND 12
#define PACSATGND 13
int transmitStatus = -1;

@ -4,15 +4,17 @@
export LD_LIBRARY_PATH=/mnt/usb-disk/ariss/lib:/usr/local/lib/iors_common:$LD_LIBRARY_PATH
sudo systemctl stop cubesatsim
#sudo systemctl stop cubesatsim
sudo systemctl stop transmit
#sudo systemctl stop transmit
sudo systemctl stop command &>/dev/null
sudo modprobe snd-aloop
#sudo systemctl stop openwebrx
sudo systemctl stop rtl_tcp
sudo systemctl stop rtl_tcp &>/dev/null
#pkill -o chromium &>/dev/null
@ -183,7 +185,7 @@ else
echo -e "Auto decoding APRS Pacsat packets on $frequency Hz"
direwolf -qd -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim.conf -t 0 &
direwolf -qd -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-jp14.conf -t 0 &
fi

@ -136,7 +136,7 @@ def increment_mode():
print("can't write to .mode file")
print("CubeSatSim v2.0 transmit.py starting...")
print("CubeSatSim v2.1 transmit.py starting...")
pd = 21
ptt = 20
@ -285,6 +285,8 @@ if __name__ == "__main__":
callsign = config[0]
if len(config) > 5:
sq = config[5]
if (mode == 'p') or (mode == 'P'):
sq = 0 # turn off squelch for Pacsat
print(sq)
if len(config) > 6:
txf = float(config[6])
@ -326,23 +328,24 @@ if __name__ == "__main__":
print("Can't read callsign from sim.cfg file, defaulting to AMSAT")
file.close()
try:
f = open("/home/pi/CubeSatSim/command_control", "r")
f.close()
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
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!")
if (mode != 'p') and (mode != 'P'):
try:
f = open("/home/pi/CubeSatSim/command_control", "r")
f.close()
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
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")
except:
print("command and control not activated")
no_command = True
else:
print("command and control is activated")
no_command = False
# system("/home/pi/CubeSatSim/command &")
system("sudo systemctl start command")
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
@ -350,8 +353,8 @@ if __name__ == "__main__":
print(txLedOn)
GPIO.setup(txLed, GPIO.OUT)
card = "Headphones" # default using pcm audio output of Pi Zero
# card = "Device" # using USB sound card for audio output
# card = "Headphones" # default using pcm audio output of Pi Zero
card = "Device" # using USB sound card for audio output
print("Programming FM module!\n");
output(pd, 1)
@ -381,7 +384,7 @@ if __name__ == "__main__":
# if (mode != ) and (command_tx == True):
# if (command_tx == True):
if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's')) and (command_tx == True) and (skip == False):
if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'p') or (mode == 'P')) and (command_tx == True) and (skip == False):
# battery_saver_mode
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
@ -415,12 +418,19 @@ if __name__ == "__main__":
# if (len(sys.argv)) > 1:
# print("There are arguments!")
if (mode == 'a') or (mode == 'x') or (mode == 'n'):
if (mode == 'a') or (mode == 'x') or (mode == 'n') or (mode == 'p') or (mode == 'P'):
# command_control_check()
output(pd, 1)
output(ptt, 1)
if (mode == 'a'):
print("AFSK")
elif (mode == 'p'):
print("Pacsat")
system('/home/pi/CubeSatSim/pacsatsim.sh')
elif (mode == 'p'):
print("Pacsat Ground Station")
while True:
sleep(30)
else:
GPIO.output(powerPin, 0)
print("Transmit APRS Commands")

@ -1,6 +1,6 @@
#!/bin/bash
echo -e "\nupdate script for CubeSatSim v2.0\n"
echo -e "\nupdate script for CubeSatSim v2.1\n"
if [ "$1" = "n" ] ; then
# if [ -z "$2" ] ; then
@ -33,7 +33,8 @@ sudo sed -i 's/more information/more\ninformation/g' /etc/motd
sudo sed -i 's/update to/update\nto/g' /etc/motd
sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # single core if Pi Zero 2
#sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # single core if Pi Zero 2
sudo sed -i 's/console=tty1 maxcpus=1 r/console=tty1 r/g' /boot/cmdline.txt # remove single core
cd /home/pi/CubeSatSim
@ -300,6 +301,93 @@ git checkout master
#fi
if [ ! -d "/home/pi/pi_pacsat" ]; then
FLAG=1
cd
git clone https://github.com/ac2cz/iors_common.git
cd iors_common/Debug/
make all
sudo ./install.sh
cd
git clone https://github.com/ac2cz/pi_pacsat.git
cd pi_pacsat/Debug
make all
mkdir /home/pi/PacSat
mkdir /home/pi/PacSat/pacsat
mkdir /home/pi/PacSat/pacsat/dir
export LD_LIBRARY_PATH=/mnt/usb-disk/ariss/lib:/usr/local/lib/iors_common:$LD_LIBRARY_PATH
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
echo "bit_rate=9600" > pacsat.config
echo "bbs_callsign=$1" >> pacsat.config
echo "broadcast_callsign=$1-11" >> pacsat.config
echo "digi_callsign=$1-1" >> pacsat.config
echo "max_frames_in_tx_buffer=5" >> pacsat.config
echo "pb_open=1" > pacsat.state
echo "uplink_open=1" >> pacsat.state
sudo sed -i 's/#hdmi_group=1/hdmi_group=2/g' /boot/config.txt
sudo sed -i 's/#hdmi_mode=1/hdmi_mode=16/g' /boot/config.txt
sudo sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/g' /boot/config.txt
sudo raspi-config nonint do_vnc 0
cd /tmp
wget https://www.g0kla.com/pacsat/downloads/test/PacSatGround_0.46m_linux.tar.gz
tar -xzf PacSatGround_0.46m_linux.tar.gz -C /home/pi/Desktop
rm PacSatGround_0.46m_linux.tar.gz
cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46m/* /home/pi/Desktop/PacSatGround_0.46m_linux/spacecraft/
mkdir /home/pi/PacSatGround
sudo usermod -a -G gpio pi
sudo apt-get install default-jdk -y
cd
fi
cd /home/pi/direwolf
#git status
#git status | grep 'invert'
if [[ ! $(git status | grep 'invert') ]]; then
echo "updating direwolf to ptt invert version"
git pull --no-rebase
git checkout invert
make clean
make -j
sudo make install
make install-rpi
cd
fi
changed=0
value=`cat /home/pi/CubeSatSim/sim.cfg`
# echo "$value"

Loading…
Cancel
Save

Powered by TurnKey Linux.