Skip to content

Commit a2153e1

Browse files
Merge pull request #332 from alanbjohnston/beta-extra
Command & Control and Pi Zero 2 updates
2 parents ce9fc5c + a3276fd commit a2153e1

20 files changed

+1902
-378
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,23 @@ telem.wav
2222
cw.txt
2323
cwready
2424
logr.txt
25+
command_control
26+
command_control_direwolf
27+
command_count.txt
28+
command_tx
29+
cw0.txt
30+
cw1.txt
31+
cw2.txt
32+
cw3.txt
33+
cw4.txt
34+
cw5.txt
35+
cw6.txt
36+
logc.txt
37+
telem.txt
38+
telem_string.txt
39+
test
40+
transmit_dtmf
41+
uptime
42+
beacon_off
43+
battery_saver
44+

command

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
2+
3+
echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n"
4+
5+
FILE=/home/pi/CubeSatSim/command_control
6+
if [ -f "$FILE" ]; then
7+
echo "Radio command and control is ON"
8+
# echo "Turning Command and control to OFF"
9+
# sudo rm /home/pi/CubeSatSim/command_control
10+
# echo "rebooting"
11+
# sudo systemctl stop rpitx
12+
# sudo reboot now
13+
# fi
14+
15+
else
16+
echo "Radio command and control is OFF"
17+
18+
while true
19+
do
20+
sleep 60
21+
done
22+
23+
# exit 1
24+
fi
25+
26+
if [ "$1" = "d" ]; then
27+
28+
echo "debug mode"
29+
30+
debug=1
31+
32+
else
33+
34+
debug=0
35+
36+
fi
37+
38+
echo "Waiting 20 seconds for USB"
39+
40+
sleep 20
41+
42+
FILE=/home/pi/CubeSatSim/command_control_direwolf
43+
if [[ $(arecord -l | grep "USB Audio Device") ]] && [ -f "$FILE" ]; then
44+
45+
echo "Starting Direwolf DTMF and APRS Command and Control"
46+
47+
if [ "$debug" = "1" ]; then
48+
49+
echo "debug mode"
50+
51+
direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
52+
53+
else
54+
55+
direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
56+
57+
fi
58+
else
59+
60+
if [ -f "$FILE" ]; then
61+
62+
echo "Direwolf mode set but no USB soundcard detected!"
63+
64+
# echo "Trying RTL-FM"
65+
66+
timeout 1 rtl_test &> out.txt
67+
if [[ $(grep "No supported" out.txt) ]] ; then
68+
69+
echo "No RTL-SDR detected. Command and control is OFF"
70+
# sleep 60
71+
exit
72+
73+
else
74+
75+
echo "RTL-SDR detected."
76+
sudo modprobe snd-aloop
77+
78+
value=`aplay -l | grep "Loopback"`
79+
echo "$value" > /dev/null
80+
set -- $value
81+
82+
rtl_fm -M fm -f 435M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1 &
83+
84+
if [ "$debug" = "1" ]; then
85+
86+
echo "debug mode"
87+
88+
direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
89+
90+
else
91+
92+
direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
93+
94+
fi
95+
96+
sleep 5
97+
fi
98+
rm out.txt
99+
else
100+
101+
echo "Starting Carrier (squelch) Command and Control"
102+
103+
fi
104+
105+
if [ "$1" = "d" ]; then
106+
107+
echo "debug mode"
108+
109+
python3 /home/pi/CubeSatSim/squelch_cc.py d
110+
111+
else
112+
113+
python3 /home/pi/CubeSatSim/squelch_cc.py
114+
115+
fi
116+
fi
117+
118+
sudo killall -9 direwolf &>/dev/null
119+
sudo killall -9 rtl_fm &>/dev/null
120+

0 commit comments

Comments
 (0)