diff --git a/.gitignore b/.gitignore
index 04810931..acb007e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,3 +47,6 @@ logt.txt
telem.txt.bk
failure_mode.txt
sim_mode_auto
+direwolf-pacsatsim-tmp.conf
+groundstation/direwolf-pacsat-tmp.conf
+tlm.bin
diff --git a/asound.conf b/asound.conf
index cf3cc9a0..a752802a 100644
--- a/asound.conf
+++ b/asound.conf
@@ -22,6 +22,7 @@ pcm.softvol {
pcm.shared_speaker {
type dmix
ipc_key 1024
+ ipc_perm 0666
slave {
pcm "hw:CARD=Device,DEV=0"
rate 48000
@@ -35,6 +36,7 @@ pcm.shared_speaker {
pcm.shared_mic {
type dsnoop
ipc_key 2048
+ ipc_perm 0666
slave {
pcm "hw:CARD=Device,DEV=0"
# channels 1
diff --git a/command b/command
index f4c96b1d..73839a05 100755
--- a/command
+++ b/command
@@ -1,9 +1,17 @@
#!/bin/bash
-echo -e "\nCommand and Control script for CubeSatSim v2.1\n"
+echo -e "\nCommand and Control script for CubeSatSim v2.2\n"
sudo modprobe snd-aloop
+sudo modprobe snd-aloop
+
+value=`cat /home/pi/CubeSatSim/.mode`
+echo "$value" > /dev/null
+set -- $value
+
+MODE=$1
+
FILE=/home/pi/CubeSatSim/command_control
if [ -f "$FILE" ]; then
echo "Radio command and control is ON"
@@ -58,11 +66,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 | /home/pi/venv/bin/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 | /home/pi/venv/bin/python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
fi
else
@@ -107,11 +115,11 @@ else
# echo "debug mode"
-# direwolf -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
+# direwolf -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf.conf -t 0l | /home/pi/venv/bin/python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
# else
-# direwolf -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
+# direwolf -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf.conf -t 0l | /home/pi/venv/bin/python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
# fi
@@ -124,17 +132,32 @@ else
fi
- if [ "$1" = "d" ]; then
-
- echo "debug mode"
-
- python3 /home/pi/CubeSatSim/squelch_cc.py d
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+ MODE=$1
+
+ if [ ! "$MODE" = "P" ] && [ ! "$MODE" = "P" ] ; then
+
+ if [ "$1" = "d" ]; then
+
+ echo "debug mode"
+
+ /home/pi/venv/bin/python3 /home/pi/CubeSatSim/squelch_cc.py d
+
+ else
+
+ /home/pi/venv/bin/python3 /home/pi/CubeSatSim/squelch_cc.py
+
+ fi
+
else
-
- python3 /home/pi/CubeSatSim/squelch_cc.py
-
- fi
+
+ echo "Not running Carrier (squelch) Command and Control since PacSat or PacSat Ground Station mode!"
+ sleep 60
+
+ fi
fi
sudo killall -9 direwolf &>/dev/null
diff --git a/config b/config
index 134819d1..d2106a8f 100755
--- a/config
+++ b/config
@@ -43,6 +43,9 @@ function transmit_command {
j)
number=7
;;
+ p)
+ number=8
+ ;;
o)
number=10
;;
@@ -92,7 +95,9 @@ function check_restart {
echo "$value" > /dev/null
set -- $value
- if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
+ if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ reboot=1
+ elif [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
@@ -139,6 +144,7 @@ if [ "$1" = "" ]; then
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
+ MODE=$1
if [ "$1" = "a" ]; then
echo "Mode is APRS"
@@ -162,6 +168,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
@@ -270,8 +280,13 @@ if [ "$1" = "" ]; then
# cat /home/pi/CubeSatSim/command_tx
# echo
- echo -n "Squelch level is: "
- echo $6
+# echo $MODE
+ if [ "$MODE" = "p" ] || [ "$MODE" = "P" ] ; then
+ echo "Squelch is off since PacSat or PacSat Ground Station mode"
+ else
+ echo -n "Squelch level is: "
+ echo $6
+ fi
# echo
FILE=/home/pi/CubeSatSim/command_control
@@ -282,10 +297,18 @@ if [ "$1" = "" ]; then
if [ -f "$FILE" ]; then
echo "Radio DTMF/APRS command and control is ON"
else
- echo "Radio carrier command and control is ON"
+ if [ "$MODE" = "p" ] || [ "$MODE" = "P" ] ; then
+ echo "Radio carrier command and control is off since PacSat or PacSat Ground Station mode"
+ else
+ echo "Radio carrier command and control is ON"
+ fi
fi
else
- echo "Radio carrier command and control is ON"
+ if [ "$MODE" = "p" ] || [ "$MODE" = "P" ] ; then
+ echo "Radio carrier command and control is off since PacSat or PacSat Ground Station mode"
+ else
+ echo "Radio carrier command and control is ON"
+ fi
fi
else
echo "Radio command and control is OFF"
@@ -315,6 +338,32 @@ if [ "$1" = "" ]; then
echo "Transmit beacon telemetry is ON"
fi
+ if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
+ echo "USB Sound Card detected"
+ soundcard=1
+ else
+ echo "No USB Sound Card detected"
+ soundcard=0
+ fi
+
+ gpio -g mode 7 up
+ if [[ $(gpio -g read 7 | grep 0) ]] ; then
+ echo "FM TXC is present"
+ txc=1
+ else
+ echo "FM TXC not present"
+ txc=0
+ fi
+
+ timeout 1 rtl_test &> out.txt
+ if [[ $(grep "No supported" out.txt) ]] ; then
+# echo "No RTL-SDR detected"
+ rtl=0
+ else
+ echo "RTL-SDR detected"
+ rtl=1
+ fi
+
echo
echo -e "Current sim.cfg configuration file:"
# echo
@@ -383,7 +432,11 @@ elif [ "$1" = "-f" ]; then
echo "changing CubeSatSim to FSK mode"
sudo echo "f" > /home/pi/CubeSatSim/.mode
- restart=1
+ if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ reboot=1
+ else
+ restart=1
+ fi
fi
elif [ "$1" = "-b" ]; then
@@ -400,7 +453,11 @@ elif [ "$1" = "-b" ]; then
echo "changing CubeSatSim to BPSK mode"
sudo echo "b" > /home/pi/CubeSatSim/.mode
- restart=1
+ if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ reboot=1
+ else
+ restart=1
+ fi
fi
elif [ "$1" = "-s" ]; then
@@ -482,8 +539,10 @@ elif [ "$1" = "-c" ]; then
echo "$value" > /dev/null
set -- $value
+ oldcallsign="$1"
+
echo "Current value of CALLSIGN is"
- echo $1
+ echo $oldcallsign
echo
# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13}
@@ -669,6 +728,7 @@ elif [ "$1" = "-C" ]; then
sudo systemctl stop cubesatsim
sudo systemctl stop transmit
sudo systemctl stop command
+ sudo systemctl stop pacsatsim
sudo mv -f /home/pi/CubeSatSim/telem.txt /home/pi/CubeSatSim/telem.txt.bk
@@ -856,7 +916,7 @@ elif [ "$1" = "-R" ]; then
echo
echo "Current commands count is:"
- cat /home/pi/CubeSatSim/commands_count.txt
+ cat /home/pi/CubeSatSim/command_count.txt
echo
echo "Do you want to reset the commands count to zero (y/n) "
@@ -1119,8 +1179,9 @@ elif [ "$1" = "-o" ]; then
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
+ MODE=$1
- if [ "$1" == "n" ]; then
+ if [ "$MODE" == "n" ]; then
transmit_command "o"
@@ -1131,35 +1192,19 @@ elif [ "$1" = "-o" ]; then
FILE=/home/pi/CubeSatSim/beacon_off
if [ -f "$FILE" ]; then
- echo "Transmit beacon telemetry is off"
-# echo
-# echo "Do you want to turn beacon telemetry ON (y/n) "
-# read reset
-
- reset="y"
+ echo "Transmit beacon telemetry is off"
echo
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
- echo "Turn beacon telemetry ON"
- sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1
- sudo systemctl restart transmit
- # restart=1
- fi
-
+ echo "Turn beacon telemetry ON"
+ sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1
+ sudo systemctl restart transmit
else
- echo "Transmit beacon telemetry is on"
-# echo
-# echo "Do you want to turn beacon telemetry OFF (y/n) "
-# read reset
- reset="y"
+ echo "Transmit beacon telemetry is on"
echo
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
- echo "Turn beacon telemetry OFF"
- touch /home/pi/CubeSatSim/beacon_off
- sudo systemctl restart transmit
- # restart=1
- fi
+ echo "Turn beacon telemetry OFF"
+ touch /home/pi/CubeSatSim/beacon_off
+ sudo systemctl restart transmit
fi
sleep 3
fi
@@ -1239,7 +1284,11 @@ elif [ "$1" = "-e" ]; then
echo "changing CubeSatSim to Repeater mode"
sudo echo "e" > /home/pi/CubeSatSim/.mode
- restart=1
+ if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ reboot=1
+ else
+ restart=1
+ fi
fi
elif [ "$1" = "-n" ]; then
@@ -1262,6 +1311,10 @@ elif [ "$1" = "-n" ]; then
echo "Switching to mode "$new
sudo echo $new > /home/pi/CubeSatSim/.mode
restart=1
+ elif [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ echo "Switching to PacSat mode"
+ sudo echo $new > /home/pi/CubeSatSim/.mode
+ reboot=1
else
echo "Switching to BPSK mode"
sudo echo "b" > /home/pi/CubeSatSim/.mode
@@ -1314,7 +1367,7 @@ elif [ "$1" = "-A" ]; then
sudo systemctl stop cubesatsim
sudo systemctl stop transmit
- 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
sudo systemctl stop command
@@ -1323,7 +1376,7 @@ elif [ "$1" = "-A" ]; then
while [ "$MODE" != "x" ];
do
- 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"
+ echo "Enter the mode to change: a=APRS, f=FSK, b=BPSK, s=SSTV, m=CW, e=Repeater, j=FUNcube, p=PacSat, o=Beacon on/off x=Exit this mode"
read MODE
if [ "$MODE" != "x" ]; then
@@ -1747,6 +1800,61 @@ reboot=1
fi
+elif [ "$1" = "-G" ]; then
+
+ echo "Changing to PacSatSim mode"
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+
+# echo "changing CubeSatSim to Pacsat mode"
+
+ reboot=1
+ 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"
+ echo
+ echo "Run the Pacsat Ground Station in the Desktop"
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+
+# echo "changing CubeSatSim to Pacsat mode"
+
+ reboot=1
+ 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" = "-k" ]; then
+
+ echo
+ echo "Reset PacSatSim configuration"
+ echo
+ sudo systemctl stop pacsatsim &>/dev/null
+ sudo rm -r /home/pi/PacSat
+ reboot=1
+
elif [ "$1" = "-h" ]; then
echo "config OPTION"
@@ -1762,13 +1870,16 @@ elif [ "$1" = "-h" ]; then
echo " -j Change to FUNcube mode"
echo " -n Change to Transmit Commands mode"
echo " -e Change to Repeater mode"
+ echo " -j Change to FUNcube mode"
+ echo " -G Change to PacSatSim mode"
+ echo " -I Change to PacSat Ground Station mode"
echo " -i Restart CubeSatsim software"
echo " -c Change the CALLSIGN in the configuration file sim.cfg"
echo " -t Change the Simulated Telemetry setting in sim.cfg"
echo " -r Change the Resets Count in the configuration file sim.cfg"
echo " -l Change the Latitude and Longitude in the configuration file sim.cfg"
echo " -S Scan both I2C buses on the Raspberry Pi"
- echo " -C Clear logs"
+ echo " -C Clear logs and reboot"
echo " -T Change command and control state"
echo " -d Change command and control Direwolf state"
echo " -R Change the Commands Count in the file command_count.txt"
@@ -1779,7 +1890,7 @@ elif [ "$1" = "-h" ]; then
echo " -H Change the Balloon (HAB) mode"
echo " -p Display payload sensor data for 3 seconds"
echo " -v Display voltage and current data"
- echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX"
+ echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for FM RX and TX"
echo " -A Transmit APRS control packets to control another CubeSatSim"
echo " -D Change Transmit Commands state APRS or DTMF"
echo " -o Change telemetry beacon transmit state"
@@ -1789,6 +1900,8 @@ elif [ "$1" = "-h" ]; then
echo " -U Change the random failure mode setting"
echo " -N Set next mode or failure"
echo " -u Change gpsd state"
+ echo " -k Reset the PacSatSim Configuration"
+
echo
exit
diff --git a/direwolf-cc.conf b/direwolf-cc.conf
index 26f8805b..af71089d 100644
--- a/direwolf-cc.conf
+++ b/direwolf-cc.conf
@@ -1,2 +1,9 @@
ADEVICE shared_mic hw:CARD=Loopback,DEV=1
DTMF
+MYCALL AMSAT
+CHANNEL 0
+MODEM 1200
+FULLDUP OFF
+TXDELAY 0
+AGWPORT 8200
+KISSPORT 8201
diff --git a/direwolf/direwolf-pacsatsim.conf b/direwolf/direwolf-pacsatsim.conf
new file mode 100644
index 00000000..b96fc68f
--- /dev/null
+++ b/direwolf/direwolf-pacsatsim.conf
@@ -0,0 +1,9 @@
+CHANNEL 0
+MODEM 1200
+DWAIT 0
+SLOTTIME 10
+PERSIST 63
+TXDELAY 1000
+TXTAIL 10
+FULLDUP OFF
+DIGIPEAT 0 0 ^WIDE[3-7]-[1-7]$|^TEST$ ^WIDE[12]-[12]$ TRACE
diff --git a/direwolf/direwolf-transmit-dtmf.conf b/direwolf/direwolf-transmit-dtmf.conf
index a2fdd69c..f5853dff 100644
--- a/direwolf/direwolf-transmit-dtmf.conf
+++ b/direwolf/direwolf-transmit-dtmf.conf
@@ -1,4 +1,5 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
+PTT GPIO 20
MYCALL AMSAT
CHANNEL 0
MODEM 1200
diff --git a/direwolf/direwolf.conf b/direwolf/direwolf.conf
deleted file mode 100644
index 701d80b4..00000000
--- a/direwolf/direwolf.conf
+++ /dev/null
@@ -1 +0,0 @@
-ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=Loopback,DEV=0
diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py
index 18ed491f..9ac5909f 100644
--- a/dtmf_aprs_cc.py
+++ b/dtmf_aprs_cc.py
@@ -1,7 +1,5 @@
import sys
from os import system
-# import RPi.GPIO as GPIO
-# from RPi.GPIO import output
from time import sleep
import logging
logging.basicConfig(format='%(message)s')
@@ -10,10 +8,8 @@ logging.basicConfig(format='%(message)s')
def blink(times):
for i in range(times):
system("gpio write 27 0")
-# GPIO.output(27, 0)
sleep(0.1)
system("gpio write 27 1")
-# GPIO.output(27, 1)
sleep(0.1)
if __name__ == "__main__":
@@ -26,153 +22,167 @@ if __name__ == "__main__":
# print("There are arguments!")
if ('d' == sys.argv[1]):
debug_mode = True
-
- for line in sys.stdin:
-# if (debug_mode):
- print(line, end =" ")
- logging.warning(line)
-
-# if '^c' == line.rstrip():
-# break
- if ((line.find("MODE=a")) > 0):
- system("echo '\nAPRS Mode!!\n'")
- mode = 'a'
- change_mode = True
- if ((line.find("DTMF>APDW15:t1#")) > 0):
- system("echo '\nAPRS Mode!!\n'")
- mode = 'a'
- change_mode = True
- if ((line.find("MODE=f")) > 0):
- system("echo '\nFSK Mode!!\n'")
- mode = 'f'
- change_mode = True
- if ((line.find("DTMF>APDW15:t2#")) > 0):
- system("echo '\nFSK Mode!!\n'")
- mode = 'f'
- change_mode = True
- if ((line.find("MODE=b")) > 0):
- system("echo '\nBPSK Mode!!\n'")
- mode = 'b'
- change_mode = True
- if ((line.find("DTMF>APDW15:t3#")) > 0):
- system("echo '\nBPSK Mode!!\n'")
- mode = 'b'
- change_mode = True
- if ((line.find("MODE=s")) > 0):
- system("echo '\nSSTV Mode!!\n'")
- mode = 's'
- change_mode = True
- if ((line.find("DTMF>APDW15:t4#")) > 0):
- system("echo '\nSSTV Mode!!\n'")
- mode = 's'
- change_mode = True
- if ((line.find("MODE=m")) > 0):
- system("echo '\nCW Mode!!\n'")
- mode = 'm'
- change_mode = True
- 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
- if ((line.find("DTMF>APDW15:t6#")) > 0):
- system("echo '\nRepeater Mode!!\n'")
- mode = 'e'
- change_mode = True
- if ((line.find("MODE=j")) > 0):
- system("echo '\nFUNcube Mode!!\n'")
- mode = 'j'
- change_mode = True
- if ((line.find("DTMF>APDW15:t7#")) > 0):
- system("echo '\nFUNcube Mode!!\n'")
- mode = 'j'
- change_mode = True
- if ((line.find("MODE=n")) > 0):
- system("echo '\nTransmit Commands Mode!!\n'")
- mode = 'n'
- change_mode = True
- if ((line.find("DTMF>APDW15:t11#")) > 0):
- system("echo '\nTransmit Commands Mode!!\n'")
- mode = 'n'
- change_mode = True
- if ((line.find("MODE=o")) > 0):
- 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): # skip every other APRS command since Direwolf prints them twice
- if (mode == 'f'):
- blink(2)
- sleep(1)
-
- elif (mode == 'b'):
- blink(3)
- sleep(1)
-
- elif (mode == 's'):
- blink(4)
- sleep(1)
+ while True:
+ try:
+ for line in sys.stdin:
+ # if (debug_mode):
+ print(line, end =" ")
+ logging.warning(line)
+
+ # if '^c' == line.rstrip():
+ # break
- elif (mode == 'm'):
- blink(5)
- sleep(1)
+ if ((line.find("MODE=a")) > 0):
+ system("echo '\nAPRS Mode!!\n'")
+ mode = 'a'
+ change_mode = True
+
+ elif ((line.find(":t1#")) > 0):
+ system("echo '\nAPRS Mode!!\n'")
+ mode = 'a'
+ change_mode = True
+ elif ((line.find("MODE=f")) > 0):
+ system("echo '\nFSK Mode!!\n'")
+ mode = 'f'
+ change_mode = True
+
+ elif ((line.find(":t2#")) > 0):
+ system("echo '\nFSK Mode!!\n'")
+ mode = 'f'
+ change_mode = True
+
+ elif ((line.find("MODE=b")) > 0):
+ system("echo '\nBPSK Mode!!\n'")
+ mode = 'b'
+ change_mode = True
+
+ elif ((line.find(":t3#")) > 0):
+ system("echo '\nBPSK Mode!!\n'")
+ mode = 'b'
+ change_mode = True
+ elif ((line.find("MODE=s")) > 0):
+ system("echo '\nSSTV Mode!!\n'")
+ mode = 's'
+ change_mode = True
+
+ elif ((line.find(":t4#")) > 0):
+ system("echo '\nSSTV Mode!!\n'")
+ mode = 's'
+ change_mode = True
+
+ elif ((line.find("MODE=m")) > 0):
+ system("echo '\nCW Mode!!\n'")
+ mode = 'm'
+ change_mode = True
+
+ elif ((line.find(":t5#")) > 0):
+ system("echo '\nCW Mode!!\n'")
+ mode = 'm'
+ change_mode = True
+
+ elif ((line.find("MODE=e")) > 0):
+ system("echo '\nRepeater Mode!!\n'")
+ mode = 'e'
+ change_mode = True
+
+ elif ((line.find(":t6#")) > 0):
+ system("echo '\nFUNcube Mode!!\n'")
+ mode = 'j'
+ change_mode = True
+
+ elif ((line.find("MODE=G")) > 0):
+ system("echo '\nPacSatSim Mode!!\n'")
+ mode = 'p'
+ change_mode = True
+
+ elif ((line.find(":t8#")) > 0):
+ system("echo '\nPacSatSim Mode!!\n'")
+ mode = 'p'
+ change_mode = True
+
+ elif ((line.find("MODE=n")) > 0):
+ system("echo '\nTransmit Commands Mode!!\n'")
+ mode = 'n'
+ change_mode = True
+
+ elif ((line.find(":t11#")) > 0):
+ system("echo '\nTransmit Commands Mode!!\n'")
+ mode = 'n'
+ change_mode = True
- elif (mode == 'e'):
- blink(6)
- sleep(1)
-
- elif (mode == 'j'):
- blink(7)
- sleep(1)
-
- elif (mode == 'a'):
- mode = 'a'
- blink(1)
- sleep(1)
-
- try:
- file = open("/home/pi/CubeSatSim/command_count.txt", "r")
- string = file.read()
- file.close()
- command_count = int(string)
- command_count += 1
- filec = open("/home/pi/CubeSatSim/command_count.txt", "w")
- command_count_string = str(command_count)
- print(command_count_string)
- string = filec.write(command_count_string)
- filec.close()
- except:
- print("Can't write command_count file!")
- print("Command_count: ")
- print(command_count)
-
-# GPIO.output(txLed, 0)
-# GPIO.output(powerPin, 0)
- system("gpio write 27 1")
- system("gpio write 0 0")
- system("gpio write 2 0")
+ elif ((line.find("MODE=o")) > 0):
+ system("echo '\nBeacon Mode toggle!!\n'")
+ mode = 'o'
+ change_mode = True
+# counter = (counter + 1) % 2
+
+ elif ((line.find(":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
- system("sudo systemctl stop transmit")
-# system("sudo systemctl stop cubesatsim")
-
- print("\n/home/pi/CubeSatSim/config -" + mode)
- system("/home/pi/CubeSatSim/config -" + mode)
+ if (mode == 'f'):
+ blink(2)
+ sleep(1)
+
+ elif (mode == 'b'):
+ blink(3)
+ sleep(1)
+
+ elif (mode == 's'):
+ blink(4)
+ sleep(1)
+
+ elif (mode == 'm'):
+ blink(5)
+ sleep(1)
+
+ elif (mode == 'e'):
+ blink(6)
+ sleep(1)
+
+ elif (mode == 'j'):
+ blink(7)
+ sleep(1)
+
+ elif (mode == 'p'):
+ blink(8)
+ sleep(1)
+
+ elif (mode == 'a'):
+ blink(1)
+ sleep(1)
+
+ try:
+ file = open("/home/pi/CubeSatSim/command_count.txt", "r")
+ string = file.read()
+ file.close()
+ command_count = int(string)
+ command_count += 1
+ filec = open("/home/pi/CubeSatSim/command_count.txt", "w")
+ command_count_string = str(command_count)
+ print(command_count_string)
+ string = filec.write(command_count_string)
+ filec.close()
+ except:
+ print("Can't write command_count file!")
+ print("Command_count: ")
+ print(command_count)
+ system("gpio write " + str(txLed) + " 0")
+ system("gpio write " + str(powerPin) + " 0")
+ system("sudo systemctl stop transmit")
+ # system("sudo systemctl stop cubesatsim")
+
+ print("\n/home/pi/CubeSatSim/config -" + mode)
+ system("/home/pi/CubeSatSim/config -" + mode)
+
+ change_mode = False
+ except:
+ print("Error reading line (probably due to UTF-8 issue)")
-
- change_mode = False
-
print("Waiting 5 seconds to allow unplug and plug of soundcard")
sleep(5)
print("Done")
diff --git a/groundstation/SDRpp.desktop b/groundstation/SDRpp.desktop
new file mode 100644
index 00000000..f4f4ba38
--- /dev/null
+++ b/groundstation/SDRpp.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Exec=/home/pi/CubeSatSim/groundstation/sdrpp.sh
+Name=SDRpp
+Comment=SDRpp
+Icon=/home/pi/Icons/sdrpp.png
+Path=/home/pi
+Terminal=true
+Categories=HamRadio
+Keywords=Ham Radio;SDR
diff --git a/groundstation/aprs.desktop b/groundstation/aprs.desktop
index b9ee2512..a7d0062a 100644
--- a/groundstation/aprs.desktop
+++ b/groundstation/aprs.desktop
@@ -2,7 +2,7 @@
Name=APRS Decode using Direwolf
GenericName=Decodes APRS using rtl_fm and Direwolf
Comment=APRS signals
-Exec=/home/pi/CubeSatSim/groundstation/aprs.sh
+Exec=/usr/bin/x-terminal-emulator --geometry=120x40 -e "/home/pi/CubeSatSim/groundstation/packet.sh"
Icon=/home/pi/Icons/aprs.png
Terminal=true
Type=Application
diff --git a/groundstation/aprs.sh b/groundstation/aprs.sh
index 2e1c6873..427c36cb 100755
--- a/groundstation/aprs.sh
+++ b/groundstation/aprs.sh
@@ -3,12 +3,14 @@
sudo modprobe snd-aloop
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null
@@ -78,7 +80,7 @@ echo -e "Auto decoding APRS packets on $frequency Hz"
#sudo rtl_fm -f 144.39M -s 22050 -g 48 - | multimon-ng -a AFSK1200 -A -t raw -
-direwolf -r 48000 -t 0 &
+direwolf -c /home/pi/CubeSatSim/groundstation/direwolf.conf -r 48000 -t 0 &
sleep 5
@@ -87,6 +89,7 @@ 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
+#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
+rtl_fm -M fm -f $frequency -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
sleep 5
diff --git a/groundstation/autostart/chromium.desktop b/groundstation/autostart/chromium.desktop
index fc57834e..5fd6bef0 100644
--- a/groundstation/autostart/chromium.desktop
+++ b/groundstation/autostart/chromium.desktop
@@ -2,4 +2,4 @@
[Desktop Entry]
Type=Application
Name=Chromium with WebSDR
-Exec=chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8073
+Exec=chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars --app=http://localhost:8073
diff --git a/groundstation/bookmarks.json b/groundstation/bookmarks.json
index f8bae496..b3c55a2c 100644
--- a/groundstation/bookmarks.json
+++ b/groundstation/bookmarks.json
@@ -1,137 +1,57 @@
[
- {
- "name": "ISS APRS",
- "frequency": 145825000,
- "modulation": "nfm"
- },
- {
- "name": "ISS SSTV/Voice",
- "frequency": 145800000,
- "modulation": "nfm"
- },
- {
- "name": "ARISS Repeater Downlink",
- "frequency": 437800000,
- "modulation": "nfm"
- },
- {
- "name": "AO-27",
- "frequency": 436795000,
- "modulation": "nfm"
- },
- {
- "name": "AO-73",
- "frequency": 145815000,
- "modulation": "usb"
- },
- {
- "name": "Fox-1B AO-91",
- "frequency": 145960000,
- "modulation": "nfm"
- },
- {
- "name": "Fox-1D AO-92",
- "frequency": 145880000,
- "modulation": "nfm"
- },
- {
- "name": "HuskySat-1 HO-107",
- "frequency": 435800000,
- "modulation": "usb"
- },
- {
- "name": "Fox-1E",
- "frequency": 435750000,
- "modulation": "usb"
- },
- {
- "name": "MAX VALIER",
- "frequency": 145860000,
- "modulation": "usb"
- },
- {
- "name": "NOAA WX Radio 1",
- "frequency": 162400000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 2",
- "frequency": 162425000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 3",
- "frequency": 162450000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 4",
- "frequency": 162475000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 5",
- "frequency": 162500000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 6",
- "frequency": 162525000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 7",
- "frequency": 162550000,
- "modulation": "nfm"
- },
- {
- "name": "CAS-4A",
- "frequency": 145855000,
- "modulation": "usb"
- },
- {
- "name": "CAS-4B",
- "frequency": 145910000,
- "modulation": "usb"
- },
- {
- "name": "XW-2A",
- "frequency": 145660000,
- "modulation": "usb"
- },
- {
- "name": "XW-2B",
- "frequency": 145725000,
- "modulation": "usb"
- },
- {
- "name": "XW-2C",
- "frequency": 145790000,
- "modulation": "usb"
- },
- {
- "name": "XW-2F",
- "frequency": 145975000,
- "modulation": "usb"
- },
- {
- "name": "NOAA-19",
- "frequency": 137100000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA-18",
- "frequency": 137912500,
- "modulation": "nfm"
- },
- {
- "name": "NOAA-15",
- "frequency": 137620000,
- "modulation": "nfm"
- },
- {
- "name": "CubeSatSim",
- "frequency": 434900000,
- "modulation": "packet"
- }
+ {
+ "name": "NOAA WX Radio 1",
+ "frequency": 162400000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 2",
+ "frequency": 162425000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 3",
+ "frequency": 162450000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 4",
+ "frequency": 162475000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 5",
+ "frequency": 162500000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 6",
+ "frequency": 162525000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 7",
+ "frequency": 162550000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "CubeSatSim",
+ "frequency": 434900000,
+ "modulation": "packet"
+ },
+ {
+ "name": "ISS SSTV/Voice",
+ "frequency": 145800000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "ISS APRS",
+ "frequency": 145825000,
+ "modulation": "packet"
+ },
+ {
+ "name": "ISS Voice Repeater",
+ "frequency": 437800000,
+ "modulation": "nfm"
+ }
]
diff --git a/groundstation/cubicsdr.desktop b/groundstation/cubicsdr.desktop
index 1599f5df..2cf19759 100644
--- a/groundstation/cubicsdr.desktop
+++ b/groundstation/cubicsdr.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/home/pi/CubeSatSim/groundstation/cubicsdr.sh
Name=SDR FM Broadcast
Comment=CubicSDR FM Broadcast
-Icon=/home/pi/Downloads/cubicsdr.png
+Icon=/home/pi/Icons/cubicsdr.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/cubicsdr.sh b/groundstation/cubicsdr.sh
index 5d66f4c3..3b125dc6 100755
--- a/groundstation/cubicsdr.sh
+++ b/groundstation/cubicsdr.sh
@@ -9,19 +9,21 @@ echo "Note: Select Generic RTL2832 device then click Start to begin"
echo
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
sudo killall -9 java &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null
-sudo killall -9 aplay &>/dev/null
+#sudo killall -9 aplay &>/dev/null
sudo killall -9 qsstv &>/dev/null
@@ -39,11 +41,28 @@ sudo killall -9 sdrpp &>/dev/null
sudo killall -9 zenity &>/dev/null
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
sudo killall -9 rtl_fm &>/dev/null
zenity --info --width=650 --height=140 --title="Instructions" --text="When CubicSDR opens, select Generic RTL2832U device then click Start to begin.\n\nThen click on a signal in the watefall to listen." &
+sleep 5
+
+setsid CubicSDR
+
+sleep 10
+#$SHELL
+#sudo kill `ps -aux | grep sstv_decode_prompt| grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
+zenity --info --width=650 --height=140 --title="Instructions" --text="When CubicSDR opens, select Generic RTL2832U device then click Start to begin.\n\nThen click on a signal in the watefall to listen." &
sleep 5
diff --git a/groundstation/direwolf.conf b/groundstation/direwolf.conf
index ce8b6823..d70427b9 100644
--- a/groundstation/direwolf.conf
+++ b/groundstation/direwolf.conf
@@ -1 +1 @@
-ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=b1,DEV=0
+ADEVICE plughw:CARD=Loopback,DEV=1 default
diff --git a/groundstation/direwolf/direwolf-pacsat.conf b/groundstation/direwolf/direwolf-pacsat.conf
new file mode 100644
index 00000000..3b9d337b
--- /dev/null
+++ b/groundstation/direwolf/direwolf-pacsat.conf
@@ -0,0 +1,9 @@
+CHANNEL 0
+MODEM 1200
+KISSPORT 8100
+AGWPORT 8002
+DWAIT 20
+SLOTTIME 300
+PERSIST 63
+TXDELAY 1000
+FULLDUP OFF
diff --git a/groundstation/fox-download.desktop b/groundstation/fox-download.desktop
index d58827d0..4e4bcf40 100644
--- a/groundstation/fox-download.desktop
+++ b/groundstation/fox-download.desktop
@@ -2,7 +2,7 @@
Type=Application
Exec=/home/pi/CubeSatSim/groundstation/fox-download.sh
Name=FoxTelem Download
-Comment=FIAB-v3
+Comment=FIAB-v4
Icon=/home/pi/Icons/FoxTelemDownload.png
Path=/home/pi
Terminal=true
diff --git a/groundstation/fox-profile.desktop b/groundstation/fox-profile.desktop
index c03f40d4..8b7aaabe 100644
--- a/groundstation/fox-profile.desktop
+++ b/groundstation/fox-profile.desktop
@@ -2,8 +2,8 @@
Type=Application
Exec=/home/pi/CubeSatSim/groundstation/fox-profile.sh
Name=Change FoxTelem Profile
-Comment=FIAB-v3
-Icon=/home/pi/Downloads/foxtelem.png
+Comment=FIAB-v4
+Icon=/home/pi/Icons/foxtelem.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/fox-run.sh b/groundstation/fox-run.sh
index fa456cd1..d321719d 100755
--- a/groundstation/fox-run.sh
+++ b/groundstation/fox-run.sh
@@ -5,6 +5,8 @@ echo "Startup script to run FoxTelem for FIAB v4"
echo
+source /home/pi/venv/bin/activate
+
sudo killall -9 FoxTelem &>/dev/null
sudo killall -9 zenity &>/dev/null
@@ -12,7 +14,7 @@ sudo killall -9 zenity &>/dev/null
FILE=/home/pi/FoxTelemetryData/.foxprofile
if [ ! -f "$FILE" ]; then
- profile=$(zenity --text="Choose your default FoxTelem profile:" --list 2>/dev/null --width=410 --height=120 --title="Set FoxTelem Profile" --column="Profile" --column="Receive and decode telemetry from" Fox-in-a-Box "AMSAT Fox satellites" "CubeSatSim" "AMSAT CubeSat Simulator")
+ profile=$(zenity --text="Choose your default FoxTelem profile:" --list 2>/dev/null --width=410 --height=120 --title="Set FoxTelem Profile" --column="Profile" --column="Receive and decode telemetry from" Fox-in-a-Box "AMSAT Satellites" "CubeSatSim" "AMSAT CubeSat Simulator")
echo $profile
diff --git a/groundstation/fox.sh b/groundstation/fox.sh
index 9e1f4130..27050f9a 100755
--- a/groundstation/fox.sh
+++ b/groundstation/fox.sh
@@ -5,12 +5,14 @@ echo "Script to run FoxTelem for ARISS Radio Pi"
echo
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 rtl_tcp &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
@@ -23,12 +25,15 @@ sudo killall -9 sdrpp &>/dev/null
sudo killall -9 direwolf &>/dev/null
-sudo killall -9 aplay &>/dev/null
+#sudo killall -9 aplay &>/dev/null
sudo killall -9 qsstv &>/dev/null
sudo killall -9 zenity &>/dev/null
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
sudo killall -9 rtl_fm &>/dev/null
sleep 5
diff --git a/groundstation/foxtelem.desktop b/groundstation/foxtelem.desktop
index 9dc42ab9..c01913be 100644
--- a/groundstation/foxtelem.desktop
+++ b/groundstation/foxtelem.desktop
@@ -2,8 +2,8 @@
Type=Application
Exec=/home/pi/CubeSatSim/groundstation/fox-run.sh
Name=FoxTelem
-Comment=FIAB-v3
-Icon=/home/pi/Downloads/foxtelem.png
+Comment=FIAB-v4
+Icon=/home/pi/Icons/foxtelem.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/gpredict.desktop b/groundstation/gpredict.desktop
index 20a6ab49..69d11ecb 100644
--- a/groundstation/gpredict.desktop
+++ b/groundstation/gpredict.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/usr/bin/gpredict
Name=Gpredict
Comment=ISS and Satellite Tracking for ARISS Radio Pi
-Icon=/home/pi/Downloads/gpredict.png
+Icon=/home/pi/Icons/gpredict.png
Path=/home/pi
Terminal=false
Categories=HamRadio
diff --git a/groundstation/loc-add-foxtelem.py b/groundstation/loc-add-foxtelem.py
index 64c47bbd..1f4279cc 100644
--- a/groundstation/loc-add-foxtelem.py
+++ b/groundstation/loc-add-foxtelem.py
@@ -118,6 +118,16 @@ if (latitude != 0) and (longitude != 0):
system(longSedStr)
print("\nKLAtracker configuration updated with your latitude and longitude")
+
+ latSedStr = 'sed -i "s/latitude=.*/latitude=' + str(latitude) + '/g" /home/pi/PacSatGround/PacSatGround.properties'
+ #print (latSedStr)
+ system(latSedStr)
+
+ longSedStr = 'sed -i "s/longitude=.*/longitude=' + str(longitude) + '/g" /home/pi/PacSatGround/PacSatGround.properties'
+ #print (longSedStr)
+ system(longSedStr)
+
+ print("\nPacsat configuration updated with your latitude and longitude")
receiver_gpsSedStr = 'sudo sed -i "s/ ' + dquote + 'lat' + dquote + ': .*/ ' + dquote + 'lat' + dquote + ': ' + str(latitude) + ',/g" /var/lib/openwebrx/settings.json'
#print (receiver_gpsSedStr)
diff --git a/groundstation/loc.sh b/groundstation/loc.sh
index bdbedc77..94558962 100755
--- a/groundstation/loc.sh
+++ b/groundstation/loc.sh
@@ -12,4 +12,3 @@ python3 /home/pi/CubeSatSim/groundstation/loc-foxtelem.py
#/usr/bin/gpredict
nohup /usr/bin/gpredict /dev/null 2>&1 &
-
diff --git a/groundstation/packet.sh b/groundstation/packet.sh
index 803e988a..2213b052 100755
--- a/groundstation/packet.sh
+++ b/groundstation/packet.sh
@@ -14,6 +14,8 @@ pkill -o chromium &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 direwolf &>/dev/null
sudo killall -9 aplay &>/dev/null
@@ -166,5 +168,4 @@ rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t r
rtl_fm -M fm -f $frequency -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
-
sleep 5
diff --git a/groundstation/pacsat-config.sh b/groundstation/pacsat-config.sh
new file mode 100755
index 00000000..f5b64ff3
--- /dev/null
+++ b/groundstation/pacsat-config.sh
@@ -0,0 +1,206 @@
+#!/bin/bash
+# script to run FoxTelem
+
+echo "Script to configure the PacSat Ground Station for FIAB v4"
+
+echo
+
+#source /home/pi/venv/bin/activate
+
+sudo killall -9 java &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+sudo killall -9 direwolf &>/dev/null
+
+#FILE=/home/pi/.pacsatprofile
+#if [ ! -f "$FILE" ]; then
+
+# profile=$(zenity --text="Choice:" --list 2>/dev/null --width=410 --height=120 --title="PacSat Ground Station Choice" --column="Choice" --column="Result" "PacSat" "Receive from CubeSatSim PacSatSim" "Configure" "Configure PacSat Ground Station" "Loopback" "Run a Locally Simulated PacSat")
+# echo $profile
+
+ echo "Here are the PacSat configuration choices:"
+ echo
+ echo " 1. PacSat Ground Station Configuration"
+ echo
+ echo " 2. PacSat Ground Station Simulation Configuration"
+ echo
+ echo " 3. Set Frequencies"
+ echo
+ echo " 4. Reset PacSat Satellite"
+ echo
+ echo "Which do you choose? Enter 1 - 4"
+ echo
+
+ read -r ANS
+
+ if [ -z "$ANS" ]; then
+
+ echo "No choice made. Exiting."
+
+ sleep 3
+
+ exit
+
+ fi
+
+ if [ "$ANS" = "1" ] || [ "$ANS" = "2" ] ; then
+
+ if [ "$ANS" = "1" ] ; then
+ echo "Here are your PacSat Ground Station Configuration choices:"
+ else
+ echo "Here are your PacSat Ground Station Simulation Configuration choices:"
+ fi
+ echo
+ echo " 1. PacSat Ground Station Callsign"
+ echo
+ echo " 2. Set Remote PacSat Satellite Callsign in Ground Station configuration"
+ echo
+ echo " 3. Reset PacSat Ground Station Configuration"
+ echo
+
+ read -r CH
+
+
+ if [ -z "$CH" ]; then
+
+ echo "No choice made. Exiting."
+
+ sleep 3
+
+ exit
+
+ fi
+
+ if [ "$CH" = "1" ] ; then
+
+ echo
+ if [ "$ANS" = "1" ] ; then
+ oldcallsign=$(grep -oP '(?<=callsign=).*$' /home/pi/PacSatGround/PacSatGround.properties)
+ else
+ oldcallsign=$(grep -oP '(?<=callsign=).*$' /home/pi/PacSatGroundLoop/PacSatGround.properties)
+ fi
+ echo "Callsign in PacSatGround.properties is "
+ echo $oldcallsign
+
+ echo "Enter new callsign in all capitals: "
+ echo
+ read callsign
+
+ if [ -z $callsign ] ; then
+
+ callsign="$1"
+ echo "Keeping value of" $oldcallsign
+
+ else
+
+ echo "Configured callsign is "
+ echo $callsign
+
+ if [ ! "$callsign" = "$oldcallsign" ] ; then
+
+ if [ "$ANS" = "1" ] ; then
+ sudo sed -i "s/callsign=$oldcallsign/callsign=$callsign/g" /home/pi/PacSatGround/PacSatGround.properties
+ cat /home/pi/PacSatGround/PacSatGround.properties
+ else
+ sudo sed -i "s/callsign=$oldcallsign/callsign=$callsign/g" /home/pi/PacSatGroundLoop/PacSatGround.properties
+ cat /home/pi/PacSatGroundLoop/PacSatGround.properties
+ fi
+
+ fi
+ fi
+
+ elif [ "$CH" = "2" ] ; then
+
+ echo "You have chosen to set the remote CubeSatSim PacSat Satellite callsign in ground station configuration"
+ echo
+
+ PROPERTIES=/home/pi/PacSatGround/spacecraft/PacSatSim.properties
+ PROPERTIES_L=/home/pi/PacSatGroundLoop/spacecraft/PacSatSim.properties
+
+ if [ "$ANS" = "1" ] ; then
+ oldcallsign=$(grep -oP '(?<=bbsCallsign=).*(?=-)' $PROPERTIES )
+ else
+ oldcallsign=$(grep -oP '(?<=bbsCallsign=).*(?=-)' $PROPERTIES_L )
+ fi
+ echo "Current value of remote PacSat callsign is"
+ echo $oldcallsign
+ echo
+
+ echo "Enter new callsign in all capitals: "
+ echo
+ read callsign
+
+ if [ -z $callsign ] ; then
+
+ callsign="$1"
+ echo "Keeping value of" $oldcallsign
+
+ else
+ if [ "$ANS" = "1" ] ; then
+ sudo sed -i "s/$oldcallsign/$callsign/g" $PROPERTIES
+ else
+ sudo sed -i "s/$oldcallsign/$callsign/g" $PROPERTIES_L
+ fi
+ echo
+ echo "Changing callsign to "
+ echo $callsign
+ echo
+ echo "You will see the change next time you run the PacSat Ground Station"
+ echo "You can close this window"
+ fi
+
+ elif [ "$CH" = "3" ] ; then
+
+ echo "You have chosen to reset the PacSat Ground Station Configuration"
+ echo
+# echo "Next time you run the Ground Station you will need to Add the PacSatSim spacecraft"
+# echo
+
+ if [ "$ANS" = "1" ] ; then
+ sudo rm -r /home/pi/PacSatGround
+ # cd
+ # sudo rm PacSatGround.zip
+ # wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b-p-s/spacecraft/PacSatGround_0.46o/PacSatGround.zip
+ # unzip PacSatGround.zip -d PacSatGround
+ # sudo rm PacSatGround.zip
+ else
+ sudo rm -r /home/pi/PacSatGroundLoop
+ # cd
+ # sudo rm PacSatGround.zip
+ # wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b-p-s/spacecraft/PacSatGround_0.46o/PacSatGround.zip
+ # unzip PacSatGround.zip -d PacSatGroundLoop
+ # sudo rm PacSatGround.zip
+ fi
+ echo "You can close this window now"
+ else
+
+ echo "Please choose an option 1-3"
+ echo
+
+ fi
+
+ elif [ "$ANS" = "3" ] ; then
+
+ echo "You have chosen to set the Frequency of the PacSat Ground Station"
+ echo
+
+ /home/pi/CubeSatSim/config -F n
+
+ elif [ "$ANS" = "4" ] ; then
+
+ echo "You have chosen to reset the PacSat Satellite"
+ echo
+
+ /home/pi/CubeSatSim/config -k n
+
+ else
+
+ echo "Please enter only 1 to 4"
+
+ fi
+
+
+# sleep 10
+
+#$SHELL
diff --git a/groundstation/pacsat-run.sh b/groundstation/pacsat-run.sh
new file mode 100755
index 00000000..d19b9dba
--- /dev/null
+++ b/groundstation/pacsat-run.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+# script to run FoxTelem
+
+echo "Startup script to run the PacSat Ground Station for FIAB v4"
+
+echo
+
+# source /home/pi/venv/bin/activate
+
+sudo killall -9 java &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+sudo killall -9 direwolf &>/dev/null
+
+#FILE=/home/pi/.pacsatprofile
+#if [ ! -f "$FILE" ]; then
+
+ profile=$(zenity --text="Choose what you want to do:" --list 2>/dev/null --width=410 --height=220 --title="PacSat Ground Station" --column="Choice" --column="Result" "PacSat" "Run PacSat Ground Station" "Configure" "Configure the Pacsat Ground Station" "Simulate" "Run a Locally Simulated PacSat")
+
+ echo $profile
+
+ if [ -z "$profile" ]; then
+
+ echo "No choice made. Exiting."
+
+ sleep 3
+
+ exit
+
+ #echo "You need to choose your default FoxTelem profile."
+ #echo
+ #echo "The choices are:"
+ #echo
+ #echo "1. Fox-in-a-Box. Use this profile if you want to receive and decode telemetry from the AMSAT Fox satellites. If you enter a callsign and a grid square, you can upload to the AMSAT telemetry server."
+ #echo
+ #echo "2. CubeSatSim Ground Station. Use this profile if you want to receive and decode telemetry from an AMSAT CubeSatSim or CubeSatSim Lite."
+ #echo
+ #echo "Which profile do you choose? Enter 1 or 2"
+
+ #read -r ANS
+
+ fi
+
+ if [ "$ANS" = "1" ] || [ "$profile" = "PacSat" ] ; then
+
+ echo "You have chosen to run the PacSat Ground Station"
+ # echo "p" > /home/pi/.pacsatprofile
+ echo
+
+ /home/pi/CubeSatSim/groundstation/pacsat.sh
+
+
+ elif [ "$ANS" = "2" ] || [ "$profile" = "Configure" ] ; then
+
+ echo "You have chosen to configure the PacSat Ground Station"
+ echo
+
+ /home/pi/CubeSatSim/groundstation/pacsat-config.sh
+
+ elif [ "$ANS" = "3" ] || [ "$profile" = "Simulate" ] ; then
+
+ sudo systemctl stop transmit
+
+ echo "You have chosen the PacSat Ground Station with Local Simulated Satellite"
+
+ sleep 1
+
+ /usr/bin/x-terminal-emulator --geometry=120x40 -e "bash /home/pi/CubeSatSim/pacsatsim.sh l"
+
+ sleep 1
+
+ /home/pi/CubeSatSim/groundstation/pacsat.sh l
+
+ else
+
+ echo "Please enter only 1 or 2 or 3"
+
+ fi
+
+sudo killall -9 direwolf &>/dev/null
+
+sleep 10
+
+#$SHELL
diff --git a/groundstation/pacsat.desktop b/groundstation/pacsat.desktop
new file mode 100644
index 00000000..7097509e
--- /dev/null
+++ b/groundstation/pacsat.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Pacsat
+GenericName=Pacsat Loopback
+Comment=Pacsat
+Exec=/usr/bin/x-terminal-emulator --geometry=120x40 -e "/home/pi/CubeSatSim/groundstation/pacsat-run.sh"
+Icon=/home/pi/Icons/pacsat.png
+Terminal=true
+Type=Application
+Categories=HamRadio;
+Keywords=APRS;
diff --git a/groundstation/pacsat.sh b/groundstation/pacsat.sh
new file mode 100755
index 00000000..23f115e1
--- /dev/null
+++ b/groundstation/pacsat.sh
@@ -0,0 +1,302 @@
+#!/bin/bash
+
+# script to auto decode packets using Direwolf and FM TXC and run Pacsat Ground Station
+
+sudo pkill -f "/home/pi/CubeSatSim/groundstation/direwolf-pacsat-tmp.conf"
+
+loopback=0
+vox=0
+safe=0
+card=0
+pwm=0
+
+if [ "$1" = "l" ] ; then
+
+ loopback=1
+
+elif [ "$1" = "v" ] ; then
+
+ vox=1
+
+elif [ "$1" = "c" ] ; then
+
+ card=1
+
+else
+
+ pwm=1
+
+fi
+
+if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
+ echo "USB Sound Card detected"
+ soundcard=1
+else
+ echo "No USB Sound Card detected"
+ soundcard=0
+fi
+
+gpio -g mode 7 up
+if [[ $(gpio -g read 7 | grep 0) ]] ; then
+ echo "TXC is present"
+ txc=1
+else
+ echo "TXC not present"
+ txc=0
+fi
+
+timeout 1 rtl_test &> out.txt
+if [[ $(grep "No supported" out.txt) ]] ; then
+ echo "No RTL-SDR detected"
+ rtl=0
+else
+ echo "RTL-SDR detected."
+ rtl=1
+fi
+
+FILE=/home/pi/CubeSatSim/battery_saver
+if [ -f "$FILE" ]; then
+
+ safe=1
+
+fi
+
+value=`cat /home/pi/CubeSatSim/.mode`
+echo "$value" > /dev/null
+set -- $value
+
+MODE=$1
+
+if [ ! "$MODE" = "P" ] && [ ! "$loopback" = "1" ] ; then
+
+ echo
+ echo "Mode is not PacSat Ground Station"
+ echo
+ echo "Would you like to change to PacSat Ground Station mode and reboot? (y/n)?"
+
+ read -r ANS
+
+ if [ "$ANS" = "y" ]; then
+
+ /home/pi/CubeSatSim/config -I
+ exit
+
+ else
+
+ echo
+ echo "You can run the PacSat Ground Station after you change mode and reboot."
+ sleep 10
+ exit
+
+ fi
+
+elif [ "$loopback" = "1" ] ; then
+
+# if [ ! "$MODE" = "p" ] ; then
+ echo
+ echo "Switching to PacSat mode for the Simulated PacSat Satellite"
+ echo
+ /home/pi/CubeSatSim/config -G n
+# fi
+
+ if [ ! -d "/home/pi/PacSatGroundLoop" ] ; then
+# if [ ! "$loopback" = "1" ] ; then # don't do this for now.
+
+ cd
+ sudo rm PacSatGroundLoop.zip &>/dev/null
+ wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b-p/spacecraft/PacSatGround_0.46o/PacSatGroundLoop.zip
+ unzip PacSatGroundLoop.zip -d PacSatGroundLoop
+ sudo rm PacSatGroundLoop.zip
+
+ echo
+ echo "The first time you run the Ground Station, you will need to select Yes to override files, then put in your callsign"
+ sleep 10
+
+ fi
+
+else
+
+ echo
+ echo "Mode is PacSat Ground Station"
+ echo
+
+ if [ ! -d "/home/pi/PacSatGround" ] ; then
+
+ cd
+ sudo rm PacSatGround.zip &>/dev/null
+ wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b-p/spacecraft/PacSatGround_0.46o/PacSatGround.zip
+ unzip PacSatGround.zip -d PacSatGround
+ sudo rm PacSatGround.zip
+
+ echo
+ echo "The first time you run the Ground Station, you will need to select Yes to override files, then put in your callsign"
+ sleep 10
+
+ fi
+
+fi
+
+value=`cat /home/pi/CubeSatSim/sim.cfg`
+echo "$value" > /dev/null
+set -- $value
+
+callsign="$1"
+txfrequency="$7e3"
+rxfrequency="$8e3"
+
+echo -n "Callsign is "
+echo $callsign
+echo -n "Transmit Frequency is "
+echo $txfrequency
+echo -n "Receive Frequency is "
+echo $rxfrequency
+echo
+sleep 2
+
+sudo sed -i "s/TNC_TX_DELAY=.*$/TNC_TX_DELAY=750/g" /home/pi/PacSatGround/PacSatGround.properties
+sudo sed -i "s/TNC_TX_DELAY=.*$/TNC_TX_DELAY=750/g" /home/pi/PacSatGroundLoop/PacSatGround.properties
+
+sudo modprobe snd-aloop
+
+#sudo systemctl stop cubesatsim >/dev/null 2>&1
+
+#sudo systemctl stop transmit >/dev/null 2>&1
+
+sudo systemctl stop command >/dev/null 2>&1
+
+#/home/pi/CubeSatSim/config -I
+
+sudo systemctl stop command >/dev/null 2>&1
+
+sudo systemctl stop openwebrx >/dev/null 2>&1
+
+sudo systemctl stop rtl_tcp >/dev/null 2>&1
+
+pkill -o chromium &>/dev/null
+
+sudo killall -9 rtl_fm &>/dev/null
+
+#sudo killall -9 direwolf &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
+
+#sudo killall -9 aplay &>/dev/null
+
+sudo killall -9 qsstv &>/dev/null
+
+sudo killall -9 rtl_tcp &>/dev/null
+
+sudo killall -9 java &>/dev/null
+
+sudo killall -9 CubicSDR &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+#sudo systemctl restart pacsatsim
+
+#sudo /etc/init.d/alsa-utils stop
+#sudo /etc/init.d/alsa-utils start
+
+sudo usermod -a -G gpio pi
+
+if [ "$loopback" = "1" ] ; then
+
+ echo "Using Audio Loopback"
+ ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1"
+ PTT="PTT GPIOD gpiochip0 17"
+
+elif [ "$safe" = "1" ] ; then
+
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+ if [ ! "$txc" = "1" ] ; then
+ echo "Safe mode - battery saver won't work since no TXC present"
+ sleep 5
+ elif [ ! "$soundcard" = "1" ] ; then
+ echo "Safe mode - battery saver won't work since no sound card present"
+ sleep 5
+ else
+ echo "Safe mode - battery saver"
+ fi
+
+elif [ "$vox" = "1" ] ; then
+
+ ADEVICE="ADEVICE plughw:CARD=Device,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+ if [ "$soundcard" = "1" ] ; then
+ echo "Using Soundcard Audio TX and RX (VOX, no PTT)"
+ else
+ echo "Soundcard Audio TX and RX (VOX, no PTT) will not work since no sound card present"
+ sleep 5
+ fi
+
+elif [ "$pwm" = "1" ] ; then
+
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Headphones,DEV=0"
+ PTT="PTT GPIOD gpiochip0 -20"
+
+ if [ ! "$txc" = "1" ] ; then
+ echo "FM TXC using Soundcard input (JP13), PWM output won't work since no TXC present"
+ sleep 5
+ elif [ ! "$soundcard" = "1" ] ; then
+ echo "FM TXC using Soundcard input (JP13), PWM output won't work since no sound card present"
+ sleep 5
+ else
+ echo "FM TXC using Soundcard input (JP13), PWM output"
+ fi
+
+else
+
+ echo "FM TXC using Soundcard input (JP13) and output (JP14)"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Device,DEV=0"
+ PTT="PTT GPIOD gpiochip0 -20"
+
+ if [ ! "$txc" = "1" ] ; then
+ echo "FM TXC using Soundcard input (JP13) and output (JP14) won't work since no TXC present"
+ sleep 5
+ elif [ ! "$soundcard" = "1" ] ; then
+ echo "FM TXC using Soundcard input (JP13), output (JP14) won't work since no sound card present"
+ sleep 5
+ else
+ echo "FM TXC using Soundcard input (JP13), output JP14"
+ fi
+
+fi
+
+DIREWOLF_CONF="/home/pi/CubeSatSim/groundstation/direwolf-pacsat-tmp.conf"
+
+echo "$ADEVICE" > $DIREWOLF_CONF
+echo "MYCALL $callsign-1" >> $DIREWOLF_CONF
+echo "$PTT" >> $DIREWOLF_CONF
+cat /home/pi/CubeSatSim/groundstation/direwolf/direwolf-pacsat.conf >> $DIREWOLF_CONF
+
+echo
+echo "$DIREWOLF_CONF"
+echo
+cat $DIREWOLF_CONF
+echo
+
+direwolf -r 48000 -c $DIREWOLF_CONF -t 0 &
+
+cd /home/pi/Desktop/PacsatGround/
+
+if [ "$loopback" = "1" ] ; then
+
+ setsid java -Xmx512M -jar PacSatGround.jar "/home/pi/PacSatGroundLoop" # removed &
+
+else
+
+ setsid java -Xmx512M -jar PacSatGround.jar "/home/pi/PacSatGround" # removed &
+
+fi
+
+sleep 10
+
+#echo "Stopping Pacsatsim"
+
+#$SHELL
+
+
+
diff --git a/groundstation/rtl-tcp.desktop b/groundstation/rtl-tcp.desktop
index 117acb9c..7ae3c038 100644
--- a/groundstation/rtl-tcp.desktop
+++ b/groundstation/rtl-tcp.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/home/pi/CubeSatSim/groundstation/rtl-tcp.sh
Name=RTL-TCP
Comment=RTL-TCP for SDR#
-Icon=/home/pi/Downloads/SDRSharp.png
+Icon=/home/pi/Icons/SDRSharp.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/rtl-tcp.sh b/groundstation/rtl-tcp.sh
index dc10376c..3d49d11d 100755
--- a/groundstation/rtl-tcp.sh
+++ b/groundstation/rtl-tcp.sh
@@ -23,13 +23,15 @@ echo "Note: you need to be on the Wifi network: $ssid"
echo
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
sleep 2
pkill -o chromium &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
sudo killall -9 java &>/dev/null
@@ -45,10 +47,13 @@ sudo killall -9 qsstv &>/dev/null
sudo killall -9 direwolf &>/dev/null
-sudo killall -9 aplay &>/dev/null
+#sudo killall -9 aplay &>/dev/null
sudo killall -9 zenity &>/dev/null
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
sudo killall -9 rtl_fm &>/dev/null
sudo /bin/sh -c 'rtl_tcp -a $(hostname -I|cut -f1 -d " ")'
diff --git a/groundstation/rtl_tcp.service b/groundstation/rtl_tcp.service
index 403425a3..ff899e9b 100644
--- a/groundstation/rtl_tcp.service
+++ b/groundstation/rtl_tcp.service
@@ -3,7 +3,7 @@ Description=RTL-TCP
[Service]
TimeoutStopSec = 5
-ExecStart=/bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I)'
+ExecStart=/bin/sh -c 'rtl_tcp -a $(hostname -I|cut -f1 -d " ")'
WorkingDirectory=/home/pi
StandardOutput=inherit
StandardError=inherit
diff --git a/groundstation/rtltcp.socket b/groundstation/rtltcp.socket
new file mode 100644
index 00000000..d8a67a14
--- /dev/null
+++ b/groundstation/rtltcp.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=RTL TCP Socket
+PartOf=rtltcp.service
+
+[Socket]
+ListenStream=[::]:1234
+
+[Install]
+WantedBy=sockets.target
diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh
index 4603b153..54ddb7a3 100755
--- a/groundstation/sdr.sh
+++ b/groundstation/sdr.sh
@@ -24,6 +24,8 @@ echo "Note: you need to be on the Wifi network: $ssid"
echo
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 java &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
@@ -38,13 +40,18 @@ sudo killall -9 sdrpp &>/dev/null
sudo killall -9 qsstv &>/dev/null
-sudo killall -9 aplay &>/dev/null
+#sudo killall -9 aplay &>/dev/null
sudo killall -9 direwolf &>/dev/null
sudo killall -9 zenity &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
+
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
+sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
@@ -52,7 +59,7 @@ sudo systemctl restart openwebrx
sleep 10
-setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8073 &>/dev/null &
+setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars --app=http://localhost:8073 &>/dev/null &
sleep 10
diff --git a/groundstation/sdrpp.sh b/groundstation/sdrpp.sh
new file mode 100755
index 00000000..2dd97fd1
--- /dev/null
+++ b/groundstation/sdrpp.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# script to run sdrpp
+
+echo "Script to run SDRpp for ARISS Radio Pi"
+
+echo
+
+sudo systemctl stop openwebrx
+
+sudo killall -9 java &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
+
+sudo systemctl stop rtl_tcp
+
+pkill -o chromium &>/dev/null
+
+sudo killall -9 rtl_fm &>/dev/null
+
+sudo killall -9 direwolf &>/dev/null
+
+#sudo killall -9 aplay &>/dev/null
+
+sudo killall -9 qsstv &>/dev/null
+
+sudo killall -9 rtl_tcp &>/dev/null
+
+sudo killall -9 CubicSDR &>/dev/null
+
+#sudo kill `ps -aux | grep cubicsdr-packet | grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null
+
+#sudo kill `ps -aux | grep packet | grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null
+
+#sudo kill `ps -aux | grep sstv_decode_prompt| grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
+sleep 5
+
+setsid sdrpp &
+
+sleep 10
+
+#$SHELL
diff --git a/groundstation/set location.desktop b/groundstation/set location.desktop
index e2b80016..9adc6f66 100644
--- a/groundstation/set location.desktop
+++ b/groundstation/set location.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/home/pi/CubeSatSim/groundstation/loc.sh
Name=Set My Location
Comment=Set Location for Gpredict
-Icon=/home/pi/Downloads/gpredict.png
+Icon=/home/pi/Icons/gpredict.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/settings.json b/groundstation/settings.json
new file mode 100644
index 00000000..69033009
--- /dev/null
+++ b/groundstation/settings.json
@@ -0,0 +1,808 @@
+{
+ "version": 8,
+ "sdrs": {
+ "rtlsdr": {
+ "name": "RTL-SDR",
+ "type": "rtl_sdr",
+ "profiles": {
+ "70cm": {
+ "name": "70cm Ham Band 435 MHz (CubeSatSim)",
+ "center_freq": 435000000,
+ "rf_gain": 10.0,
+ "samp_rate": 2400000,
+ "start_freq": 434900000,
+ "start_mod": "nfm",
+ "tuning_step": 1000,
+ "direct_sampling": 0
+ },
+ "2m": {
+ "name": "WX Band 161 MHz",
+ "center_freq": 162400000,
+ "rf_gain": 29,
+ "samp_rate": 2048000,
+ "start_freq": 157000000,
+ "start_mod": "nfm"
+ },
+ "e59a4765-4139-4ab8-89c5-d8ac3343ba70": {
+ "name": "2m Ham Band 146 MHz (ISS)",
+ "center_freq": 145000000,
+ "samp_rate": 2400000,
+ "start_freq": 145000000,
+ "start_mod": "nfm",
+ "rf_gain": 42.0,
+ "direct_sampling": 0
+ },
+ "faf80b0b-1a96-4a9b-96fa-ce40b109c7e0": {
+ "name": "70cm Ham Band 438 MHz (ISS)",
+ "rf_gain": 29.0,
+ "center_freq": 438000000,
+ "samp_rate": 2400000,
+ "start_freq": 437800000,
+ "start_mod": "nfm"
+ },
+ "a4fd4a5d-d2d0-4949-87e2-bda83cd83a37": {
+ "name": "FM Band 95 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 95000000,
+ "samp_rate": 2400000,
+ "start_freq": 94000000,
+ "start_mod": "wfm"
+ },
+ "ce2bca29-78cb-45d8-ab46-8dea3135981c": {
+ "name": "10m Ham Band 28 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 28000000,
+ "samp_rate": 2400000,
+ "start_freq": 28000000,
+ "start_mod": "usb",
+ "direct_sampling": 0
+ },
+ "d6cdbf2d-74e4-4cac-aaa8-e793103a8e89": {
+ "name": "6m Ham Band 51 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 51000000,
+ "samp_rate": 2400000,
+ "start_freq": 51000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "e2aba387-1d3b-4ca8-b280-e119282b8812": {
+ "name": "90 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 90000000,
+ "samp_rate": 2400000,
+ "start_freq": 90000000,
+ "start_mod": "wfm"
+ },
+ "f700b99d-3c51-4524-b151-a0809b868ecc": {
+ "name": "92 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 92000000,
+ "samp_rate": 2400000,
+ "start_freq": 92000000,
+ "start_mod": "wfm"
+ },
+ "dc6af94f-d607-4fee-a522-7f375f66a62c": {
+ "name": "94 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 94000000,
+ "samp_rate": 2400000,
+ "start_freq": 94000000,
+ "start_mod": "wfm"
+ },
+ "6887e85a-a4dc-4245-810f-99801fc5e824": {
+ "name": "96 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 96000000,
+ "samp_rate": 2400000,
+ "start_freq": 96000000,
+ "start_mod": "wfm"
+ },
+ "a2182ed6-70a8-4377-b233-ac6f8ccc91d7": {
+ "name": "98 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 96000000,
+ "samp_rate": 2400000,
+ "start_freq": 96000000,
+ "start_mod": "wfm"
+ },
+ "57e38353-fb86-4935-899b-e365228b8ae5": {
+ "name": "100 MHz FM Band",
+ "center_freq": 100000000,
+ "samp_rate": 2400000,
+ "start_freq": 100000000,
+ "start_mod": "wfm"
+ },
+ "5e9ec6dd-905d-4781-bd13-9cb702f58e84": {
+ "name": "102 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 102000000,
+ "samp_rate": 2400000,
+ "start_freq": 102000000,
+ "start_mod": "wfm"
+ },
+ "ef2c703c-2e22-4e87-82b5-581420d704bd": {
+ "name": "104 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 104000000,
+ "samp_rate": 2400000,
+ "start_freq": 104000000,
+ "start_mod": "wfm"
+ },
+ "34cc3ddf-8018-4288-acb9-29e6940bc37e": {
+ "name": "106 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 106000000,
+ "samp_rate": 2400000,
+ "start_freq": 106000000,
+ "start_mod": "wfm"
+ },
+ "b4693683-ccf5-474d-a2d9-9a47b0a18ee2": {
+ "name": "108 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 108000000,
+ "samp_rate": 2400000,
+ "start_freq": 108000000,
+ "start_mod": "wfm"
+ },
+ "34224d77-7b61-467c-b78f-18c7f3af1a0c": {
+ "name": "110 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 110000000,
+ "samp_rate": 2400000,
+ "start_freq": 110000000,
+ "start_mod": "wfm"
+ },
+ "8dd82d97-73db-4fa7-ac41-263c3026ea1d": {
+ "name": "112 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 112000000,
+ "samp_rate": 2400000,
+ "start_freq": 112000000,
+ "start_mod": "nfm"
+ },
+ "79304b30-f10d-469e-9617-50a19bfdb435": {
+ "name": "114 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 114000000,
+ "samp_rate": 2400000,
+ "start_freq": 114000000,
+ "start_mod": "nfm"
+ },
+ "c00bf096-27b8-4262-832c-df1a308d7eb9": {
+ "name": "116 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 116000000,
+ "samp_rate": 2400000,
+ "start_freq": 116000000,
+ "start_mod": "nfm"
+ },
+ "669d25a6-6c15-4131-a330-3c33dd2147f0": {
+ "name": "118 Mhz Air Band",
+ "rf_gain": 29.0,
+ "center_freq": 118000000,
+ "samp_rate": 2400000,
+ "start_freq": 118000000,
+ "start_mod": "am"
+ },
+ "948248fa-43d9-4e7d-bf86-afaadd391779": {
+ "name": "120 MHz Air Band",
+ "rf_gain": 29.0,
+ "center_freq": 120000000,
+ "samp_rate": 2400000,
+ "start_freq": 120000000,
+ "start_mod": "am"
+ },
+ "b634273b-8fc8-4e87-b5c4-e6226d4be0ac": {
+ "name": "122 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 122000000,
+ "samp_rate": 2400000,
+ "start_freq": 121000000,
+ "start_mod": "nfm"
+ },
+ "c55289a2-8286-4a3d-a505-37ba2867571a": {
+ "name": "124 Mhz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 124000000,
+ "samp_rate": 2400000,
+ "start_freq": 124000000,
+ "start_mod": "am"
+ },
+ "4fe488b7-f369-43ba-bb49-91e1a185be7a": {
+ "name": "126 MHz Air Band",
+ "rf_gain": 29.0,
+ "center_freq": 126000000,
+ "samp_rate": 2400000,
+ "start_freq": 126000000,
+ "start_mod": "am"
+ },
+ "e79639a2-1384-4e92-8e46-f6e5670ec9fd": {
+ "name": "128 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 128000000,
+ "samp_rate": 2400000,
+ "start_freq": 128000000,
+ "start_mod": "am"
+ },
+ "319f3fb2-b98a-4620-85a7-a99d5a722bd5": {
+ "name": "130 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 130000000,
+ "samp_rate": 2400000,
+ "start_freq": 130000000,
+ "start_mod": "am"
+ },
+ "63c5c2ce-07de-496c-81f6-b188a7adbf39": {
+ "name": "132 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 132000000,
+ "samp_rate": 2400000,
+ "start_freq": 132000000,
+ "start_mod": "am"
+ },
+ "386bdc7b-eb10-4e05-972a-69d730a23cd8": {
+ "name": "134 MHz Air Band",
+ "rf_gain": 29.0,
+ "center_freq": 134000000,
+ "samp_rate": 2400000,
+ "start_freq": 134000000,
+ "start_mod": "am"
+ },
+ "ae8ea8b1-23de-45ef-b8c4-3b83a188e65d": {
+ "name": "136 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 136000000,
+ "samp_rate": 2400000,
+ "start_freq": 136000000,
+ "start_mod": "am"
+ },
+ "c0b1a28c-5e07-400a-a5f3-07c62db27587": {
+ "name": "138 MHz NOAA Weather Satellite Band",
+ "rf_gain": 42.0,
+ "center_freq": 138000000,
+ "samp_rate": 2400000,
+ "start_freq": 138000000,
+ "start_mod": "nfm"
+ },
+ "20f7ce56-fd85-4b3e-8fac-94cbe9ba0e1d": {
+ "name": "140 MHz ",
+ "rf_gain": 42.0,
+ "center_freq": 140000000,
+ "samp_rate": 2400000,
+ "start_freq": 140000000,
+ "start_mod": "nfm"
+ },
+ "882079f8-5697-428a-ae9d-bcc091269c7f": {
+ "name": "142 MHz ",
+ "rf_gain": 42.0,
+ "center_freq": 142000000,
+ "samp_rate": 2400000,
+ "start_freq": 142000000,
+ "start_mod": "nfm"
+ },
+ "da1b3f12-2eba-40e9-8c62-33493adf74b3": {
+ "name": "144 MHz 2m Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 144000000,
+ "samp_rate": 2400000,
+ "start_freq": 144000000,
+ "start_mod": "nfm"
+ },
+ "8d9cf1e1-44c5-41c4-bcea-7b1c69446e62": {
+ "name": "146 MHz 2m Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 146000000,
+ "samp_rate": 2400000,
+ "start_freq": 146000000,
+ "start_mod": "nfm"
+ },
+ "eec8aa0d-3485-43d2-baa4-82f7d9e14df6": {
+ "name": "148 MHz 2m Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 148000000,
+ "samp_rate": 2400000,
+ "start_freq": 148000000,
+ "start_mod": "nfm"
+ },
+ "bf66a908-1988-4aec-b998-06e2bc7d0a84": {
+ "name": "150 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 150000000,
+ "samp_rate": 2400000,
+ "start_freq": 150000000,
+ "start_mod": "nfm"
+ },
+ "0389f270-b919-4aae-a313-f73697059f70": {
+ "name": "152 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 152000000,
+ "samp_rate": 2400000,
+ "start_freq": 152000000,
+ "start_mod": "nfm"
+ },
+ "6ef9d955-76aa-46c0-8463-2c23def5e37b": {
+ "name": "154 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 154000000,
+ "samp_rate": 2400000,
+ "start_freq": 154000000,
+ "start_mod": "nfm"
+ },
+ "5d0a64c7-3bce-408e-94d9-c8315bef7540": {
+ "name": "156 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 156000000,
+ "samp_rate": 2400000,
+ "start_freq": 156000000,
+ "start_mod": "nfm"
+ },
+ "5b869cae-ffa7-4554-96af-7acd497bbaf3": {
+ "name": "158 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 158000000,
+ "samp_rate": 2400000,
+ "start_freq": 158000000,
+ "start_mod": "nfm"
+ },
+ "0de7c5d4-14fc-4655-9a81-2bcebb2f4147": {
+ "name": "160 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 160000000,
+ "samp_rate": 2400000,
+ "start_freq": 160000000,
+ "start_mod": "nfm"
+ },
+ "8ca54821-8b80-4938-a35c-9fe25e2320d1": {
+ "name": "162 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 162000000,
+ "samp_rate": 2400000,
+ "start_freq": 162000000,
+ "start_mod": "nfm"
+ },
+ "f74d262d-9e98-4030-86b2-45676121ff1e": {
+ "name": "164 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 164000000,
+ "samp_rate": 2400000,
+ "start_freq": 164000000,
+ "start_mod": "nfm"
+ },
+ "bfc9c686-6c06-4de2-b1d5-c8f012131042": {
+ "name": "168 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 168000000,
+ "samp_rate": 2400000,
+ "start_freq": 167000000,
+ "start_mod": "nfm"
+ },
+ "5468e597-d529-42fe-9fcf-0ff4fa9e2d06": {
+ "name": "170 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 170000000,
+ "samp_rate": 2400000,
+ "start_freq": 170000000,
+ "start_mod": "nfm"
+ },
+ "e124cc6e-7177-4d5f-ae5b-2ec6a6fa2956": {
+ "name": "172 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 172000000,
+ "samp_rate": 2400000,
+ "start_freq": 172000000,
+ "start_mod": "nfm"
+ },
+ "1ce0f3ed-4763-4f00-916a-4f72d29ba410": {
+ "name": "174 MHz ",
+ "rf_gain": 42.0,
+ "center_freq": 174000000,
+ "samp_rate": 2400000,
+ "start_freq": 174000000,
+ "start_mod": "nfm"
+ },
+ "639b1496-a2b9-4a42-ad28-3cda89fbe2fb": {
+ "name": "420 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 420000000,
+ "samp_rate": 2400000,
+ "start_freq": 420000000,
+ "start_mod": "nfm"
+ },
+ "bbc9b57e-ea86-43ef-be65-cb2337615ae5": {
+ "name": "422 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 422000000,
+ "samp_rate": 2400000,
+ "start_freq": 422000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "3aed286d-7d13-4338-8621-d1c0dfdf3ac6": {
+ "name": "424 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 424000000,
+ "samp_rate": 2400000,
+ "start_freq": 424000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "9ae664b4-48f3-410a-8995-edc60127d746": {
+ "name": "426 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 426000000,
+ "samp_rate": 2400000,
+ "start_freq": 426000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "24d2467b-6740-42b5-8d3f-8f389fc0860b": {
+ "name": "428 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 428000000,
+ "samp_rate": 2400000,
+ "start_freq": 428000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "debbc3ab-081d-41e7-80fe-7d564838154e": {
+ "name": "430 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 430000000,
+ "samp_rate": 2400000,
+ "start_freq": 430000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "649233e0-fc85-415d-b88e-94750f49ca4b": {
+ "name": "432 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 432000000,
+ "samp_rate": 2400000,
+ "start_freq": 432000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "bed3b482-fd3b-45ee-b924-200aa4223ace": {
+ "name": "434 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 434000000,
+ "samp_rate": 2400000,
+ "start_freq": 434000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "58dfac9e-6030-4bb3-ba28-465285baa25e": {
+ "name": "436 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 436000000,
+ "samp_rate": 2400000,
+ "start_freq": 436000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "4c293b84-cd43-495f-95a5-1fcabfe4e4c7": {
+ "name": "438 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 438000000,
+ "samp_rate": 2400000,
+ "start_freq": 438000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "0e763161-a0e8-411a-abe6-c1af13045f27": {
+ "name": "440 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 440000000,
+ "samp_rate": 2400000,
+ "start_freq": 440000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "6dda77d3-e859-41b7-9b0b-22c2dee47472": {
+ "name": "442 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 442000000,
+ "samp_rate": 2400000,
+ "start_freq": 442000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "285813ef-aa6d-433f-a316-074f47e02073": {
+ "name": "444 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 444000000,
+ "samp_rate": 2400000,
+ "start_freq": 444000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "e0842b63-6857-4554-874b-fad99e4db03a": {
+ "name": "446 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 446000000,
+ "samp_rate": 2400000,
+ "start_freq": 446000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "c7b21c80-cfef-42e8-a6fe-c5eea4556c7e": {
+ "name": "448 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 448000000,
+ "samp_rate": 2400000,
+ "start_freq": 448000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "d98b4d4a-8247-4a99-9fc7-89780e5e1fef": {
+ "name": "450 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 450000000,
+ "samp_rate": 2400000,
+ "start_freq": 450000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "a09a546f-c56f-41b5-ae34-c5511afbcef5": {
+ "name": "460 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 460000000,
+ "samp_rate": 2400000,
+ "start_freq": 460000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "232b2ae6-88dd-4e58-b489-37f310e5e204": {
+ "name": "462 MHz FRS/GMRS",
+ "rf_gain": 42.0,
+ "center_freq": 462000000,
+ "samp_rate": 2400000,
+ "start_freq": 462000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "41db9b38-87d7-40a0-9f90-1f0c77c054d9": {
+ "name": "464 MHz FRS/GMRS",
+ "rf_gain": 42.0,
+ "center_freq": 464000000,
+ "samp_rate": 2400000,
+ "start_freq": 464000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "e9bb7781-eb9b-4314-b399-2d96c52716f0": {
+ "name": "466 MHz FRS/GMRS",
+ "rf_gain": 42.0,
+ "center_freq": 466000000,
+ "samp_rate": 2400000,
+ "start_freq": 466000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "5d9e07e8-eb42-4832-82c9-016f05d89027": {
+ "name": "468 MHz FRS/GMRS",
+ "rf_gain": 42.0,
+ "center_freq": 468000000,
+ "samp_rate": 2400000,
+ "start_freq": 468000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "20m": {
+ "name": "20m",
+ "center_freq": 14150000,
+ "samp_rate": 384000,
+ "start_freq": 14070000,
+ "start_mod": "usb",
+ "tuning_step": "500",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "30m": {
+ "name": "30m",
+ "center_freq": 10125000,
+ "samp_rate": 192000,
+ "start_freq": 10142000,
+ "start_mod": "usb",
+ "tuning_step": "500",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "40m": {
+ "name": "40m",
+ "center_freq": 7100000,
+ "samp_rate": 256000,
+ "start_freq": 7070000,
+ "start_mod": "lsb",
+ "tuning_step": "500",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "80m": {
+ "name": "80m",
+ "center_freq": 3650000,
+ "samp_rate": 384000,
+ "start_freq": 3570000,
+ "start_mod": "lsb",
+ "tuning_step": "500",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "49m": {
+ "name": "49m Broadcast",
+ "center_freq": 6050000,
+ "samp_rate": 384000,
+ "start_freq": 6070000,
+ "start_mod": "am",
+ "tuning_step": "1000",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "c1982ce1-7504-455e-908c-dc097fa031a8": {
+ "name": "1090 MHz ADS-B Band",
+ "rf_gain": 42.0,
+ "center_freq": 1090000000,
+ "samp_rate": 2400000,
+ "start_freq": 1090000000,
+ "start_mod": "adsb",
+ "tuning_step": 1,
+ "direct_sampling": 0
+ },
+ "cb7f2f8e-e317-4a5e-9504-826dd3781791": {
+ "name": "978 MHz ADS-B Band",
+ "rf_gain": 42.0,
+ "center_freq": 978000000,
+ "samp_rate": 2400000,
+ "start_freq": 978000000,
+ "start_mod": "adsb",
+ "tuning_step": 1
+ }
+ }
+ },
+ "airspy": {
+ "name": "Airspy HF+",
+ "type": "airspyhf",
+ "rf_gain": "auto",
+ "profiles": {
+ "20m": {
+ "name": "20m",
+ "center_freq": 14150000,
+ "samp_rate": 384000,
+ "start_freq": 14070000,
+ "start_mod": "usb",
+ "tuning_step": "500"
+ },
+ "30m": {
+ "name": "30m",
+ "center_freq": 10125000,
+ "samp_rate": 192000,
+ "start_freq": 10142000,
+ "start_mod": "usb",
+ "tuning_step": "500"
+ },
+ "40m": {
+ "name": "40m",
+ "center_freq": 7100000,
+ "samp_rate": 256000,
+ "start_freq": 7070000,
+ "start_mod": "lsb",
+ "tuning_step": "500"
+ },
+ "80m": {
+ "name": "80m",
+ "center_freq": 3650000,
+ "samp_rate": 384000,
+ "start_freq": 3570000,
+ "start_mod": "lsb",
+ "tuning_step": "500"
+ },
+ "49m": {
+ "name": "49m Broadcast",
+ "center_freq": 6050000,
+ "samp_rate": 384000,
+ "start_freq": 6070000,
+ "start_mod": "am",
+ "tuning_step": "1000"
+ }
+ }
+ },
+ "sdrplay": {
+ "name": "SDRPlay device",
+ "type": "sdrplay",
+ "antenna": "Antenna A",
+ "rf_gain": "auto",
+ "profiles": {
+ "20m": {
+ "name": "20m",
+ "center_freq": 14150000,
+ "samp_rate": 500000,
+ "start_freq": 14070000,
+ "start_mod": "usb",
+ "tuning_step": "500"
+ },
+ "30m": {
+ "name": "30m",
+ "center_freq": 10125000,
+ "samp_rate": 250000,
+ "start_freq": 10142000,
+ "start_mod": "usb",
+ "tuning_step": "500"
+ },
+ "40m": {
+ "name": "40m",
+ "center_freq": 7100000,
+ "samp_rate": 500000,
+ "start_freq": 7070000,
+ "start_mod": "lsb",
+ "tuning_step": "500"
+ },
+ "80m": {
+ "name": "80m",
+ "center_freq": 3650000,
+ "samp_rate": 500000,
+ "start_freq": 3570000,
+ "start_mod": "lsb",
+ "tuning_step": "500"
+ },
+ "49m": {
+ "name": "49m Broadcast",
+ "center_freq": 6000000,
+ "samp_rate": 500000,
+ "start_freq": 6070000,
+ "start_mod": "am",
+ "tuning_step": "1000"
+ }
+ }
+ }
+ },
+ "receiver_name": "ARISS Radio Pi",
+ "receiver_location": "Budapest, Hungary",
+ "receiver_asl": 200,
+ "receiver_admin": "example@example.com",
+ "receiver_gps": {
+ "lat": 39.95233,
+ "lon": -75.16379
+ },
+ "photo_title": "Panorama of Budapest from Sch\u00f6nherz Zolt\u00e1n Dormitory",
+ "photo_desc": "",
+ "max_clients": 20,
+ "keep_files": 20,
+ "session_timeout": 0,
+ "usage_policy_url": "policy",
+ "allow_chat": true,
+ "allow_audio_recording": true,
+ "allow_center_freq_changes": false,
+ "magic_key": "memagic",
+ "receiver_keys": [],
+ "waterfall_scheme": "GoogleTurboWaterfall",
+ "fft_fps": 9,
+ "fft_size": 4096,
+ "fft_voverlap_factor": 0.3,
+ "waterfall_levels": {
+ "min": -88.0,
+ "max": -20.0
+ },
+ "waterfall_auto_levels": {
+ "min": 3.0,
+ "max": 10.0
+ },
+ "waterfall_auto_level_default_mode": false,
+ "waterfall_auto_min_range": 50,
+ "audio_compression": "adpcm",
+ "fft_compression": "adpcm",
+ "tuning_precision": 2,
+ "eibi_bookmarks_range": 0,
+ "repeater_range": 0,
+ "map_type": "google",
+ "google_maps_api_key": "",
+ "openweathermap_api_key": "",
+ "map_position_retention_time": 7200,
+ "map_ignore_indirect_reports": false,
+ "map_prefer_recent_reports": true,
+ "callsign_url": "https://www.qrzcq.com/call/{}",
+ "vessel_url": "https://www.vesselfinder.com/vessels/details/{}",
+ "flight_url": "https://flightaware.com/live/flight/{}",
+ "modes_url": "https://flightaware.com/live/modes/{}/redirect"
+}
+
diff --git a/groundstation/sstv_decode_prompt.sh b/groundstation/sstv_decode_prompt.sh
index dab0f18a..07c4cf05 100755
--- a/groundstation/sstv_decode_prompt.sh
+++ b/groundstation/sstv_decode_prompt.sh
@@ -4,10 +4,12 @@ echo "Script to decode SSTV using QSSTV with rtl_fm"
echo
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
sudo modprobe snd-aloop
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 qsstv &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
@@ -16,7 +18,7 @@ sudo killall -9 aplay &>/dev/null
sudo killall -9 direwolf &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
@@ -30,6 +32,9 @@ sudo killall -9 sdrpp &>/dev/null
sudo killall -9 zenity &>/dev/null
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
sudo killall -9 rtl_fm &>/dev/null
#echo "s" >> .mode
diff --git a/groundstation/webSDR.desktop b/groundstation/webSDR.desktop
index 277bbae2..387dfd95 100644
--- a/groundstation/webSDR.desktop
+++ b/groundstation/webSDR.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/home/pi/CubeSatSim/groundstation/sdr.sh
Name=Web SDR
Comment=openwebrx for Web SDR
-Icon=/home/pi/Downloads/openwebrx.png
+Icon=/home/pi/Icons/openwebrx.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/install b/install
index a49022a0..3ee85b0f 100755
--- a/install
+++ b/install
@@ -12,6 +12,10 @@ if [ -f "$FILE" ]; then
echo -e "\nUpdate script for CubeSatSim v2.2\n"
+ sudo rm /home/pi/CubeSatSim/telem.wav &>/dev/null
+ sudo rm /home/pi/CubeSatSim/t.txt &>/dev/null
+ sudo rm /home/pi/CubeSatSim/uptime &>/dev/null
+
if [ -z "$1" ] ; then
checkout=0
else
@@ -61,9 +65,10 @@ if [[ $(grep '11.' /etc/debian_version) ]]; then
sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
- 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
- sudo sed -i 's/maxcpus=2/maxcpus=1/g' /boot/cmdline.txt # single core if Pi Zero 2
+# sudo sed -i 's/maxcpus=2/maxcpus=1/g' /boot/cmdline.txt # single core if Pi Zero 2
sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt
@@ -158,11 +163,17 @@ if [[ $(grep 'bookworm' /etc/os-release) ]]; then
sudo sed -i 's/console=serial0,115200 //g' /boot/firmware/cmdline.txt
- sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
+# sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
+ sudo sed -i 's/console=tty1 maxcpus=1 r/console=tty1 r/g' /boot/firmware/cmdline.txt
+
- sudo sed -i 's/maxcpus=2/maxcpus=1/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
+# sudo sed -i 's/maxcpus=2/maxcpus=1/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/firmware/config.txt
+
+ sudo sed -i 's/#dtoverlay=vc4-fkms-v3d/dtoverlay=vc4-fkms-v3d/g' /boot/firmware/config.txt
+ sudo sed -i 's/#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/g' /boot/firmware/config.txt
+
if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/firmware/config.txt) ]]; then
echo "dtoverlay=i2c-gpio already in /boot/firmware/config.txt"
@@ -332,6 +343,8 @@ sudo apt-get update && sudo apt-get dist-upgrade -y
# sudo apt install -y python3-pip
# fi
+cp /home/pi/CubeSatSim/groundstation/pacsat.desktop /home/pi/Desktop/pacsat.desktop
+
if [ ! -d "/home/pi/venv" ]; then
cd
@@ -353,14 +366,39 @@ sudo apt-get install -y gcc g++ make cmake libasound2-dev libudev-dev libavahi-c
# removed wiringpi and python-picamera python3-picamera
sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev minicom
+if [ -d "/home/pi/direwolf" ]; then
+
+ cd
+ cd direwolf
+ # Get the URL of the 'origin' remote
+ REPO_URL=$(git config --get remote.origin.url)
+
+ # Check if the command was successful and a URL was retrieved
+ if [ $? -eq 0 ] && [ -n "$REPO_URL" ]; then
+
+ if [ ! "$REPO_URL" = "https://github.com/wb2osz/direwolf.git" ]; then
+
+ echo "Current Direwolf git repository URL is $REPO_URL"
+ sudo rm -r /home/pi/direwolf
+ fi
+ else
+ echo "Could not find the URL for the 'origin' remote for Direwolf"
+ fi
+fi
+
if [ ! -d "/home/pi/direwolf" ]; then
+ echo "Installing Direwolf from https://github.com/wb2osz/direwolf.git"
cd
- git clone https://github.com/alanbjohnston/direwolf.git
- cd direwolf
- make -j
- sudo make install
- make install-rpi
+ git clone https://github.com/wb2osz/direwolf.git
+ cd direwolf
+ mkdir build
+ cd build
+ cmake ..
+ make -j4
+ sudo make install
+ make install-conf
+
fi
sudo apt-get install -y gpsd gpsd-clients libgps-dev python3-gps
@@ -399,8 +437,16 @@ if [ $checkout -eq 1 ]; then
git checkout $branch
git pull --no-rebase > .updated
FLAG=1
- echo "Running update script again"
+ echo "Running update again"
+ /home/pi/CubeSatSim/install
+ exit
+fi
+
+grep 'install' /home/pi/CubeSatSim/.updated
+if [[ $(grep 'install' /home/pi/CubeSatSim/.updated) ]]; then
+ echo "install script updated, running again"
/home/pi/CubeSatSim/install
+ exit
fi
make debug
@@ -436,6 +482,121 @@ if [[ $(grep 'changed' /home/pi/pi-power-button/.updated_p) ]]; then
FLAG=1
fi
+if [ ! -d "/home/pi/g0kla_common" ]; then
+ cd
+ git clone https://github.com/alanbjohnston/g0kla_common.git
+ cd g0kla_common/Debug/
+ make clean
+ make all
+ sudo ./install.sh
+
+else
+ cd /home/pi/g0kla_common/Debug/
+
+ git pull --no-rebase > .updated
+ grep 'changed' /home/pi/g0kla_common/Debug/.updated
+ if [[ $(grep 'changed' /home/pi/g0kla_common/Debug/.updated) ]]; then
+
+ echo "updating g0kla_common"
+ make clean
+ make all
+ FLAG=1
+ fi
+fi
+
+FILE=/home/pi/pi_pacsat/Debug/pi_pacsat # code has already been compiled
+if [ ! -f "$FILE" ]; then
+
+ cd
+ #git clone https://github.com/alanbjohnston/pi_pacsat.git
+ git clone https://github.com/ac2cz/pi_pacsat.git
+ cd pi_pacsat
+ #git checkout master-debug
+ cd Debug
+ make clean
+ 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=AMSAT-12" >> pacsat.config
+# echo "broadcast_callsign=AMSAT-11" >> pacsat.config
+# echo "digi_callsign=AMSAT-1" >> pacsat.config
+# echo "max_frames_in_tx_buffer=5" >> pacsat.config
+
+# echo "pb_open=1" > pacsat.state
+# echo "uplink_open=1" >> pacsat.state
+# echo "pb_max_period_for_client_in_seconds=60" >> pacsat.state
+# echo "uplink_max_period_for_client_in_seconds=60" >> pacsat.state
+
+else
+ cd /home/pi/pi_pacsat/Debug/
+
+ git pull --no-rebase > .updated
+ grep 'changed' /home/pi/pi_pacsat/Debug/.updated
+ if [[ $(grep 'changed' /home/pi/pi_pacsat/Debug/.updated) ]]; then
+
+ echo "updating pi_pacsat"
+ make clean
+ make all
+ FLAG=1
+ fi
+fi
+
+FILE=/home/pi/pacsat_telem/Debug/pacsat_telem # code has already been compiled
+if [ ! -f "$FILE" ]; then
+ cd
+ sudo apt-get install -y libbsd-dev
+ git clone https://github.com/alanbjohnston/pacsat_telem.git
+ cd pacsat_telem
+ git checkout master-fox
+ cd Debug
+ make clean
+ make all
+fi
+
+cd /home/pi/pacsat_telem/Debug/
+
+git pull --no-rebase > .updated
+# git checkout master-fox
+grep 'changed' /home/pi/pacsat_telem/Debug/.updated
+if [[ $(grep 'changed' /home/pi/pacsat_telem/Debug/.updated) ]]; then
+
+ echo "updating pacsat_telem"
+ make clean
+ make all
+ FLAG=1
+fi
+
+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
+
+
+
+if [ ! -d "/home/pi/Desktop/PacsatGround" ]; then
+
+ cd /tmp
+ wget https://www.g0kla.com/pacsat/downloads/test/PacsatGround_unix_0_46o.tar.gz
+ tar -xzf PacsatGround_unix_0_46o.tar.gz -C /home/pi/Desktop
+ rm PacsatGround_unix_0_46o.tar.gz
+ cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46o/* /home/pi/Desktop/PacsatGround/spacecraft/
+# mkdir /home/pi/PacSatGround
+ sudo usermod -a -G gpio pi
+ sudo apt-get install default-jdk -y
+
+fi
+
cd
if [ ! -d "/home/pi/PiSSTVpp" ]; then
@@ -481,7 +642,7 @@ if [ -f "$FILE" ]; then
else
echo "creating cubesatsim.service."
sudo cp /home/pi/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
- sudo systemctl enable command
+ sudo systemctl enable cubesatsim
FLAG=1
fi
@@ -523,6 +684,21 @@ else
FLAG=1
fi
+FILE=/etc/systemd/system/pacsatsim.service
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/systemd/pacsatsim.service /etc/systemd/system/pacsatsim.service) ]]; then
+ echo "changed pacsatsim.service."
+ sudo cp /home/pi/CubeSatSim/systemd/pacsatsim.service /etc/systemd/system/pacsatsim.service
+ FLAG=1
+ else
+ echo "no change to pacsatsim.service."
+ fi
+else
+ echo "creating pacsatsim.service."
+ sudo cp /home/pi/CubeSatSim/systemd/pacsatsim.service /etc/systemd/system/pacsatsim.service
+ FLAG=1
+fi
+
FILE=/etc/asound.conf
if [ -f "$FILE" ]; then
if [[ $(diff /home/pi/CubeSatSim/asound.conf /etc/asound.conf) ]]; then
@@ -655,9 +831,15 @@ cd
#fi
+sed -i 's/quick_exec=0/quick_exec=1/' ~/.config/libfm/libfm.conf
+
+sudo apt install -y raspberrypi-ui-mods
+
+sudo apt autoremove -y
+
if [ "$noreboot" = "0" ] ; then
- if [ $FLAG -eq 1 ]; then
+ if [ $FLAG -eq 1 ]; then # Not sure if this is needed
echo "systemctl daemon-reload and reboot"
sudo systemctl daemon-reload
sudo reboot -h now
diff --git a/log b/log
index 2a3ce9d7..a516a3c0 100755
--- a/log
+++ b/log
@@ -2,16 +2,65 @@
echo -e "\nLog file script for CubeSatSim\n"
-if [ "$1" = "-r" ] || [ "$1" = "-t" ] ; then
- sudo journalctl -a -u transmit > /home/pi/CubeSatSim/logt.txt
- cat /home/pi/CubeSatSim/logt.txt
- echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logt.txt"
-elif [ "$1" = "-c" ]; then
- sudo journalctl -a -u command > /home/pi/CubeSatSim/logc.txt
- cat /home/pi/CubeSatSim/logc.txt
- echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logc.txt"
+if [ "$1" = "-h" ] ; then
+ echo "Displays systemd logs for the chose process. The choices are:"
+ echo " -d cubesatsim (also no choice gives you this)"
+ echo " -t transmit"
+ echo " -c command and control"
+ echo " -p pacsat"
+ echo "Default is the log is dumpted to the screen and written to a file."
+ echo "If an additional r is included, the log is realtime, and exits with a Control-C"
+ echo
+ exit
+fi
+
+REALTIME=0
+if [ "$2" = "r" ] ; then
+ REALTIME=1
+fi
+
+if [ "$REALTIME" = "1" ] ; then
+
+ echo "To exit, type Control-C"
+ echo
+ sleep 2
+
+ if [ "$1" = "-r" ] || [ "$1" = "-t" ] ; then
+ sudo journalctl -af -u transmit # > /home/pi/CubeSatSim/logt.txt
+ # cat /home/pi/CubeSatSim/logt.txt
+ # echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logt.txt"
+ elif [ "$1" = "-c" ]; then
+ sudo journalctl -af -u command # > /home/pi/CubeSatSim/logc.txt
+ cat /home/pi/CubeSatSim/logc.txt
+ # echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logc.txt"
+ elif [ "$1" = "-p" ]; then
+ sudo journalctl -af -u pacsatsim # > /home/pi/CubeSatSim/logp.txt
+ cat /home/pi/CubeSatSim/logp.txt
+ # echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logp.txt"
+ else
+ sudo journalctl -af -u cubesatsim # > /home/pi/CubeSatSim/log.txt
+ # cat /home/pi/CubeSatSim/log.txt
+ # echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
+ fi
+
else
- sudo journalctl -a -u cubesatsim > /home/pi/CubeSatSim/log.txt
- cat /home/pi/CubeSatSim/log.txt
- echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
+
+ if [ "$1" = "-r" ] || [ "$1" = "-t" ] ; then
+ sudo journalctl -a -u transmit > /home/pi/CubeSatSim/logt.txt
+ cat /home/pi/CubeSatSim/logt.txt
+ echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logt.txt"
+ elif [ "$1" = "-c" ]; then
+ sudo journalctl -a -u command > /home/pi/CubeSatSim/logc.txt
+ cat /home/pi/CubeSatSim/logc.txt
+ echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logc.txt"
+ elif [ "$1" = "-p" ]; then
+ sudo journalctl -a -u pacsatsim > /home/pi/CubeSatSim/logp.txt
+ cat /home/pi/CubeSatSim/logp.txt
+ echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logp.txt"
+ else
+ sudo journalctl -a -u cubesatsim > /home/pi/CubeSatSim/log.txt
+ cat /home/pi/CubeSatSim/log.txt
+ echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
+ fi
+
fi
diff --git a/main.c b/main.c
index 573ccb5f..3152e021 100644
--- a/main.c
+++ b/main.c
@@ -261,13 +261,28 @@ 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");
}
}
}
-
+/*
+ if ( mode == PACSAT) {
+ FILE * pacsat_file = popen("sudo systemctl restart pacsatsim", "r");
+ pclose(pacsat_file);
+ }
+ else {
+ FILE * pacsat_file = popen("sudo systemctl stop pacsatsim", "r");
+ pclose(pacsat_file);
+ }
+*/
// Open telemetry file with STEM Payload Data
telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "a");
if (telem_file == NULL)
@@ -315,13 +330,15 @@ int main(int argc, char * argv[]) {
map[MINUS_X] = MINUS_Y;
map[PLUS_Z] = MINUS_X;
map[MINUS_Y] = PLUS_Z;
-
+/*
if (access("/dev/i2c-11", W_OK | R_OK) >= 0) { // Test if I2C Bus 11 is present
printf("/dev/i2c-11 is present\n\n");
snprintf(busStr, 10, "%d %d", test_i2c_bus(1), test_i2c_bus(11));
} else {
snprintf(busStr, 10, "%d %d", i2c_bus1, i2c_bus3);
}
+*/
+ snprintf(busStr, 10, "%d %d", i2c_bus1, i2c_bus3);
FILE * os_test = popen("cat /etc/os-release", "r");
fgets(cmdbuffer, 1000, os_test);
@@ -503,8 +520,9 @@ int main(int argc, char * argv[]) {
printf("\n FSK Mode, %d bits per frame, %d bits per second, %d ms per frame, %d ms sample period\n",
bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod);
-
- } else if (mode == BPSK) {
+ } else if ((mode == BPSK) || (mode == PACSAT) || (mode == PACSATGND)) {
+//// } else {
+
bitRate = 1200;
rsFrames = 3;
payloads = 6;
@@ -526,8 +544,11 @@ int main(int argc, char * argv[]) {
frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms
- printf("\n BPSK Mode, bufLen: %d, %d bits per frame, %d bits per second, %d ms per frame %d ms sample period\n",
- bufLen, bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod);
+ if (mode == BPSK)
+ printf("\n BPSK Mode, bufLen: %d, %d bits per frame, %d bits per second, %d ms per frame %d ms sample period\n",
+ bufLen, bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod);
+ else
+ printf("\n dataLen: %d \n", dataLen);
sin_samples = S_RATE/freq_Hz;
// printf("Sin map: ");
@@ -580,15 +601,8 @@ int main(int argc, char * argv[]) {
memset(sensor, 0, sizeof(sensor));
memset(other, 0, sizeof(other));
-// if (((mode == FSK) || (mode == BPSK))) // && !sim_mode)
- if (mode == FSK) { // && !sim_mode)
- get_tlm_fox();
-// get_tlm_fox();
- }
- if (mode == BPSK) { // && !sim_mode)
+ if ((mode == FSK) || (mode == BPSK) || (mode == PACSAT) || (mode == PACSATGND)) // && !sim_mode)
get_tlm_fox(); // fill transmit buffer with reset count 0 packets that will be ignored
-// get_tlm_fox();
- }
else if (mode == FC) // && !sim_mode)
get_tlm_fc(); // fill transmit buffer with reset count 0 packets that will be ignored
else if (mode == CW)
@@ -605,6 +619,8 @@ int main(int argc, char * argv[]) {
strcat(pythonConfigStr, " c");
fprintf(stderr, "pythonConfigStr: %s\n", pythonConfigStr);
+
+ FILE *file2 = sopen(pythonVenv); // activate venv
file1 = sopen(pythonConfigStr); // python sensor polling function
@@ -1028,6 +1044,7 @@ int main(int argc, char * argv[]) {
}
if (sim_mode) { // simulated telemetry
+ printf("Simulated telemetry mode\n");
double time = ((long int)millis() - time_start) / 1000.0;
@@ -1066,9 +1083,9 @@ int main(int argc, char * argv[]) {
// float charging = eclipse * (fabs(amps_max[0] * 0.707) + fabs(amps_max[1] * 0.707) + rnd_float(-4.0, 4.0));
// current[map[BAT]] = ((current[map[BAT2]] * voltage[map[BAT2]]) / batt) - charging;
- current[map[BAT]] = rnd_float(320, 510) - charging;
+ current[map[BAT]] = rnd_float(320, 510) - charging;
- printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]);
+ printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]);
batt -= (batt > 3.5) ? current[map[BAT]] / 300000 : current[map[BAT]] / 30000;
if (batt < 3.6) {
@@ -1275,11 +1292,11 @@ int main(int argc, char * argv[]) {
sleep(rand_sleep);
// fprintf(stderr, "INFO: Sleeping for extra %d sec\n", rand_sleep);
- } else if ((mode == FSK) || (mode == BPSK)) {// FSK or BPSK
+ } else if ((mode == FSK) || (mode == BPSK) || (mode == PACSAT) || (mode == PACSATGND)) {// FSK or BPSK
get_tlm_fox();
} else if ((mode == FC)) {
get_tlm_fc();
- } else { // SSTV
+ } else { // SSTV or PACSATGND
// fprintf(stderr, "Sleeping\n");
sleep(30);
}
@@ -1560,6 +1577,8 @@ void get_tlm_fox() {
smaller = (int)(S_RATE / (2 * freq_Hz));
+// if (mode == PACSAT)
+// dataLen = 78;
short int b[dataLen];
short int b_max[dataLen];
short int b_min[dataLen];
@@ -1629,7 +1648,10 @@ void get_tlm_fox() {
sampleTime = (unsigned int)millis();
} else
- printf("first or second time - no sleep\n");
+ {
+ printf("first time - no sleep\n");
+ firstTime = OFF;
+ }
printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime) / 1000.0);
fflush(stdout);
@@ -1640,7 +1662,6 @@ void get_tlm_fox() {
for (int count1 = 0; count1 < 8; count1++) {
if (voltage[count1] < voltage_min[count1]) voltage_min[count1] = voltage[count1];
if (current[count1] < current_min[count1]) current_min[count1] = current[count1];
-
if (voltage[count1] > voltage_max[count1]) voltage_max[count1] = voltage[count1];
if (current[count1] > current_max[count1]) current_max[count1] = current[count1];
@@ -1998,8 +2019,8 @@ void get_tlm_fox() {
encodeB(b, 52 + head_offset, rxAntennaDeployed + txAntennaDeployed * 2 + c2cStatus * 4);
encodeA(b, 53 + head_offset, groundCommandCount);
- if (mode == BPSK) {
- encodeA(b_max, 51 + head_offset, status);
+ if ((mode == BPSK) || (mode == PACSAT) || (mode == PACSATGND)) {
+ encodeA(b_max, 51 + head_offset, status);
encodeA(b_min, 51 + head_offset, status);
encodeB(b_max, 52 + head_offset, rxAntennaDeployed + txAntennaDeployed * 2 + c2cStatus * 4);
encodeB(b_min, 52 + head_offset, rxAntennaDeployed + txAntennaDeployed * 2 + c2cStatus * 4);
@@ -2020,8 +2041,38 @@ void get_tlm_fox() {
encodeA(b, 65 + head_offset, val >> 8);
encodeA(b, 63 + head_offset, 0x00);
encodeA(b, 62 + head_offset, 0x01);
- encodeB(b, 74 + head_offset, 0xfff);
+ encodeB(b, 74 + head_offset, 0xfff);
}
+
+ if ((mode == PACSAT) || (mode == PACSATGND))
+ {
+ FILE *telem_binary = fopen("/home/pi/CubeSatSim/tlm.bin", "wb");
+ if (telem_binary != NULL) {
+
+ int bytes_written = 4;
+ unsigned int now = (unsigned int)time(0);
+ fwrite(&now, sizeof(now), 1, telem_binary);
+
+ int count;
+ char byte;
+ printf("b is: \n");
+ for (count = 0; count < dataLen; count++) {
+ byte = b[count];
+ fwrite(&byte, 1, 1, telem_binary);
+ printf("%02X ", byte);
+ bytes_written++;
+ }
+ printf("\n");
+ printf("Writing %d bytes to tlm.bin\n", bytes_written + 4);
+ fclose(telem_binary);
+ }
+ else
+ printf("Error opening tlm.bin\n");
+ }
+ else
+ { // extra bracket for some reason?
+ {
+
short int data10[headerLen + rsFrames * (rsFrameLen + parityLen)];
short int data8[headerLen + rsFrames * (rsFrameLen + parityLen)];
@@ -2310,22 +2361,25 @@ void get_tlm_fox() {
// max -= 1;
}
- /// if (sock_ret == -1) {
- /// printf("Error: %s \n", strerror(errno));
- /// socket_open = 0;
- // transmitStatus = -1;
- /// }
- /// }
+ if (socket_open == 1)
+ firstTime = 0;
+// else if (frames_sent > 0) //5)
+// firstTime = 0;
+
+ }
+ } // extra bracket for some reason?
+
if (!transmit) {
fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n");
fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n");
}
- /// if (socket_open == 1)
- /// firstTime = 0;
- // else if (frames_sent > 0) //5)
- // firstTime = 0;
-
+// if (firstTime && (mode == PACSAT))
+// {
+// firstTime = OFF;
+// fprintf(stderr, "No longer first time\n");
+// fflush(stdout);
+// }
return;
}
@@ -2664,9 +2718,8 @@ if (setting == ON) {
FILE *command = popen("touch /home/pi/CubeSatSim/battery_saver", "r");
pclose(command);
fprintf(stderr,"Turning Safe Mode ON\n");
- fprintf(stderr,"Turning Battery saver mode ON\n");
- battery_saver_mode = ON;
- if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
+ fprintf(stderr,"Turning Battery saver mode ON\n");
+ if ((mode == AFSK) || (mode == SSTV) || (mode == CW) || (mode == PACSAT) || (mode == PACSATGND)) {
command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r");
pclose(command);
command = popen("sudo reboot now", "r");
@@ -2683,7 +2736,7 @@ if (setting == ON) {
pclose(command);
fprintf(stderr,"Turning Battery saver mode OFF\n");
battery_saver_mode = OFF;
- if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
+ if ((mode == AFSK) || (mode == SSTV) || (mode == CW) || (mode == PACSAT) || (mode == PACSATGND)) {
command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r");
pclose(command);
command = popen("sudo reboot now", "r");
diff --git a/main.h b/main.h
index 442c1bd7..08a9ad5e 100644
--- a/main.h
+++ b/main.h
@@ -125,7 +125,9 @@ FILE *image_file;
#define CW 5
#define FC 6
#define REPEATER 7
+#define PACSAT 8
#define TXCOMMAND 12
+#define PACSATGND 13
#define FAIL_COUNT 11
#define FAIL_NONE -1
@@ -200,6 +202,7 @@ char sensor_string[SENSOR_FIELDS][32];
int test_i2c_bus(int bus);
//const char pythonCmd[] = "python3 -u /home/pi/CubeSatSim/python/voltcurrent.py ";
+const char pythonVenv[] = "source /home/pi/venv/bin/activate";
const char pythonCmd[] = "/home/pi/venv/bin/python3 -u /home/pi/CubeSatSim/ina219.py ";
char pythonStr[100], pythonConfigStr[100], busStr[10];
int map[8] = {0, 1, 2, 3, 4, 5, 6, 7};
diff --git a/pacsatsim.sh b/pacsatsim.sh
new file mode 100755
index 00000000..9a4f787a
--- /dev/null
+++ b/pacsatsim.sh
@@ -0,0 +1,322 @@
+#!/bin/bash
+
+# script to run PacsatSim
+
+loopback=0
+vox=0
+safe=0
+card=0
+pwm=0
+
+if [ "$1" = "l" ] ; then
+
+ loopback=1
+
+elif [ "$1" = "v" ] ; then
+
+ vox=1
+
+elif [ "$1" = "c" ] ; then
+
+ card=1
+
+else
+
+ pwm=1
+
+fi
+
+FILE=/home/pi/CubeSatSim/battery_saver
+if [ -f "$FILE" ]; then
+
+ safe=1
+
+fi
+
+if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
+ echo "USB Sound Card detected"
+ soundcard=1
+else
+ echo "No USB Sound Card detected"
+ soundcard=0
+fi
+
+gpio -g mode 7 up
+if [[ $(gpio -g read 7 | grep 0) ]] ; then
+ echo "TXC is present"
+ txc=1
+else
+ echo "TXC not present"
+ txc=0
+fi
+
+timeout 1 rtl_test &> out.txt
+if [[ $(grep "No supported" out.txt) ]] ; then
+ echo "No RTL-SDR detected"
+ rtl=0
+else
+ echo "RTL-SDR detected."
+ rtl=1
+fi
+
+value=`cat /home/pi/CubeSatSim/sim.cfg`
+echo "$value" > /dev/null
+set -- $value
+
+callsign="$1"
+txfrequency="$7e3"
+rxfrequency="$8e3"
+
+echo -n "PacSat allsign is "
+echo $callsign
+echo -n "Transmit Frequency is "
+echo $txfrequency
+echo -n "Receive Frequency is "
+echo $rxfrequency
+echo
+
+sleep 2
+
+if [ ! -d "/home/pi/PacSat" ]; then
+
+ echo "Setting up PacSatSim default configuration"
+ echo
+
+ cd
+ sudo rm pacsat-dir.zip
+ mkdir PacSat
+ mkdir PacSat/pacsat
+ mkdir PacSat/pacsat/dir
+ wget https://github.com/alanbjohnston/pi_pacsat/releases/download/v0.1/pacsat-dir.zip
+ unzip pacsat-dir.zip -d PacSat/pacsat/dir
+ sudo rm pacsat-dir.zip
+
+ cd
+ sudo rm /home/pi/pi_pacsat/Debug/pacsat.config
+ sudo rm /home/pi/pi_pacsat/Debug/pacsat.state
+ sudo rm /home/pi/pi_pacsat/Debug/pacsat_upload_table.dat
+ sudo rm pi_pacsat.zip
+ wget https://github.com/alanbjohnston/pi_pacsat/releases/download/v0.1/pi_pacsat.zip
+ unzip pi_pacsat.zip -d /home/pi/pi_pacsat/Debug
+ sudo rm pi_pacsat.zip
+
+# mkdir /home/pi/PacSat
+# mkdir /home/pi/PacSat/pacsat
+# mkdir /home/pi/PacSat/pacsat/dir
+
+# cd /home/pi/pi_pacsat/Debug
+
+# sudo rm pacsat_last_command_time.dat
+# sudo rm pacsat_upload_table.dat
+# sudo rm pacsat.state
+
+# echo "bit_rate=9600" > pacsat.config
+# echo "bbs_callsign=AMSAT-12" >> pacsat.config
+# echo "broadcast_callsign=AMSAT-11" >> pacsat.config
+# echo "digi_callsign=AMSAT-1" >> pacsat.config
+# echo "max_frames_in_tx_buffer=5" >> pacsat.config
+
+# echo "pb_open=1" > pacsat.state
+# echo "uplink_open=1" >> pacsat.state
+# echo "pb_max_period_for_client_in_seconds=60" >> pacsat.state
+# echo "uplink_max_period_for_client_in_seconds=60" >> pacsat.state
+
+# touch /home/pi/pi_pacsat/Debug/pacsat_upload_table.dat
+
+fi
+
+value=`cat /home/pi/CubeSatSim/sim.cfg`
+echo "$value" > /dev/null
+set -- $value
+
+callsign="$1"
+frequency="$7e3"
+
+echo "Configured callsign is "
+echo $callsign
+
+oldcallsign=$(grep -oP '(?<=bbs_callsign=).*(?=-)' /home/pi/pi_pacsat/Debug/pacsat.config)
+
+echo "Callsign in pacsat.config is "
+echo $oldcallsign
+
+if [ ! "$callsign" = "$oldcallsign" ] ; then
+
+ sudo sed -i "s/bbs_callsign=$oldcallsign/bbs_callsign=$callsign/g" /home/pi/pi_pacsat/Debug/pacsat.config
+ sudo sed -i "s/broadcast_callsign=$oldcallsign/broadcast_callsign=$callsign/g" /home/pi/pi_pacsat/Debug/pacsat.config
+ sudo sed -i "s/digi_callsign=$oldcallsign/digi_callsign=$callsign/g" /home/pi/pi_pacsat/Debug/pacsat.config
+
+ echo "New pacsat.confg is"
+ echo
+
+ cat /home/pi/pi_pacsat/Debug/pacsat.config
+
+fi
+
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
+# export LD_LIBRARY_PATH=/mnt/usb-disk/ariss/lib:/usr/local/lib/iors_common:$LD_LIBRARY_PATH
+
+export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
+
+#sudo systemctl stop cubesatsim
+
+#sudo systemctl stop transmit
+
+#sudo systemctl stop command &>/dev/null
+
+sudo modprobe snd-aloop
+
+#sudo systemctl stop openwebrx
+
+#sudo systemctl stop rtl_tcp &>/dev/null
+
+#pkill -o chromium &>/dev/null
+
+#sudo killall -9 rtl_fm &>/dev/null
+
+#sudo killall -9 direwolf &>/dev/null
+
+#udo killall -9 aplay &>/dev/null
+
+#sudo killall -9 qsstv &>/dev/null
+
+#sudo killall -9 rtl_tcp &>/dev/null
+
+#sudo killall -9 java &>/dev/null
+
+#sudo killall -9 CubicSDR &>/dev/null
+
+#sudo killall -9 zenity &>/dev/null
+
+sudo killall -9 pacsat_telem &>/dev/null
+
+sudo killall -9 pi_pacsat &>/dev/null
+
+echo
+
+
+#choice=2
+
+#fi
+
+
+# frequency=434900000
+ echo
+ echo "If your Pacsat Ground Station is transmitting packets, you will see them here"
+ echo
+
+
+#echo
+
+#echo "Note that the 'Tuned to' frequency will be different from the chosen frequency due to the way SDRs work."
+
+
+# echo -e "Auto decoding APRS Pacsat packets on $frequency Hz"
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-loopback.conf -t 0 &
+
+ # /usr/bin/x-terminal-emulator --geometry=120x40 -e "/home/pi/CubeSatSim/pacsatsim-df.sh"
+
+sudo usermod -a -G gpio pi
+
+if [ "$loopback" = "1" ] ; then
+
+ echo "Using audio loopback"
+ ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+
+ MODE=$1
+
+ if [ ! "$MODE" = "P" ] ; then
+
+ /home/pi/CubeSatSim/config -I n
+
+ fi
+
+# sudo /home/pi/CubeSatSim/pacsatsim-d.sh &
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-loopback.conf -t 0 &
+
+elif [ "$safe" = "1" ] ; then
+
+ echo "Safe mode - battery saver"
+# sudo /home/pi/CubeSatSim/pacsatsim-d.sh &
+
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-pwm-loopback.conf -t 0 &
+
+# arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434900 &
+# arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f $frequency &
+
+
+elif [ "$vox" = "1" ]; then
+
+ echo "Using Soundcard Audio TX and RX (VOX, no PTT)"
+ ADEVICE="ADEVICE plughw:CARD=Device,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+# sudo /home/pi/CubeSatSim/pacsatsim-dj.sh &
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-jp14-half.conf -t 0 &
+
+elif [ "$pwm" = "1" ] ; then
+
+ echo "FM TXC using Soundcard input (JP13), PWM output"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Headphones,DEV=0"
+ PTT="PTT GPIOD gpiochip0 -20"
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-pwm.conf -t 0 &
+
+else
+
+ echo "FM TXC using Soundcard input (JP13) and output (JP14)"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Device,DEV=0"
+ PTT="PTT GPIOD gpiochip0 -20"
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-jp14.conf -t 0 &
+
+fi
+
+DIREWOLF_CONF="/home/pi/CubeSatSim/direwolf-pacsatsim-tmp.conf"
+
+echo "$ADEVICE" > $DIREWOLF_CONF
+echo "MYCALL $callsign-1" >> $DIREWOLF_CONF
+echo "$PTT" >> $DIREWOLF_CONF
+cat /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim.conf >> $DIREWOLF_CONF
+
+echo
+echo "$DIREWOLF_CONF"
+echo
+cat $DIREWOLF_CONF
+echo
+
+direwolf -P+ -D1 -qd -dp -r 48000 -c $DIREWOLF_CONF -t 0 &
+
+# arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434900 &
+## arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434900 &
+
+## echo "Don't close the direwolf window or the Pacsatsim will stop running."
+
+export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
+
+/home/pi/pacsat_telem/Debug/pacsat_telem -v -d /home/pi/PacSat/pacsat &
+
+sleep 5
+
+value=`aplay -l | grep "Loopback"`
+echo "$value" > /dev/null
+set -- $value
+
+#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 &
+
+cd /home/pi/pi_pacsat/Debug
+
+./pi_pacsat -c pacsat.config -d /home/pi/PacSat
+
+sleep 60
diff --git a/spacecraft/PacSatGround_0.46m/PacSatSim.dat b/spacecraft/PacSatGround_0.46m/PacSatSim.dat
new file mode 100644
index 00000000..92ae8f93
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46m/PacSatSim.dat
@@ -0,0 +1,15 @@
+Pacsat Telemetry Decoder Properties
+#Sat Nov 26 18:12:20 EST 2016
+numberOfLookupTables=0
+measurementsFileName=measurements.csv
+model=1
+layout0.filename=PACSAT_rttelemetry.csv
+layout0.name=TLMI_LAYOUT
+passMeasurementsFileName=passmeasurements.csv
+name=PacSatSim
+description=PacSatSim
+numberOfLayouts=1
+satId=3
+catalogNumber=0
+conversionCoefficients=pacsat-coef.csv
+layoutsUseBits=True
diff --git a/spacecraft/PacSatGround_0.46m/PacSatSim.properties b/spacecraft/PacSatGround_0.46m/PacSatSim.properties
new file mode 100644
index 00000000..e4ccad24
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46m/PacSatSim.properties
@@ -0,0 +1,20 @@
+#PacSat Ground Station Properties
+#Sun Feb 17 18:25:06 EST 2019
+sequence_num=3
+name=PacSatSim
+digiCallsign=AMSAT-1
+description=PacSatSim
+broadcastCallsign=AMSAT-11
+DIR_AGE=10
+bbsCallsign=AMSAT-12
+telemLayoutFile=PacSatSim.dat
+telem_server=tlm.amsatfox.org
+web_site_url=http://CubeSatSim.org
+show_system_files_on_dir_tab=false
+show_user_files=true
+supports_file_upload=true
+norad_id=30776
+psf_header_check_sums=false
+commandsFile=pacsat.commands
+is_command_station=true
+secret_key=ScKQLp2ZMvCaCTK5jAmOmKmA0JiSyJ6Y15+Yfg\=\=
diff --git a/spacecraft/PacSatGround_0.46o/PacSatGround.zip b/spacecraft/PacSatGround_0.46o/PacSatGround.zip
new file mode 100644
index 00000000..900415dc
Binary files /dev/null and b/spacecraft/PacSatGround_0.46o/PacSatGround.zip differ
diff --git a/spacecraft/PacSatGround_0.46o/PacSatGroundLoop.zip b/spacecraft/PacSatGround_0.46o/PacSatGroundLoop.zip
new file mode 100644
index 00000000..7efc92a7
Binary files /dev/null and b/spacecraft/PacSatGround_0.46o/PacSatGroundLoop.zip differ
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim-coef.csv b/spacecraft/PacSatGround_0.46o/PacSatSim-coef.csv
new file mode 100644
index 00000000..cb9f0537
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim-coef.csv
@@ -0,0 +1,41 @@
+0,-,NONE,0,1,0,0,0,0,None,0,4096,None
+1,-,Boolean,0,1,0,0,0,0,Boolean,0,1,A Boolean value that prints TRUE or FALSE
+2,-,Counts,0,1,0,0,0,0,Counts,0,4096,An integer count value
+3,-,Date,0,1,0,0,0,0,Date,0,4096,A Unix epoch date time integer
+4,-,TXPower,0,1,0,0,0,0,None,0,4096,None
+5,-,IHUSpeed,0,0.1,0,0,0,0,None,0,4096,None
+6,-,RSSI_1,0,-1,0,0,0,0,Counts,0,4096,Signed 8 bit
+7,-,Mode,0,0,0,0,0,0,Enum,0,4096,SAFE:CREW:TELEM:X BAND RPT:APRS:SSTV:FS
+8,-,Battery,0,0.001,0,0,0,0,None,0,4096,Battery Voltage
+9,-,IHUTemp,0,0.1,0,0,0,0,None,0,4096,None
+10,-,Mode,0,1,0,0,0,0,None,0,4096,The spacecraft Mode
+11,-,FS_BYTES_PER_BLK,0,128,0,0,0,0,Counts,0,4096,The number of bytes per block in RED FS
+12,-,FS_FILE_NUMBER,-4,1,0,0,0,0,Counts,0,4096,The number of files in the FS excluding core OS folders
+13,-,SHTC3Temp,-45,0.002670288,0,0,0,0,None,0,4096,SHTC3 Temperature sensor
+14,-,SHTC3Humidity,0,0.001525879,0,0,0,0,None,0,4096,SHTC3 Humidity sensor
+15,-,LPS22Pressure,0,0.000244141,0,0,0,0,None,0,4096,LPS22 Pressure sensor
+16,-,LPS22Temp,0,0.01,0,0,0,0,None,0,4096,LPS22 Temperature of sensor
+17,-,IMUTemp,0,0.00390625,0,0,0,0,None,0,4096,Temperature of IMU = raw/256
+18,-,Acc,0,6.10E-05,0,0,0,0,Sint16,0,4096,Accelerometer is 2g full scale
+19,-,Gyro,0,0.000976563,0,0,0,0,Sint16,0,4096,Gyro scale for 32dps
+20,-,Mag,0,0.149975574,0,0,0,0,Sint16,0,4096,Mag is 4912 full scale
+21,-,AntMode,0,0,0,0,0,0,Enum,0,4096,MANUAL:AUTO:ORBIT
+22,-,ResetReason,0,0,0,0,0,0,Enum,0,4096,NONE:SHUTDOWN:REBOOT:RADIO:TNC:TNC LISTEN:RUN TWICE:RADIO REBOOT:TNC PS REBOOT:TNC REBOOT:SOFT:THERMAL
+23,-,LogLevel,0,0,0,0,0,0,Enum,0,4096,NONE:ERROR:WARN:INFO
+24,-,O2FromVolts,86.434,-0.0354,0,0,0,0,None,0,4096,O2 Conc from raw voltage as a percentage
+25,-,SensorState,0,0,0,0,0,0,Enum,0,4096,OFF:ON:ERR
+26,-,SPARE2,0,0,0,0,0,0,Counts,0,4096,SPARE
+27,-,O2Conc,0,0.01,0,0,0,0,Sint16,0,4096,O2 concentration as percentage
+28,-,SSTVMode,0,0,0,0,0,0,Enum,0,4096,MartinM1:MartinM2:ScottieS1:ScottieS2:Robot36:PasokonP3:PasokonP5:PasokonP7:PD90:PD120:PD160:PD180:PD240:PD290:Robot8BW:Robot24BW
+29,-,DivideBy100,0,0.01,0,0,0,0,None,0,4096,Divide by 100
+30,-,DivideBy100Offset,-20.48,0.01,0,0,0,0,None,0,4096,Divide by 100 with Offset
+31,-,Offset,-2048,1,0,0,0,0,Counts,0,4096,Offset
+32,-,DivideBy10Offset,-204.8,0.1,0,0,0,0,None,0,4096,Divide by 10 with Offset
+33,-,Status,0,0,0,0,0,0,Enum,0,4096,OFF:ON
+34,-,CommandStatus,0,0,0,0,0,0,Enum,0,4096,OFF:Carrier:DTMF/APRS
+35,-,FailStatus,0,0,0,0,0,0,Enum,0,4096,OK:FAIL
+36,-,AntStatus,0,0,0,0,0,0,Enum,0,4096,STOWED:DEPLOYED
+37,-,Times10,0,10.0,0,0,0,0,Counts,0,4096,Multiply by 10
+NOTES:,,,,,,,,,,,,
+Serial,Ignore,name,a,b,c,d,e,f,format,low limit,high limit,Comment
+Echo value = a + bx + cx^2 + dx^3 + ex^4 + fx^5,Echo value = a + bx + cx^2 + dx^3 + ex^4 + fx^5,,,,,,,,,,,
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim.commands b/spacecraft/PacSatGround_0.46o/PacSatSim.commands
new file mode 100644
index 00000000..4e7a8073
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim.commands
@@ -0,0 +1,37 @@
+# This is a list of commands that can be sent to the spacecraft
+# args are 16 bit except the special code 99099099 which is replaced with the unix time, or when special code MSB32BIT is used to combine two fields
+LIST, namespaces, None, Operations, Telem, File System
+LIST, IMAGE FOLDER, sstv_queue 1, sstv_queue 2, sstv_queue 3, sstv_queue 4, sstv_queue 5, sstv_queue 6, sstv_queue 7, sstv_queue 8, sstv_queue 9
+LIST, FOLDER, bin, lib, config, PACSAT dir, upload queue, wod queue, log queue, text queue, sensor wod queue, data1, data2, data3, data4, data5, data6, data7, data8, data9
+LIST, ENABLE, false, true
+LIST, ROLL AT STARTUP, false, true
+LIST, OVERWRITE, false, true
+LIST, FSK, false, true
+LIST, REMOVE ORPHAN FILES, false, true
+LIST, STATE, stop, start
+LIST, UPLINK MODE, Off, All stations, Command Stations Only
+LIST, FILENAME, use id for file name, user file name
+LIST, SHUTDOWN, reboot, shutdown
+LIST, RESET, reboot
+LIST, RATE, 1200, 9600
+LIST, FEC, Off, On
+LIST, FULL DUPLEX, false, true
+LIST, LOG NAME, Log, WOD
+LIST, LOG LEVEL, None, Error, Warnings, Info
+# Name, Name space, cmd, arg0, arg1, arg2, arg3, argName0, argName1, argName2, argName3, confirm, use reset/uptime, description
+#
+# PACSAT
+#
+Pacsat Broadcast,3,1,0,0,0,0,State,Period(sec),Timeout(sec),NONE,false,false,Enable or disable the Pacsat Broadcast module. The directory entries and individual files will be broadcast based on commands from ground stations.
+File Uploads,3,2,0,0,0,0,Uplink Mode,Period(sec),Timeout(sec),NONE,false,false,Enable or disable File Uploads. Limit file uploads to command stations that authenticate with a secret key.
+Install File,3,3,0,0,0,0,FileId,MSB32BIT,Folder,NONE,false,false,Copy a file from the PACSAT Directory to a folder and name it with a 4 byte hex name that matches the id or the user filename.
+Execute File,3,13,0,0,0,0,FileId,MSB32BIT,Arg1,Arg2,true,false,Execute a file on the ARISS-PI. The file must already be installed in the bin folder
+Delete File,3,4,0,0,0,0,FileId,MSB32BIT,Folder,NONE,true,false,Delete a file on the ARISS-PI. Typically this leaves the original copy in the PACSAT dir. To delete the original copy specify the PACSAT Dir folder
+Delete Folder Contents,3,5,0,0,0,0,Folder,Remove Orphan Files,NONE,NONE,true,false,Remove all files from the folder. The original files will remain in the PACSAT Directory unless deleted seperately. Orphan files are files in a folder without a corresponding Pacsat Dir file. NB: Deleting the entire Pacsat Dir is a desperate measure perhaps only useful in testing!
+Default File Expiry Period,3,6,0,0,0,0,Period(days),NONE,NONE,NONE,false,false,Set the default expiry period for files without a specific expiry time. The new value will be applied to all files.
+File Expiry Period,3,7,0,0,0,0,FileId,MSB32BIT,Date,MSB32BIT,false,false,Set the expiry date for a specific file`.
+Directory Maintenence Period,3,8,0,0,0,0,Period(s),NONE,NONE,NONE,false,false,Period between checks to each node in the directory for file expiry.
+Uplink queue maintenance Period,3,9,0,0,0,0,Period(s),NONE,NONE,NONE,false,false,Period to check the entire uplink queue for expired files.
+Int File Que Check Period,3,10,0,0,0,0,Period(s),NONE,NONE,NONE,false,false,Period to check the ingestion queues for newly generated internal files.
+Max File Size,3,11,0,0,0,0,Size(kb),NONE,NONE,NONE,false,false,Maximum size for an uploaded file
+Max Upload File Age,3,12,0,0,0,0,Age(days),NONE,NONE,NONE,false,false,Partially uploaded files not modified for more than this period will be removed from the upload queue.
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim.dat b/spacecraft/PacSatGround_0.46o/PacSatSim.dat
new file mode 100644
index 00000000..7b738eb6
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim.dat
@@ -0,0 +1,18 @@
+#Pacsat Telemetry Decoder Properties
+#Fri Feb 6 18:12:20 EST 2026
+numberOfLookupTables=0
+measurementsFileName=measurements.csv
+model=1
+layoutsUseToCallsignAsType=true
+numberOfLayouts=2
+layout0.filename=PacSatSim_rttelemetry.csv
+layout0.name=TLMP1
+layout1.filename=PacSatSim_rttelemetry.csv
+layout1.name=WOD
+passMeasurementsFileName=passmeasurements.csv
+name=CubeSatSim
+description=PacSatSim
+satId=3
+catalogNumber=0
+conversionCoefficients=PacSatSim-coef.csv
+layoutsUseBits=True
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim.properties b/spacecraft/PacSatGround_0.46o/PacSatSim.properties
new file mode 100644
index 00000000..8ff5be50
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim.properties
@@ -0,0 +1,21 @@
+#PacSat Ground Station Properties
+#Fri Feb 6 18:25:06 EST 2026
+sequence_num=3
+name=PacSatSim
+digiCallsign=AMSAT-1
+description=PacSatSim
+broadcastCallsign=AMSAT-11
+DIR_AGE=10
+bbsCallsign=AMSAT-12
+telemLayoutFile=PacSatSim.dat
+telem_server=tlm.amsatfox.org
+web_site_url=http://CubeSatSim.org
+show_system_files_on_dir_tab=false
+show_user_files=true
+supports_file_upload=true
+norad_id=30776
+psf_header_check_sums=false
+is_command_station=true
+secret_key=Not-required
+commandsFile=PacSatSim.commands
+echo_to_stdout=true
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim_conversion_curves.csv b/spacecraft/PacSatGround_0.46o/PacSatSim_conversion_curves.csv
new file mode 100644
index 00000000..30f05985
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim_conversion_curves.csv
@@ -0,0 +1,13 @@
+CurveName,a,bx,cx^2,dx^3,ex^4,fx^5,Description
+cubesatsim_voltage,0,0.01,0,0,0,0,Converts voltages read from the INA219 sensors
+cubesatsim_current,-2048,1,0,0,0,0,Converts positive and negative currents read from the INA219 sensors
+cubesatsim_temperature,0,0.1,0,0,0,0,Converts temperature of Pi
+cubesatsim_rotation,-2048,1,0,0,0,0,Converts positive and negative dps rotation
+cubesatsim_acceleration,-20.48,0.01,0,0,0,0,Converts positive and negative g acceleration
+cubesatsim_altitude,0,0.1,0,0,0,0,Converts altitude
+cubesatsim_pressure,0,1,0,0,0,0,Converts pressure
+cubesatsim_sensor1,0,1,0,0,0,0,Conversion of Sensor 1
+cubesatsim_sensor2,-2048,1,0,0,0,0,Conversion of Sensor 2
+cubesatsim_sensor3,-20.48,0.01,0,0,0,0,Conversion of Sensor 3
+cubesatsim_rpm,-204.8,0.1,0,0,0,0,Conversion of calculated RPM
+cubesatsim_rssi,-2048,1,0,0,0,0,Conversion of Received Signal Strength
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim_rttelemetry.csv b/spacecraft/PacSatGround_0.46o/PacSatSim_rttelemetry.csv
new file mode 100644
index 00000000..24298614
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim_rttelemetry.csv
@@ -0,0 +1,63 @@
+62,TYPE,FIELD,BITS,UNIT,CONVERSION,MODULE,MODULE_NUM,MODULE_LINE,LINE_TYPE,SHORT_NAME,DESCRIPTION
+0,long,timestamp,32,Sec,0,NONE,0,0,0,timestamp,This is the unix time in seconds
+1,int,Sensor 2,12,integer,2,Experiments,6,8,3,Sensor 2,STEM Payload Extra Sensor 2
+2,int,Sensor 3,12,integer,2,Experiments,6,9,3,Sensor 3,STEM Payload Extra Sensor 3
+3,float,BATT_V,12,V,29,Battery,4,1,3,Battery Voltage,INA219 Battery Voltage
+4,float,SatelliteXAxisAcceleration,12,g,30,+X Panel,7,4,3,Acceleration,STEM Payload Board MPU6050 Acceleration around X Axis
+5,float,SatelliteYAxisAcceleration,12,g,30,+Y Panel,8,4,3,Acceleration,STEM Payload Board MPU6050 Acceleration around Y Axis
+6,float,SatelliteZAxisAcceleration,12,g,30,+Z Panel,9,4,3,Acceleration,STEM Payload Board MPU6050 Acceleration around Z Axis
+7,int,BATT_I,12,mA,31,Battery,4,2,3,Battery Current,INA219 Battery Current
+8,float,Temperature,12,C,5,Experiments,6,2,3,BME280 Temp,BME280 STEM Payload sensor temperature
+9,float,posXv,12,V,29,+X Panel,7,1,3,Voltage,INA219 +X solar panel Voltage
+10,float,posYv,12,V,29,+Y Panel,8,1,3,Voltage,INA219 +Y solar panel Voltage
+11,float,posZv,12,V,29,+Z Panel,9,1,3,Voltage,INA219 +Z solar panel Voltage
+12,float,negXv,12,V,29,-X Panel,10,1,3,Voltage,INA219 -X solar panel Voltage
+13,float,negYv,12,V,29,-Y Panel,11,1,3,Voltage,INA219 -Y solar panel Voltage
+14,float,negZv,12,V,29,-Z Panel,12,1,3,Voltage,INA219 -Z solar panel Voltage
+15,int,posXi,12,mA,31,+X Panel,7,2,3,Current,INA219 +X solar panel Current
+16,int,posYi,12,mA,31,+Y Panel,8,2,3,Current,INA219 +Y solar panel Current
+17,int,posZi,12,mA,31,+Z Panel,9,2,3,Current,INA219 +Z solar panel Current
+18,int,negXi,12,mA,31,-X Panel,10,2,3,Current,INA219 -X solar panel Current
+19,int,negYi,12,mA,31,-Y Panel,11,2,3,Current,INA219 -Y solar panel Current
+20,int,negZi,12,mA,31,-Z Panel,12,2,3,Current,INA219 -Z solar panel Current
+21,float,BATT2_V,12,V,29,Battery2,5,1,3,Battery2 Voltage,INA219 Battery2 Voltage
+22,float,spin,12,rpm,32,Computer Software,3,1,3,Spacecraft Spin,Calculated spin rate using solar cells
+23,int,Pressure,12,hPa,2,Experiments,6,3,3,BME280 Pressure,BME280 STEM Payload sensor pressure
+24,float,Altitude,12,m,37,Experiments,6,4,3,BME280 Altitude,BME280 STEM Payload sensor altitude
+25,float,Resets,12,-,12,NONE,3,2,3,Reset Count, Software Reset Count
+26,float,rssi,12,dBm,31,Radio,1,1,3,RSSI,Received Signal Strength Indication
+27,float,IHUcpuTemp,12,C,5,Computer Hardware,2,1,3,IHU Temp (Pi),Internal temperature of IHU from Pi
+28,float,SatelliteXAxisAngularVelocity,12,dps,31,+X Panel,7,3,3,Rotation,STEM Payload Board MPU6050 Angular veolcity around X Axis
+29,float,SatelliteYAxisAngularVelocity,12,dps,31,+Y Panel,8,3,3,Rotation,STEM Payload Board MPU6050 Angular veolcity around Y Axis
+30,float,SatelliteZAxisAngularVelocity,12,dps,31,+Z Panel,9,3,3,Rotation,STEM Payload Board MPU6050 Angular veolcity around Z Axis
+31,float,Humidity,12,%,5,Experiments,6,5,3,BME280 Humidity,BME280 Humidity
+32,int,BAT2_I,12,mA,31,Battery2,5,2,3,Battery2 Current,INA219 Battery2 Current
+33,float,DiodeTemp,12,C,32,Experiments,6,6,3,Diode Temp,STEM Payload Diode Temperature
+34,int,Sensor 1,12,integer,2,Experiments,6,7,3,Sensor 1,STEM Payload Extra Sensor 1
+35,float,STEMPayloadStatus,1,-,35,Experiments,6,1,0,STEM Payload Status, STEM Payload STEM Payload board failure Indicator
+36,float,SafeMode,1,-,33,Computer Software,3,2,0,Safe Mode, Safe Mode (Low Battery Voltage)
+37,float,SimulatedTelemetry,1,-,33,Computer Software,3,4,0,Simulated Telemetry,Simulated Telemetry Indicator
+38,float,PayloadStatus1,1,-,35,NONE,6,8,0,Exp 3,STEM Payload status 1 failure indicator
+39,float,I2CBus0Failure,1,-,35,NONE,2,2,0,I2C Bus 0,I2C bus 0 failure indicator
+40,float,I2CBus1Failure,1,-,35,Computer Hardware,2,2,0,I2C Bus 1,I2C bus 1 failure indicator
+41,float,I2CBus3Failure,1,-,35,Computer Hardware,2,3,0,I2C Bus 3,I2C bus 3 failure indicator
+42,float,CameraFailure,1,-,35,Computer Hardware,2,4,0,Camera,Camera failure indicator
+43,int,GroundCommands,4,-,2,Computer Software,3,3,0,Ground Commands,Number of ground commands received
+44,float,RxAntenna,1,-,36,Radio,1,3,0,RX Antenna,Receive antenna status
+45,float,TxAntenna,1,-,36,Radio,1,2,0,TX Antenna,Transmit antenna status
+46,float,C2CStatus,2,-,34,Computer Software,3,5,0,Command Control, Command & Control Status
+47,float,ICR3VProt,12,V,0,NONE,7,2,3,3V Prot,ICR 3V Proteted
+48,float,ICR2dot5V,12,V,0,NONE,7,3,3,2.5V,ICR 2.5V
+49,float,ICR2dot5VProt,12,V,0,NONE,7,4,3,2.5V Prot,ICR 2.5V Protected
+50,float,rf6,12,-,0,NONE,0,0,0,None,None
+51,float,rf7,12,-,0,NONE,0,0,0,None,None
+52,float,MuxTest,12,V,0,NONE,7,5,3,Sensor Power,Sensor Power Voltage at the ICR
+53,float,LtVGACtl,12,V,0,NONE,1,4,3,VGA Control,Control Voltage to the Variable Gain Amplifier (VGA)
+54,float,pad,4,-,34,NONE,0,0,0,None,Unused
+55,float,IHUdiagData,32,-,18,NONE,3,2,0,Diagnostic Info,Diagnostic Data on IHU Performance
+56,float,pad1,1,-,0,NONE,0,0,0,NONE,Filler
+57,float,wodSize,8,000s,36,NONE,3,3,0,WOD Stored,Number of WOD data payloads kept for each of Science and Housekeeping. In hundreds
+58,float,swCmds,32,-,35,NONE,7,6,0,Diagnostic,ICR Diagnostic information
+59,float,hwCmdCnt,6,-,1,NONE,7,7,0,HW Command Count,Number of hardware commands since last reset
+60,float,swCmdCnt,6,-,1,NONE,7,8,0,SW Command Count,Number of software commands since last reset
+61,float,pad2,27,-,0,NONE,0,0,0,NONE,Filler
diff --git a/systemd/pacsatsim.service b/systemd/pacsatsim.service
new file mode 100644
index 00000000..d5163bd6
--- /dev/null
+++ b/systemd/pacsatsim.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=PacsatSim
+
+[Service]
+TimeoutStopSec=5
+ExecStart=/home/pi/CubeSatSim/pacsatsim.sh
+WorkingDirectory=/home/pi/CubeSatSim
+StandardOutput=inherit
+StandardError=inherit
+Restart=always
+User=pi
+
+[Install]
+WantedBy=default.target
diff --git a/systemd/transmit.service b/systemd/transmit.service
index ab6dd815..0b77ff50 100644
--- a/systemd/transmit.service
+++ b/systemd/transmit.service
@@ -8,7 +8,7 @@ WorkingDirectory=/home/pi/CubeSatSim
StandardOutput=inherit
StandardError=inherit
Restart=always
-User=root
+User=pi
[Install]
WantedBy=default.target
diff --git a/telem.c b/telem.c
index ce4f14c3..e8a498e4 100644
--- a/telem.c
+++ b/telem.c
@@ -30,6 +30,9 @@ int main(int argc, char *argv[]) {
strcat(pythonConfigStr, " s");
char cmdbuffer[1000];
+
+ FILE *file2 = sopen(pythonVenv); // activate venv
+
FILE *file1 = sopen(pythonConfigStr); // try new function
fgets(cmdbuffer, 1000, file1);
if (debug == ON)
diff --git a/transmit.py b/transmit.py
index 0ba37e65..75f59de0 100644
--- a/transmit.py
+++ b/transmit.py
@@ -1,7 +1,5 @@
#!/usr/bin/env python
-#import RPi.GPIO as GPIO
-#from RPi.GPIO import output
#import subprocess
import time
from time import sleep
@@ -22,17 +20,20 @@ def output(pin, value):
def input(pin):
# command = "gpio -g read " + str(pin)
query = ["gpio", "-g", "read", str(pin)] # Read GPIO pin
+ command = "gpio -g read " + str(pin)
try:
result = subprocess.run(query, capture_output=True, text=True, check=True)
- print(f"Command run was: {query}")
- print("Sucess!")
- print(f"Output of the command (stdout): {result.stdout}")
+# print(f"Command run was: {query}")
+# print("Sucess!")
+# print(f"Output of the command (stdout): {result.stdout}")
+# print(f"{command}: {result.stdout}")
return int(result.stdout)
except subprocess.CalledProcessError as e:
- print(f"Command failed with return code: {e.returncode}")
- print(f"Command run was: {e.cmd}")
- print(f"Output of the command (stdout): {e.stdout}")
- print(f"Error output of the command (stderr): {e.stderr}")
+# print(f"Command failed with return code: {e.returncode}")
+# print(f"Command run was: {e.cmd}")
+# print(f"Output of the command (stdout): {e.stdout}")
+# print(f"Error output of the command (stderr): {e.stderr}")
+ print(f"{command}: -1")
return -1
def setup(pin, config):
@@ -41,7 +42,7 @@ def setup(pin, config):
system(command)
print(command)
else:
- print(f"Unknown GPIO setup configuration: {config}")
+ print(f"Unknown gpio setup configuration: {config}")
def blink(times):
powerPin = 16
@@ -150,11 +151,9 @@ def increment_mode():
file.close()
print(".mode file written")
-# GPIO.setwarnings(False)
output(txLed, 0)
output(powerPin, 0)
print("sudo reboot -h now")
-# GPIO.setwarnings(False)
setup(powerPin, "out")
output(powerPin, 0);
# system("reboot -h now")
@@ -207,7 +206,7 @@ def camera_photo():
img = Image.open(file)
draw = ImageDraw.Draw(img)
# draw.text((10, 10), callsign, font=font2, fill='white')
- # draw.text((120, 10), telem_string, font=font2, fill='white')
+ # draw.text((120, 10), telem_string, font=font2, fill='white')
draw.text((12, 12), callsign, font=font1, fill='black')
draw.text((10, 10), callsign, font=font1, fill='white')
draw.text((112, 12), telem_string, font=font2, fill='black') # was 122
@@ -229,8 +228,6 @@ powerPin = 16
command_tx = True
-# GPIO.setmode(GPIO.BCM)
-# GPIO.setwarnings(False)
setup(13, "up")
setup(12, "up")
setup(27, "up")
@@ -246,28 +243,22 @@ if input(12) == False:
else:
print("No LPF")
-
-# GPIO.setup(txLed, GPIO.OUT)
-# output(txLed, 0)
-
-# GPIO.setmode(GPIO.BCM) # Repeat to make LED work on Pi 4
-# GPIO.setwarnings(False)
setup(txLed, "out")
setup(pd, "out")
#output(pd, 1)
output(pd, 0)
setup(ptt, "out")
-output (ptt, 1)
+output(ptt, 1)
txc = False
if input(txc_pin) == False:
print("TXC is present")
- txc = True;
+ txc = True
else:
print("TXC not present")
-# txc = False # forcing it off
+# False # forcing it off
output(txLed, 1)
sleep(1)
output(txLed, 0)
@@ -276,8 +267,6 @@ battery_saver_check()
# print(1)
print(txLed)
-# GPIO.setup(27, GPIO.OUT)
-# GPIO.output(27, 0)
debug_mode = 0 # change to 1 to debug transmit
@@ -308,7 +297,7 @@ if __name__ == "__main__":
print("Pi Zero 2 not detected")
try:
- system("cat /proc/uptime > /home/pi/CubeSatSim/uptime")
+ system("sudo cat /proc/uptime > /home/pi/CubeSatSim/uptime")
file = open("/home/pi/CubeSatSim/uptime")
up = file.read().split(" ")[0]
print(up)
@@ -346,6 +335,9 @@ if __name__ == "__main__":
print("Can't open beacon_off file, defaulting to False")
print("Command_tx: ")
print(command_tx)
+
+ if (mode != "p") or (command_tx == False):
+ system("sudo systemctl stop pacsatsim")
try:
file = open("/home/pi/CubeSatSim/command_count.txt", "r")
@@ -383,18 +375,6 @@ if __name__ == "__main__":
sim_config = True
print("Simulated telemetry mode is configured")
else:
-# query = ["timeout", "2", "i2cdetect", "-y", "3"] # Test if Solar board is present
-# try:
-# result = subprocess.run(query, capture_output=True, text=True, check=True)
-# print(f"Command run was: {query}")
-# print("Sucess!")
-# print(f"Output of the command (stdout): {result}")
-# except subprocess.CalledProcessError as e:
-# print(f"Command failed with return code: {e.returncode}")
-# print(f"Command run was: {e.cmd}")
-# print(f"Output of the command (stdout): {e.stdout}")
-# print(f"Error output of the command (stderr): {e.stderr}")
-
try:
if path.isfile("/home/pi/CubeSatSim/sim_mode_auto"):
print("Simulated telemetry mode automatically turned on!")
@@ -403,11 +383,10 @@ if __name__ == "__main__":
except:
if (debug_mode == 1):
print("/home/pi/CubeSatSim/sim_mode_auto not found")
- 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) > 5:
+ if (mode != 'p') and (mode != 'P'): # squelch off for Pacsat
+ sq = config[5]
+ print(f'squelch: {sq}')
if len(config) > 6:
txf = float(config[6])
if (mode == 'e'):
@@ -457,29 +436,23 @@ if __name__ == "__main__":
no_command = True
try:
f = open("/home/pi/CubeSatSim/command_control", "r")
+ no_command = False
f.close()
-# GPIO.setmode(GPIO.BCM)
-# GPIO.setwarnings(False)
- setup(squelch, "up") ## pull up in case pin is not connected
- if input(squelch) == False:
- print("squelch not set correctly, no command input!")
- else:
- 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
+# setup(squelch, "up") ## pull up in case pin is not connected
+# if input(squelch) == False:
+# print("squelch not set correctly, no command input!")
+# else:
+# 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")
-
print(callsign)
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
-# print(txLed)
-# print(1)
-# setup(txLed, "out")
query = ["grep", "VERSION_CODENAME=bullseye", "/etc/os-release"]
try:
@@ -546,9 +519,7 @@ if __name__ == "__main__":
if (hab_mode == True) and (mode == 'a'):
print("Don't transmit CW ID since APRS HAB mode is active")
else:
- if (((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False)) or ((mode == 'e') and (command_tx == True)): # battery_saver_mode
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
+ if (((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j') or (mode == 'p') or (mode == 'P')) and (command_tx == True) and (skip == False)) or ((mode == 'e') and (command_tx == True)): # battery_saver_mode
output(txLed, 1)
print("Transmit CW ID")
status = ""
@@ -572,14 +543,57 @@ 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') or (mode == 'P'):
+ if (mode == 'P'):
+ print("Pacsat Ground Station")
+ else:
+ print("Pacsat")
+ if (command_tx == True):
+ system("sudo systemctl restart pacsatsim")
+ print("Starting PacSatSim")
+ output(txLed, 0)
+ print("0")
+ rpitx = "arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1 &"
+ stop_rpitx = "sudo killall -9 rpitx && sudo killall -9 arecord && sudo rpitx -m RF -f 434.9e3 > /dev/null 2>&1"
+ if not txc:
+ print("txc is:")
+ print(txc)
+ system(stop_rpitx)
+ system(rpitx)
+ print("Safe Mode!!")
+ while (True):
+ if (txc):
+ sleep(0.1)
+ while (input(ptt) != 0):
+ sleep(0.2)
+ output(txLed, 1)
+# print("1")
+ while (input(ptt) != 1):
+ sleep(0.2)
+ output(txLed, 0)
+# print("0")
+ else:
+# sleep(0.1)
+ while (input(17) == 0):
+ sleep(0.05)
+## system(rpitx)
+ output(txLed, 1)
+# print("1")
+ while (input(17) == 1):
+ sleep(0.05)
+## system(stop_rpitx)
+ output(txLed, 0)
+# print("0")
+
+# sleep(10)
+
else:
-# GPIO.output(powerPin, 0)
print("Transmit APRS Commands")
system("sudo systemctl stop command")
# while True:
@@ -596,8 +610,6 @@ if __name__ == "__main__":
system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1")
system("cat /home/pi/CubeSatSim/t.txt")
if (command_tx == True):
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
# output(pd, 1)
# output (ptt, 0)
@@ -610,7 +622,7 @@ if __name__ == "__main__":
sleep(0.1) # add delay before transmit
output (ptt, 0)
sleep(0.3) # add even more time at start
- system("aplay -D plughw:CARD=" + card + ",DEV=0 /home/pi/CubeSatSim/telem.wav")
+ system("aplay -D plughw:CARD=" + card + ",DEV=0 /home/pi/CubeSatSim/telem.wav")
sleep(0.2) # add more time at end
output (ptt, 1)
# output(pd, 0)
@@ -654,8 +666,6 @@ if __name__ == "__main__":
system(command)
## chan = chan + 1
if (command_tx == True):
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
if (txc):
@@ -671,7 +681,7 @@ if __name__ == "__main__":
if (debug_mode == 1):
system("cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3")
else:
- system("cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1")
+ system("cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1")
output(txLed, 0)
# command_control_check()
@@ -694,7 +704,7 @@ if __name__ == "__main__":
if os_status == "bookworm":
system("rpicam-still -o /home/pi/CubeSatSim/camera_out.jpg --width 320 --height 256") # > /dev/null 2>&1")
else:
- system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256")
+ system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256")
f = open("/home/pi/CubeSatSim/camera_out.jpg")
f.close()
print("Camera present")
@@ -718,8 +728,6 @@ if __name__ == "__main__":
if (command_tx == True):
print ("Sending SSTV image")
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
# battery_saver_check()
@@ -751,8 +759,6 @@ if __name__ == "__main__":
if (command_tx == True):
print ("Sending SSTV image")
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
# battery_saver_check()
@@ -789,8 +795,6 @@ if __name__ == "__main__":
if (command_tx == True):
print ("Sending SSTV image")
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
# battery_saver_check()
@@ -827,8 +831,6 @@ if __name__ == "__main__":
if (command_tx == True):
print ("Sending SSTV image")
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
# battery_saver_check()
@@ -858,8 +860,6 @@ if __name__ == "__main__":
if (command_tx == True):
# command_control_check()
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
# battery_saver_check()
@@ -888,9 +888,6 @@ if __name__ == "__main__":
print("turn on FM rx")
output(pd, 1)
output(ptt, 1)
-
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
-# setup(txLed, "out")
if (command_tx == True):
# system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &")
@@ -909,11 +906,7 @@ if __name__ == "__main__":
# command_control_check()
if (command_tx == True):
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
-# print(txLed)
-# print(1)
if (mode == 'b'):
sleep(4.2)
@@ -949,11 +942,7 @@ if __name__ == "__main__":
print("turn on FM rx")
output(pd, 1)
output(ptt, 1)
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
-# setup(txLed, "out")
-# GPIO.setup(powerPin, GPIO.OUT)
setup(squelch, "up") ## pull up in case pin is not connected
-# GPIO.output(powerPin, 1) # was 0
# txf = float(tx) - 288.9
# print("Transmit frequency: ",txf)
if (command_tx != True):
@@ -963,10 +952,8 @@ if __name__ == "__main__":
while True:
if (input(squelch) == False) and (command_tx == True):
print("Carrier detected, starting repeater")
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
- system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1 &")
+ system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1 &")
sleep(0.5)
system("sudo arecord -D shared_mic -r48000 -fS16_LE -c1 | nc localhost 8011 &")
while (input(squelch) == False):
@@ -988,9 +975,6 @@ if __name__ == "__main__":
output(pd, 1)
output(ptt, 1)
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
-# setup(txLed, "out")
-
if (command_tx == True):
system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 &")
print("Turning LED on/off and listening for carrier")
@@ -1003,11 +987,7 @@ if __name__ == "__main__":
# output(txLed, 0)
# command_control_check()
if (command_tx == True):
-# GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
-# setup(txLed, "out")
output(txLed, 1)
-# print(txLed)
-# print(1)
sleep(4.2)
else:
print("No Low Pass Filter so no telemetry transmit. See http://cubesatsim.org/wiki for instructions on how to build the LPF.")