From 81331610d9a9343dbaecf080c16d242dbfe9da08 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 May 2024 21:56:20 -0400 Subject: [PATCH 001/402] Update rpitx.py rx on all time for aprs --- rpitx.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rpitx.py b/rpitx.py index 01be5490..418298e9 100644 --- a/rpitx.py +++ b/rpitx.py @@ -428,7 +428,8 @@ if __name__ == "__main__": # print("There are arguments!") if (mode == 'a'): command_control_check() -# output(pd, 1) + output(pd, 1) + output(ptt, 1) print("AFSK") while True: try: @@ -446,14 +447,14 @@ if __name__ == "__main__": # # battery_saver_check() if (txc): - output(pd, 1) +# output(pd, 1) sleep(0.1) # add delay before transmit output (ptt, 0) sleep(0.3) # add even more time at start system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/telem.wav") sleep(0.2) # add more time at end output (ptt, 1) - output(pd, 0) +# output(pd, 0) else: if (debug_mode == 1): system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/telem.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") From c1495b0413b646c7639cd9d0a31ac494bdd2ea25 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 May 2024 21:57:22 -0400 Subject: [PATCH 002/402] Create direwolf-cc.conf --- direwolf-cc.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 direwolf-cc.conf diff --git a/direwolf-cc.conf b/direwolf-cc.conf new file mode 100644 index 00000000..376b3c4b --- /dev/null +++ b/direwolf-cc.conf @@ -0,0 +1 @@ +ADEVICE hw:CARD=Device,DEV=0 default From e2b4d173211354f5e68240dede421cffe7d53256 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 May 2024 22:16:56 -0400 Subject: [PATCH 003/402] Update rpitx.py don't turn off rx after carrier check --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 418298e9..dbf0c363 100644 --- a/rpitx.py +++ b/rpitx.py @@ -52,7 +52,7 @@ def command_control_check(): # system("echo > command_tx False") else: print("No carrier received!") - output(pd, 0) +# output(pd, 0) # sleep(1) From 6e323d1ec6a0656e17cdcda574ca4cf16ad9fb22 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 May 2024 22:24:22 -0400 Subject: [PATCH 004/402] Update rpitx.py just enable rx for aprs --- rpitx.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpitx.py b/rpitx.py index dbf0c363..c588d018 100644 --- a/rpitx.py +++ b/rpitx.py @@ -431,6 +431,8 @@ if __name__ == "__main__": output(pd, 1) output(ptt, 1) print("AFSK") + while True: + sleep(0.1) while True: try: f = open("/home/pi/CubeSatSim/ready") From e33d9fe62c0b39909eb9eec1b52897e899448729 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 May 2024 22:32:11 -0400 Subject: [PATCH 005/402] Update rpitx.py reenable transmit --- rpitx.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpitx.py b/rpitx.py index c588d018..c6fdd07a 100644 --- a/rpitx.py +++ b/rpitx.py @@ -81,7 +81,7 @@ def increment_mode(): file.close() print("Mode is: ") print(mode) - if (mode == 'a'): + if (mode == ): mode = 'f' GPIO.output(powerPin, 0) # blink two times sleep(0.1) @@ -149,7 +149,7 @@ def increment_mode(): GPIO.output(powerPin, 1) sleep(2.5) else: - mode = 'a' + mode = GPIO.output(powerPin, 0) # blink one time sleep(0.1) GPIO.output(powerPin, 1) @@ -392,7 +392,7 @@ if __name__ == "__main__": command_control_check() -# if (mode != 'a') and (command_tx == True): +# if (mode != ) and (command_tx == True): # if (command_tx == True): if (mode != 'm'): # battery_saver_mode @@ -431,8 +431,8 @@ if __name__ == "__main__": output(pd, 1) output(ptt, 1) print("AFSK") - while True: - sleep(0.1) +# while True: +# sleep(0.1) while True: try: f = open("/home/pi/CubeSatSim/ready") From 376656a9fdfc04557c98af004d933dc95e9ec8d8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 May 2024 22:33:41 -0400 Subject: [PATCH 006/402] Update rpitx.py typo --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index c6fdd07a..78e3c06c 100644 --- a/rpitx.py +++ b/rpitx.py @@ -81,7 +81,7 @@ def increment_mode(): file.close() print("Mode is: ") print(mode) - if (mode == ): + if (mode == 'a'): mode = 'f' GPIO.output(powerPin, 0) # blink two times sleep(0.1) From 33a9d164bef1a7eb58164bad0ead8f230e35d46b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 May 2024 22:35:16 -0400 Subject: [PATCH 007/402] Update rpitx.py another typo --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 78e3c06c..7b9981b1 100644 --- a/rpitx.py +++ b/rpitx.py @@ -149,7 +149,7 @@ def increment_mode(): GPIO.output(powerPin, 1) sleep(2.5) else: - mode = + mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) GPIO.output(powerPin, 1) From e2449d4ceb272cf01623c6c89b1124e9bd9f2258 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 30 May 2024 23:20:07 -0400 Subject: [PATCH 008/402] Update rpitx.py enable rx all the time for all modes --- rpitx.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/rpitx.py b/rpitx.py index 7b9981b1..90707180 100644 --- a/rpitx.py +++ b/rpitx.py @@ -481,7 +481,8 @@ if __name__ == "__main__": print("CW") while True: command_control_check() - + output (pd, 1) + output (ptt, 1) try: f = open("/home/pi/CubeSatSim/cwready") f.close() @@ -496,7 +497,7 @@ if __name__ == "__main__": output(txLed, txLedOn) if (txc): - output (pd, 1) +# output (pd, 1) sleep(0.3) output (ptt, 0) system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav") @@ -519,6 +520,8 @@ if __name__ == "__main__": elif (mode == 's'): print("SSTV") command_control_check() + output (ptt, 1) + output(pd, 1) try: # from picamera import PiCamera # from pysstv.sstv import SSTV @@ -552,11 +555,11 @@ if __name__ == "__main__": # battery_saver_check() if (txc): - output(pd, 1) +# output(pd, 1) output (ptt, 0) system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav") output (ptt, 1) - output(pd, 0) +# output(pd, 0) else: if (debug_mode == 1): system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3") @@ -610,11 +613,11 @@ if __name__ == "__main__": # battery_saver_check() if (txc): - output(pd, 1) +# output(pd, 1) output (ptt, 0) system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/camera_out.jpg.wav") output(ptt, 1) - output (pd, 0) +# output (pd, 0) else: if (debug_mode == 1): system("cat /home/pi/CubeSatSim/camera_out.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3") @@ -645,11 +648,11 @@ if __name__ == "__main__": # battery_saver_check() if (txc): - output(pd, 1) +# output(pd, 1) output (ptt, 0) system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav") output(ptt, 1) - output (pd, 0) +# output (pd, 0) else: if (debug_mode == 1): system("cat /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3") @@ -679,11 +682,11 @@ if __name__ == "__main__": # battery_saver_check() if (txc): - output(pd, 1) +# output(pd, 1) output (ptt, 0) system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav") output(ptt, 1) - output (pd, 0) +# output (pd, 0) else: if (debug_mode == 1): system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3") @@ -706,11 +709,11 @@ if __name__ == "__main__": # battery_saver_check() if (txc): - output(pd, 1) +# output(pd, 1) output (ptt, 0) system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv.wav") output(ptt, 1) - output (pd, 0) +# output (pd, 0) else: sleep(60) From 9c97ccbb400e997632e8f614647f0aaafce4e306 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 08:44:49 -0400 Subject: [PATCH 009/402] create command script --- command | 266 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100755 command diff --git a/command b/command new file mode 100755 index 00000000..b6a45720 --- /dev/null +++ b/command @@ -0,0 +1,266 @@ +#!/bin/bash + +echo -e "\ninstallation script for CubeSatSim v1.3.2\n" + +FILE=/home/pi/CubeSatSim/sim.cfg +if [ -f "$FILE" ]; then + echo "$FILE exists." +else + echo "creating $FILE" + echo "AMSAT 1 0.0 0.0" > /home/pi/CubeSatSim/sim.cfg +fi + +FILE=/home/pi/CubeSatSim/command_tx +if [ -f "$FILE" ]; then + echo "$FILE exists." +else + echo "creating $FILE" + echo "True\n" > /home/pi/CubeSatSim/command_tx +fi + +FILE=/home/pi/CubeSatSim/command_count.txt +if [ -f "$FILE" ]; then + echo "$FILE exists." +else + echo "creating $FILE" + echo "0\n" > /home/pi/CubeSatSim/command_count.txt +fi + +cd + +CubeSatSim/config -c -n + +CubeSatSim/config -l -n + +sudo apt-get update && sudo apt-get dist-upgrade -y + +# removed wiringpi and python-picamera python3-picamera +sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev minicom + +cd /tmp + +wget https://project-downloads.drogon.net/wiringpi-latest.deb + +sudo dpkg -i wiringpi-latest.deb + + +cd + +#changed to python3-smbus +sudo apt install -y python3-pip python3-smbus + +sudo pip3 install --upgrade setuptools + +sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 + + + +cd ~/CubeSatSim + +git pull --no-rebase + +make debug + +FILE=/home/pi/CubeSatSim/.mode +if [ -f "$FILE" ]; then + echo "$FILE exists." +else + echo "creating $FILE" + echo "f" > .mode +fi + +cd + +git clone https://github.com/alanbjohnston/direwolf.git + +cd direwolf + +make -j + +sudo make install + +make install-rpi + + +cd + +git clone https://github.com/alanbjohnston/pi-power-button.git + +cd pi-power-button + +git checkout reboot-mode-change + +./script/install + + +cd + +git clone https://github.com/alanbjohnston/PiSSTVpp.git + +cd PiSSTVpp + +make pisstvpp + +echo "Copying SSTV image 1" +cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg + +echo "Copying SSTV image 2" +cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg + +cd + +git clone https://github.com/alanbjohnston/rpitx.git + +cd rpitx + +./install.sh + + +cd + +cd + +sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service + +sudo systemctl enable cubesatsim + +sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service + +sudo systemctl enable rpitx + +sudo cp /boot/config.txt /boot/config.txt.0 + +sudo cp /boot/cmdline.txt /boot/cmdline.txt.0 + + +sudo raspi-config nonint do_i2c 0 + +sudo raspi-config nonint do_camera 0 + +sudo raspi-config nonint do_legacy 0 + +#if [ "$1" = "u" ]; then +#fi + +## sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt + + + 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/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt + + if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/config.txt) ]]; then + echo "dtoverlay=i2c-gpio already in /boot/config.txt" + else + echo "adding dtoverlay=i2c-gpio to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24" >> /boot/config.txt' + fi + + if [[ $(grep 'enable_uart=1' /boot/config.txt) ]]; then + echo "enable_uart=1 already in /boot/config.txt" + else + echo "adding enable_uart=1 to /boot/config.txt" + sudo sh -c 'echo "\nenable_uart=1" >> /boot/config.txt' + fi + + if [[ $(grep 'dtoverlay=disable-bt' /boot/config.txt) ]]; then + echo "dtoverlay=disable-bt already in /boot/config.txt" + else + echo "adding dtoverlay=disable-bt to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=disable-bt" >> /boot/config.txt' + fi + + if [[ $(grep 'dtoverlay=dwc2' /boot/config.txt) ]]; then + echo "dtoverlay=dwc2 aalready in /boot/config.txt" + else + echo "adding dtoverlay=dwc2 to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=dwc2" >> /boot/config.txt' + fi + + if [[ $(grep 'modules-load=dwc2,g_ether' /boot/cmdline.txt) ]]; then + echo "modules-load=dwc2,g_ether already in /boot/cmdline.txt" + else + echo "adding modules-load=dwc2,g_ether to /boot/cmdline.txt" + sudo sed -i 's/ rootwait/ rootwait modules-load=dwc2,g_ether/g' /boot/cmdline.txt + fi + + if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then + echo "dtparam=audio=on already in /boot/config.txt" + else + echo "adding dtparam=audio=on to /boot/config.txt" + sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt' + fi + + if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then + echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt" + else + echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt' + fi + + if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then + echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt" + else + echo "adding to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt' + fi + + if [[ $(grep 'disable_splash=1 ' /boot/config.txt) ]]; then + echo "disable_splash=1 already in /boot/config.txt" + else + echo "adding to /boot/config.txt" + sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt' + fi + + if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then + echo "boot_delay=0 already in /boot/config.txt" + else + echo "adding to /boot/config.txt" + sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt' + fi + + if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi + +sudo sh -c 'echo "\n" >> /boot/config.txt' + +changed=0 +value=`cat /home/pi/CubeSatSim/sim.cfg` +echo "$value" > /dev/null +set -- $value + +if [ -z "$1" ] ; then n1="AMSAT" ; changed=1 ; else n1=$1 ; fi # callsign +if [ -z "$2" ] ; then n2="0" ; changed=1 ; else n2=$2 ; fi # reset count +if [ -z "$3" ] ; then n3="0" ; changed=1 ; else n3=$3 ; fi # lat +if [ -z "$4" ] ; then n4="0" ; changed=1 ; else n4=$4 ; fi # lon +if [ -z "$5" ] ; then n5="no" ; changed=1 ; else n5=$5 ; fi # sim mode +if [ -z "$6" ] ; then n6="3" ; changed=1 ; else n6=$6 ; fi # squelch +if [ -z "$7" ] ; then n7="434.9000" ; changed=1 ; else n7=$7 ; fi # transmit frequency +if [ -z "$8" ] ; then n8="435.0000" ; changed=1 ; else n8=$8 ; fi # receive frequency +if [ -z "$9" ] ; then n9="no" ; changed=1 ; else n9=$9 ; fi # hab mode + +if [ $changed -eq 1 ]; then + echo -e "Current sim.cfg configuration file:" + echo + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 + echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" + echo + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 > /home/pi/CubeSatSim/sim.cfg + echo +fi + +echo "Would you like to reboot to complete the installation (y/n)?" + +read -r ANS + +if [ "$ANS" = "y" ]; then + + sudo reboot now + +else + + echo "The CubeSatSim software will start next time you reboot" + +fi From cbbbfc154df949299e731ecd02c7bf70f91aa884 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 08:55:35 -0400 Subject: [PATCH 010/402] Update command to turn c&c off and run direwolf --- command | 275 ++++---------------------------------------------------- 1 file changed, 16 insertions(+), 259 deletions(-) diff --git a/command b/command index b6a45720..409666d1 100755 --- a/command +++ b/command @@ -1,266 +1,23 @@ #!/bin/bash -echo -e "\ninstallation script for CubeSatSim v1.3.2\n" +echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" -FILE=/home/pi/CubeSatSim/sim.cfg -if [ -f "$FILE" ]; then - echo "$FILE exists." -else - echo "creating $FILE" - echo "AMSAT 1 0.0 0.0" > /home/pi/CubeSatSim/sim.cfg -fi + FILE=/home/pi/CubeSatSim/command_control + if [ -f "$FILE" ]; then + echo "Radio command and control is ON" + echo "Turning Command and control to OFF" + sudo rm /home/pi/CubeSatSim/command_control + echo "rebooting" + sudo systemctl stop rpitx + sudo reboot now + fi -FILE=/home/pi/CubeSatSim/command_tx -if [ -f "$FILE" ]; then - echo "$FILE exists." -else - echo "creating $FILE" - echo "True\n" > /home/pi/CubeSatSim/command_tx -fi + else + echo "Radio command and control is OFF" + fi -FILE=/home/pi/CubeSatSim/command_count.txt -if [ -f "$FILE" ]; then - echo "$FILE exists." -else - echo "creating $FILE" - echo "0\n" > /home/pi/CubeSatSim/command_count.txt -fi +echo "Starting direwolf" -cd +direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -CubeSatSim/config -c -n - -CubeSatSim/config -l -n - -sudo apt-get update && sudo apt-get dist-upgrade -y - -# removed wiringpi and python-picamera python3-picamera -sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev minicom - -cd /tmp - -wget https://project-downloads.drogon.net/wiringpi-latest.deb - -sudo dpkg -i wiringpi-latest.deb - - -cd - -#changed to python3-smbus -sudo apt install -y python3-pip python3-smbus - -sudo pip3 install --upgrade setuptools - -sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 - - - -cd ~/CubeSatSim - -git pull --no-rebase - -make debug - -FILE=/home/pi/CubeSatSim/.mode -if [ -f "$FILE" ]; then - echo "$FILE exists." -else - echo "creating $FILE" - echo "f" > .mode -fi - -cd - -git clone https://github.com/alanbjohnston/direwolf.git - -cd direwolf - -make -j - -sudo make install - -make install-rpi - - -cd - -git clone https://github.com/alanbjohnston/pi-power-button.git - -cd pi-power-button - -git checkout reboot-mode-change - -./script/install - - -cd - -git clone https://github.com/alanbjohnston/PiSSTVpp.git - -cd PiSSTVpp - -make pisstvpp - -echo "Copying SSTV image 1" -cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg - -echo "Copying SSTV image 2" -cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg - -cd - -git clone https://github.com/alanbjohnston/rpitx.git - -cd rpitx - -./install.sh - - -cd - -cd - -sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service - -sudo systemctl enable cubesatsim - -sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service - -sudo systemctl enable rpitx - -sudo cp /boot/config.txt /boot/config.txt.0 - -sudo cp /boot/cmdline.txt /boot/cmdline.txt.0 - - -sudo raspi-config nonint do_i2c 0 - -sudo raspi-config nonint do_camera 0 - -sudo raspi-config nonint do_legacy 0 - -#if [ "$1" = "u" ]; then -#fi - -## sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt - - - 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/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt - - if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/config.txt) ]]; then - echo "dtoverlay=i2c-gpio already in /boot/config.txt" - else - echo "adding dtoverlay=i2c-gpio to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24" >> /boot/config.txt' - fi - - if [[ $(grep 'enable_uart=1' /boot/config.txt) ]]; then - echo "enable_uart=1 already in /boot/config.txt" - else - echo "adding enable_uart=1 to /boot/config.txt" - sudo sh -c 'echo "\nenable_uart=1" >> /boot/config.txt' - fi - - if [[ $(grep 'dtoverlay=disable-bt' /boot/config.txt) ]]; then - echo "dtoverlay=disable-bt already in /boot/config.txt" - else - echo "adding dtoverlay=disable-bt to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=disable-bt" >> /boot/config.txt' - fi - - if [[ $(grep 'dtoverlay=dwc2' /boot/config.txt) ]]; then - echo "dtoverlay=dwc2 aalready in /boot/config.txt" - else - echo "adding dtoverlay=dwc2 to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=dwc2" >> /boot/config.txt' - fi - - if [[ $(grep 'modules-load=dwc2,g_ether' /boot/cmdline.txt) ]]; then - echo "modules-load=dwc2,g_ether already in /boot/cmdline.txt" - else - echo "adding modules-load=dwc2,g_ether to /boot/cmdline.txt" - sudo sed -i 's/ rootwait/ rootwait modules-load=dwc2,g_ether/g' /boot/cmdline.txt - fi - - if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then - echo "dtparam=audio=on already in /boot/config.txt" - else - echo "adding dtparam=audio=on to /boot/config.txt" - sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt' - fi - - if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then - echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt" - else - echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt' - fi - - if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then - echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt" - else - echo "adding to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt' - fi - - if [[ $(grep 'disable_splash=1 ' /boot/config.txt) ]]; then - echo "disable_splash=1 already in /boot/config.txt" - else - echo "adding to /boot/config.txt" - sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt' - fi - - if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then - echo "boot_delay=0 already in /boot/config.txt" - else - echo "adding to /boot/config.txt" - sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt' - fi - - if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - -sudo sh -c 'echo "\n" >> /boot/config.txt' - -changed=0 -value=`cat /home/pi/CubeSatSim/sim.cfg` -echo "$value" > /dev/null -set -- $value - -if [ -z "$1" ] ; then n1="AMSAT" ; changed=1 ; else n1=$1 ; fi # callsign -if [ -z "$2" ] ; then n2="0" ; changed=1 ; else n2=$2 ; fi # reset count -if [ -z "$3" ] ; then n3="0" ; changed=1 ; else n3=$3 ; fi # lat -if [ -z "$4" ] ; then n4="0" ; changed=1 ; else n4=$4 ; fi # lon -if [ -z "$5" ] ; then n5="no" ; changed=1 ; else n5=$5 ; fi # sim mode -if [ -z "$6" ] ; then n6="3" ; changed=1 ; else n6=$6 ; fi # squelch -if [ -z "$7" ] ; then n7="434.9000" ; changed=1 ; else n7=$7 ; fi # transmit frequency -if [ -z "$8" ] ; then n8="435.0000" ; changed=1 ; else n8=$8 ; fi # receive frequency -if [ -z "$9" ] ; then n9="no" ; changed=1 ; else n9=$9 ; fi # hab mode - -if [ $changed -eq 1 ]; then - echo -e "Current sim.cfg configuration file:" - echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 - echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 > /home/pi/CubeSatSim/sim.cfg - echo -fi - -echo "Would you like to reboot to complete the installation (y/n)?" - -read -r ANS - -if [ "$ANS" = "y" ]; then - - sudo reboot now - -else - - echo "The CubeSatSim software will start next time you reboot" - -fi + From c001819db72fb4f024f0a6930ee11545fbb7c93e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 08:56:20 -0400 Subject: [PATCH 011/402] Update command typo --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index 409666d1..1a7800be 100755 --- a/command +++ b/command @@ -10,7 +10,7 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" echo "rebooting" sudo systemctl stop rpitx sudo reboot now - fi +# fi else echo "Radio command and control is OFF" From bd8f311f0c14e2b4a06f2d81069f053bb326fafe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:11:29 -0400 Subject: [PATCH 012/402] Create aprs_in.py to read aprs from direwolf --- aprs_in.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 aprs_in.py diff --git a/aprs_in.py b/aprs_in.py new file mode 100644 index 00000000..bb8d56dc --- /dev/null +++ b/aprs_in.py @@ -0,0 +1,20 @@ +import sys +from os import system + +for line in sys.stdin: + if '^c' == line.rstrip(): + break +# print(line) + if (line.find("MODE=a")) > 0: + system("echo 'APRS Mode!!'") + mode = 'a' + change_mode = True + if (line.find("MODE=f")) > 0: + system("echo 'FSK Mode!!'") + if (line.find("MODE=b")) > 0: + system("echo 'BPSK Mode!!'") + if (line.find("MODE=s")) > 0: + system("echo 'SSTV Mode!!'") + if (line.find("MODE=m")) > 0: + system("echo 'CW Mode!!'") +print("Done") From 8d79171bf47c890b467c68b2993351c1f4a26d0e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:21:10 -0400 Subject: [PATCH 013/402] Update aprs_in.py add change mode if not debug --- aprs_in.py | 58 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index bb8d56dc..fc5f9bb2 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -1,20 +1,44 @@ import sys from os import system -for line in sys.stdin: - if '^c' == line.rstrip(): - break -# print(line) - if (line.find("MODE=a")) > 0: - system("echo 'APRS Mode!!'") - mode = 'a' - change_mode = True - if (line.find("MODE=f")) > 0: - system("echo 'FSK Mode!!'") - if (line.find("MODE=b")) > 0: - system("echo 'BPSK Mode!!'") - if (line.find("MODE=s")) > 0: - system("echo 'SSTV Mode!!'") - if (line.find("MODE=m")) > 0: - system("echo 'CW Mode!!'") -print("Done") +if __name__ == "__main__": + + change_mode = False + if (len(sys.argv)) > 1: +# print("There are arguments!") + if (('d' == sys.argv[1]): + debug_mode = 1 + try: + for line in sys.stdin: + if (debug_mode): + print(line) + +# if '^c' == line.rstrip(): +# break + + if (line.find("MODE=a")) > 0: + system("echo 'APRS Mode!!'") + mode = 'a' + change_mode = True + if (line.find("MODE=f")) > 0: + system("echo 'FSK Mode!!'") + mode = 'f' + change_mode = True + if (line.find("MODE=b")) > 0: + system("echo 'BPSK Mode!!'") + mode = 'b' + change_mode = True + if (line.find("MODE=s")) > 0: + system("echo 'SSTV Mode!!'") + mode = 's' + change_mode = True + if (line.find("MODE=m")) > 0: + system("echo 'CW Mode!!'") + mode = 'm' + change_mode = True + if (debug_mode == True) and (change_mode == True): + print("/home/pi/CubeSatSim/config -" + mode) + system("/home/pi/CubeSatSim/config -" + mode) + change_mode = False + except: + print("Done") From 541cd2a8d1370d2c1760064f1db07f11a6a28210 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:21:46 -0400 Subject: [PATCH 014/402] Update aprs_in.py typo --- aprs_in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index fc5f9bb2..3b43e316 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -6,7 +6,7 @@ if __name__ == "__main__": change_mode = False if (len(sys.argv)) > 1: # print("There are arguments!") - if (('d' == sys.argv[1]): + if ('d' == sys.argv[1]): debug_mode = 1 try: for line in sys.stdin: From 7f73b5d0965d00d6f2eadfc4b51f4e9cbcc56c3a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:23:31 -0400 Subject: [PATCH 015/402] Update aprs_in.py remove try/except --- aprs_in.py | 63 +++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index 3b43e316..ca06b104 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -8,37 +8,36 @@ if __name__ == "__main__": # print("There are arguments!") if ('d' == sys.argv[1]): debug_mode = 1 - try: - for line in sys.stdin: - if (debug_mode): - print(line) - + + for line in sys.stdin: + if (debug_mode): + print(line) + # if '^c' == line.rstrip(): # break - - if (line.find("MODE=a")) > 0: - system("echo 'APRS Mode!!'") - mode = 'a' - change_mode = True - if (line.find("MODE=f")) > 0: - system("echo 'FSK Mode!!'") - mode = 'f' - change_mode = True - if (line.find("MODE=b")) > 0: - system("echo 'BPSK Mode!!'") - mode = 'b' - change_mode = True - if (line.find("MODE=s")) > 0: - system("echo 'SSTV Mode!!'") - mode = 's' - change_mode = True - if (line.find("MODE=m")) > 0: - system("echo 'CW Mode!!'") - mode = 'm' - change_mode = True - if (debug_mode == True) and (change_mode == True): - print("/home/pi/CubeSatSim/config -" + mode) - system("/home/pi/CubeSatSim/config -" + mode) - change_mode = False - except: - print("Done") + + if (line.find("MODE=a")) > 0: + system("echo 'APRS Mode!!'") + mode = 'a' + change_mode = True + if (line.find("MODE=f")) > 0: + system("echo 'FSK Mode!!'") + mode = 'f' + change_mode = True + if (line.find("MODE=b")) > 0: + system("echo 'BPSK Mode!!'") + mode = 'b' + change_mode = True + if (line.find("MODE=s")) > 0: + system("echo 'SSTV Mode!!'") + mode = 's' + change_mode = True + if (line.find("MODE=m")) > 0: + system("echo 'CW Mode!!'") + mode = 'm' + change_mode = True + if (debug_mode == True) and (change_mode == True): + print("/home/pi/CubeSatSim/config -" + mode) + system("/home/pi/CubeSatSim/config -" + mode) + change_mode = False + print("Done") From e737ad080953fbe6d2072b3de3c1abfb6f0df91a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:24:09 -0400 Subject: [PATCH 016/402] Update aprs_in.py fix debug --- aprs_in.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index ca06b104..fff2e8a6 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -4,10 +4,11 @@ from os import system if __name__ == "__main__": change_mode = False + debug_mode = False if (len(sys.argv)) > 1: # print("There are arguments!") if ('d' == sys.argv[1]): - debug_mode = 1 + debug_mode = True for line in sys.stdin: if (debug_mode): From e5d065b67fc0a4d7f2a9c4b863b02b08a6ee4b3b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:33:58 -0400 Subject: [PATCH 017/402] Update aprs_in.py don't reboot in debug mode --- aprs_in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index fff2e8a6..a049655f 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -37,7 +37,7 @@ if __name__ == "__main__": system("echo 'CW Mode!!'") mode = 'm' change_mode = True - if (debug_mode == True) and (change_mode == True): + if (debug_mode == False) and (change_mode == True): print("/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode) change_mode = False From 5d4236d07c06030ddd7787b72800d011e16287a6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:37:09 -0400 Subject: [PATCH 018/402] Update aprs_in.py no newline in print --- aprs_in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index a049655f..c74fcd1f 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -12,7 +12,7 @@ if __name__ == "__main__": for line in sys.stdin: if (debug_mode): - print(line) + print(line, end =" ") # if '^c' == line.rstrip(): # break From be86532b1527c45ba271ab64378a0569c219dec2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:38:07 -0400 Subject: [PATCH 019/402] Update aprs_in.py add extra \n --- aprs_in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index c74fcd1f..e4844dda 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -26,7 +26,7 @@ if __name__ == "__main__": mode = 'f' change_mode = True if (line.find("MODE=b")) > 0: - system("echo 'BPSK Mode!!'") + system("echo '\nBPSK Mode!!\n'") mode = 'b' change_mode = True if (line.find("MODE=s")) > 0: From 9ecb0af92b54a452220eb6bccaaf40d20533bea4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:41:04 -0400 Subject: [PATCH 020/402] Update aprs_in.py extra newlines everywhere --- aprs_in.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index e4844dda..363907ac 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -18,11 +18,11 @@ if __name__ == "__main__": # break if (line.find("MODE=a")) > 0: - system("echo 'APRS Mode!!'") + system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True if (line.find("MODE=f")) > 0: - system("echo 'FSK Mode!!'") + system("echo '\nFSK Mode!!\n'") mode = 'f' change_mode = True if (line.find("MODE=b")) > 0: @@ -30,15 +30,15 @@ if __name__ == "__main__": mode = 'b' change_mode = True if (line.find("MODE=s")) > 0: - system("echo 'SSTV Mode!!'") + system("echo '\nSSTV Mode!!\n'") mode = 's' change_mode = True if (line.find("MODE=m")) > 0: - system("echo 'CW Mode!!'") + system("echo '\nCW Mode!!\n'") mode = 'm' change_mode = True if (debug_mode == False) and (change_mode == True): - print("/home/pi/CubeSatSim/config -" + mode) + print("\n/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode) change_mode = False print("Done") From 7c569f62d302f6187db75883f2342c8f3aa819b9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 31 May 2024 15:47:59 -0400 Subject: [PATCH 021/402] Update command to use aprs_in --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index 1a7800be..71db8d2e 100755 --- a/command +++ b/command @@ -18,6 +18,6 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" echo "Starting direwolf" -direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l +direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py d From c703e3230dbe43699f77f40a8511bf6521fa4b0c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Jun 2024 11:16:53 -0400 Subject: [PATCH 022/402] Update direwolf-cc.conf added DTMF detection --- direwolf-cc.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/direwolf-cc.conf b/direwolf-cc.conf index 376b3c4b..8419355f 100644 --- a/direwolf-cc.conf +++ b/direwolf-cc.conf @@ -1 +1,2 @@ ADEVICE hw:CARD=Device,DEV=0 default +DTMF From 5e521e44e95847b6d317bbb13a5c58768223b34d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Jun 2024 11:18:18 -0400 Subject: [PATCH 023/402] Update aprs_in.py add DTMF 1# --- aprs_in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index 363907ac..d120a4d2 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -17,7 +17,7 @@ if __name__ == "__main__": # if '^c' == line.rstrip(): # break - if (line.find("MODE=a")) > 0: + if ((line.find("MODE=a")) > 0) or (line.find"Raw Touch Tone Data, DireWolf, WB2OSZ\n2#")) > 0): system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True From 35262527057788c016082963e01b571ceb291de5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Jun 2024 11:19:07 -0400 Subject: [PATCH 024/402] Update aprs_in.py typo --- aprs_in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index d120a4d2..96f39682 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -17,7 +17,7 @@ if __name__ == "__main__": # if '^c' == line.rstrip(): # break - if ((line.find("MODE=a")) > 0) or (line.find"Raw Touch Tone Data, DireWolf, WB2OSZ\n2#")) > 0): + if ((line.find("MODE=a")) > 0) or (line.find("Raw Touch Tone Data, DireWolf, WB2OSZ\n2#")) > 0): system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True From b482a26cf75ed32577a7c8d13bcf87f92da36379 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Jun 2024 11:20:19 -0400 Subject: [PATCH 025/402] Update aprs_in.py missing ( --- aprs_in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index 96f39682..198d4b16 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -17,7 +17,7 @@ if __name__ == "__main__": # if '^c' == line.rstrip(): # break - if ((line.find("MODE=a")) > 0) or (line.find("Raw Touch Tone Data, DireWolf, WB2OSZ\n2#")) > 0): + if ((line.find("MODE=a")) > 0) or ((line.find("Raw Touch Tone Data, DireWolf, WB2OSZ\n2#")) > 0): system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True From a2cf24017d061f45897ba424810b0be3c33193c0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Jun 2024 11:22:30 -0400 Subject: [PATCH 026/402] Update aprs_in.py fixed string --- aprs_in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index 198d4b16..bf51cd4f 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -17,7 +17,7 @@ if __name__ == "__main__": # if '^c' == line.rstrip(): # break - if ((line.find("MODE=a")) > 0) or ((line.find("Raw Touch Tone Data, DireWolf, WB2OSZ\n2#")) > 0): + if ((line.find("MODE=a")) > 0) or ((line.find("DTMF>APDW15:t1#")) > 0): system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True From edaf4c4dfd90bc3f8e2fc0d5b3207f572e59d102 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Jun 2024 11:24:39 -0400 Subject: [PATCH 027/402] Update aprs_in.py added all modes to dtmf control --- aprs_in.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index bf51cd4f..83331bd6 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -21,19 +21,19 @@ if __name__ == "__main__": system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True - if (line.find("MODE=f")) > 0: + if ((line.find("MODE=f")) > 0) or ((line.find("DTMF>APDW15:t2#")) > 0): system("echo '\nFSK Mode!!\n'") mode = 'f' change_mode = True - if (line.find("MODE=b")) > 0: + if ((line.find("MODE=b")) > 0) or ((line.find("DTMF>APDW15:t3#")) > 0): system("echo '\nBPSK Mode!!\n'") mode = 'b' change_mode = True - if (line.find("MODE=s")) > 0: + if ((line.find("MODE=s")) > 0) or ((line.find("DTMF>APDW15:t4#")) > 0): system("echo '\nSSTV Mode!!\n'") mode = 's' change_mode = True - if (line.find("MODE=m")) > 0: + if ((line.find("MODE=m")) > 0) or ((line.find("DTMF>APDW15:t5#")) > 0): system("echo '\nCW Mode!!\n'") mode = 'm' change_mode = True From 3776c62b093f074dc38013f82cffbc983c271d78 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 1 Jun 2024 11:27:37 -0400 Subject: [PATCH 028/402] Update command added debug mode d --- command | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/command b/command index 71db8d2e..b995446d 100755 --- a/command +++ b/command @@ -18,6 +18,15 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" echo "Starting direwolf" +if [ "$1" = "d" ]; then + +echo "debug mode" + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py d - +else + +direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py + +fi + From 43ebf41e91a93940cd13193b110c8cc48122685f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 09:38:24 -0400 Subject: [PATCH 029/402] Update install added pl codes in sim.cfg --- install | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/install b/install index b6a45720..4e3fbeed 100755 --- a/install +++ b/install @@ -239,15 +239,17 @@ if [ -z "$6" ] ; then n6="3" ; changed=1 ; else n6=$6 ; fi # squelch if [ -z "$7" ] ; then n7="434.9000" ; changed=1 ; else n7=$7 ; fi # transmit frequency if [ -z "$8" ] ; then n8="435.0000" ; changed=1 ; else n8=$8 ; fi # receive frequency if [ -z "$9" ] ; then n9="no" ; changed=1 ; else n9=$9 ; fi # hab mode +if [ -z "$10" ] ; then n10="0" ; changed=1 ; else n10=$10 ; fi # rx pl code +if [ -z "$11" ] ; then n11="0" ; changed=1 ; else n11=$11 ; fi # tx pl code if [ $changed -eq 1 ]; then echo -e "Current sim.cfg configuration file:" echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 > /home/pi/CubeSatSim/sim.cfg + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $10 $11 + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $10 $11 > /home/pi/CubeSatSim/sim.cfg echo fi From 97fcf7c3d91d521c2f044268a8fdaf6085b96df7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 09:40:05 -0400 Subject: [PATCH 030/402] Update update added pl tones --- update | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/update b/update index d39d9791..31b37d60 100755 --- a/update +++ b/update @@ -243,15 +243,17 @@ if [ -z "$6" ] ; then n6="3" ; changed=1 ; else n6=$6 ; fi # squelch if [ -z "$7" ] ; then n7="434.9000" ; changed=1 ; else n7=$7 ; fi # transmit frequency if [ -z "$8" ] ; then n8="435.0000" ; changed=1 ; else n8=$8 ; fi # receive frequency if [ -z "$9" ] ; then n9="no" ; changed=1 ; else n9=$9 ; fi # hab mode +if [ -z "$10" ] ; then n10="0" ; changed=1 ; else n10=$10 ; fi # rx pl code +if [ -z "$11" ] ; then n11="0" ; changed=1 ; else n11=$11 ; fi # tx pl code if [ $changed -eq 1 ]; then echo -e "Current sim.cfg configuration file:" echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 > /home/pi/CubeSatSim/sim.cfg + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $10 $11 + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $10 $11 > /home/pi/CubeSatSim/sim.cfg echo fi From c4c916616e08f150c4862a853a3a5232acf1429c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 10:09:39 -0400 Subject: [PATCH 031/402] Update config for PL RX and TX --- config | 119 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 97 insertions(+), 22 deletions(-) diff --git a/config b/config index 05e902d8..93d614f2 100755 --- a/config +++ b/config @@ -68,6 +68,13 @@ if [ "$1" = "" ]; then fi echo + echo -n "RX PL code is: " + echo $10 + echo + echo -n "TX PL code is: " + echo $11 + echo + FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then echo "Safe Mode! Battery saver mode is ON" @@ -79,7 +86,7 @@ if [ "$1" = "" ]; then echo -e "Current sim.cfg configuration file:" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo echo "To change, include an OPTION" @@ -185,7 +192,7 @@ elif [ "$1" = "-t" ]; then echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 +# $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo "Do you want Simulated Telemetry ON (y/n) " read sim @@ -202,8 +209,8 @@ elif [ "$1" = "-t" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $sim $6 $7 $8 $9 - echo $1 $2 $3 $4 $sim $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 + echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg echo echo "Rebooting CubeSatSim with new configuration file" echo @@ -229,7 +236,7 @@ elif [ "$1" = "-c" ]; then echo $1 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo "Enter callsign in all capitals: " read callsign @@ -243,8 +250,8 @@ elif [ "$1" = "-c" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 - echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg + echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 + echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -276,7 +283,7 @@ elif [ "$1" = "-r" ]; then echo $2 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo -e "Enter Reset Count (integer): " @@ -296,8 +303,8 @@ elif [ "$1" = "-r" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $resets $3 $4 $5 $6 $7 $8 $9 - echo $1 $resets $3 $4 $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 $10 $11 + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -330,7 +337,7 @@ elif [ "$1" = "-l" ]; then echo $3 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo -e "Enter latitude (decimal degrees, positive is north): " @@ -372,8 +379,8 @@ elif [ "$1" = "-l" ]; then fi echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $2 $lat $long $5 $6 $7 $8 $9 - echo $1 $2 $lat $long $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $lat $long $5 $6 $7 $8 $9 $10 $11 + echo $1 $2 $lat $long $5 $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg if [ "$norestart" = "1" ]; then echo @@ -548,7 +555,7 @@ elif [ "$1" = "-q" ]; then echo $6 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo -e "Enter squelch (integer 0 - 8): " @@ -570,8 +577,75 @@ elif [ "$1" = "-q" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $5 $sq $7 $8 $9 - echo $1 $2 $3 $4 $4 $sq $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $sq $7 $8 $9 $10 $11 + echo $1 $2 $3 $4 $4 $sq $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo + echo "Rebooting CubeSatSim with new configuration file" + echo + + sudo reboot now +# sudo systemctl restart cubesatsim + + +elif [ "$1" = "-P" ]; then + + echo + echo "Editing the PL (Private Line) CTCSS/CDCSS setting in" + echo "the configuration file for CubeSatSim" + echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + echo + echo "Current value of RX PL is" + echo $10 + echo "Current value of TX PL is" + echo $11 + echo + +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 + + echo -e "Enter RX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)" + + read rxpl + + if [ -z $rxpl ] ; then + + rxpl="$10" + echo "Keeping value of" $rxpl + fi + + if ! [[ $rxpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then + + echo "Error: not a number!" + rxpl="$10" + echo "Keeping value of" $rxpl + fi + + echo -e "Enter TX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)" + + read txpl + + if [ -z $txpl ] ; then + + txpl="$11" + echo "Keeping value of" $txpl + fi + + if ! [[ $txpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then + + echo "Error: not a number!" + txpl="$11" + echo "Keeping value of" $txpl + fi + +# echo + echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" +# echo + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl > /home/pi/CubeSatSim/sim.cfg echo echo "Rebooting CubeSatSim with new configuration file" echo @@ -600,7 +674,7 @@ elif [ "$1" = "-F" ]; then echo $8 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo "Enter tx frequency as 4XX.XXXX: " read tx @@ -623,8 +697,8 @@ elif [ "$1" = "-F" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $2 $3 $4 $5 $6 $tx $rx $9 - echo $1 $2 $3 $4 $5 $6 $tx $rx $9 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $tx $rx $9 $10 $11 + echo $1 $2 $3 $4 $5 $6 $tx $rx $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg # fi # if [ "$norestart" = "1" ]; then @@ -655,7 +729,7 @@ elif [ "$1" = "-H" ]; then echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo "Do you want Balloon mode ON (y/n) " read hab @@ -672,8 +746,8 @@ elif [ "$1" = "-H" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $hab - echo $1 $2 $3 $4 $5 $6 $7 $8 $hab > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 + echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 > /home/pi/CubeSatSim/sim.cfg echo echo "Rebooting CubeSatSim with new configuration file" echo @@ -722,6 +796,7 @@ elif [ "$1" = "-h" ]; then echo " -H Chnage the Balloon mode" echo " -p Display payload sensor data" echo " -v Display voltage and current data" + echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX" echo exit From e3e9aa85c38afbc39ad7f7c97c927dcb521bb6d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 10:23:31 -0400 Subject: [PATCH 032/402] Update rpitx.py added sq, rxpl and tuple to radio programming --- rpitx.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/rpitx.py b/rpitx.py index 90707180..536d6f94 100644 --- a/rpitx.py +++ b/rpitx.py @@ -306,6 +306,12 @@ if __name__ == "__main__": file.close() print("Command_count: ") print(command_count) + + txpl_value = '0' + rxpl_value = '0' + sq = '0' + tx = '434.9000' + rx = '435.0000' try: file = open("/home/pi/CubeSatSim/sim.cfg") @@ -314,26 +320,30 @@ if __name__ == "__main__": callsign = config[0] if len(config) > 5: sq = config[5] - else: - sq = '0' if len(config) > 6: -# tx = config[6] txf = float(config[6]) print(txf) # print( "{:.4f}".format(txf)) tx = "{:.4f}".format(txf) print(tx) - else: - tx = '434.9000' if len(config) > 7: -# rx = config[7] rxf = float(config[7]) print(rxf) # print( "{:.4f}".format(rxf)) rx = "{:.4f}".format(rxf) print(rx) - else: - rx = '435.0000' + if len(config) > 9: + rxpl = float(config[9]) + print(rxpl) + print( "{:.0f}".format(rxpl)) + rxpl_value = "{:.0f}".format(rxpl) + print(rxpl_value) + if len(config) > 10: + txpl = float(config[10]) + print(txpl) + print( "{:.0f}".format(txpl)) + rxpl_value = "{:.0f}".format(txpl) + print(txpl_value) print(config) print # print(callsign) @@ -376,7 +386,8 @@ if __name__ == "__main__": try: ser = serial.Serial("/dev/ttyAMA0", 9600) print(ser.portstr) - uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n" +# uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n" + uhf_string = "AT+DMOSETGROUP=0," + rx + "," + tx + "," + rxpl_value + "," + sq + "," + txpl_value + ",0\r\n" for i in range(6): # ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") ser.write(uhf_string.encode()) From e5ea0a06642d8e3a3eebac8c773b9c450fe8b0fa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 11:39:27 -0400 Subject: [PATCH 033/402] Update config implement noreboot option --- config | 167 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 63 deletions(-) diff --git a/config b/config index 93d614f2..3279211a 100755 --- a/config +++ b/config @@ -9,6 +9,9 @@ else norestart=0 fi +reboot=0 +restart=0 + if [ "$1" = "" ]; then value=`cat /home/pi/CubeSatSim/.mode` echo "$value" > /dev/null @@ -97,10 +100,11 @@ if [ "$1" = "" ]; then elif [ "$1" = "-i" ]; then - echo "Rebooting CubeSatSim" - sudo reboot now + reboot=1 +## echo "Rebooting CubeSatSim" +## sudo reboot now # sudo systemctl restart cubesatsim - exit +## exit elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode @@ -113,12 +117,13 @@ elif [ "$1" = "-a" ]; then echo "Battery saver mode is OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi - - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now + + reboot=1 +## echo "rebooting" +## sudo systemctl stop rpitx +## sudo reboot now # sudo systemctl restart cubesatsim - exit +## exit elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" @@ -132,29 +137,32 @@ elif [ "$1" = "-m" ]; then echo "Battery saver mode is OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now + reboot=1 +## echo "rebooting" +## sudo systemctl stop rpitx +## sudo reboot now # sudo systemctl restart cubesatsim - exit +## exit elif [ "$1" = "-f" ]; then echo "changing CubeSatSim to FSK mode" sudo echo "f" > /home/pi/CubeSatSim/.mode # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now + reboot=1 +## echo "rebooting" +## sudo systemctl stop rpitx +## sudo reboot now # sudo systemctl restart cubesatsim - exit +## exit elif [ "$1" = "-b" ]; then echo "changing CubeSatSim to BPSK mode" sudo echo "b" > /home/pi/CubeSatSim/.mode # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now + reboot=1 +## echo "rebooting" +## sudo systemctl stop rpitx +## sudo reboot now # sudo systemctl restart cubesatsim - exit +## exit elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" sudo echo "s" > /home/pi/CubeSatSim/.mode @@ -167,11 +175,12 @@ elif [ "$1" = "-s" ]; then echo "Battery saver mode is OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now + reboot=1 +## echo "rebooting" +## sudo systemctl stop rpitx +## sudo reboot now # sudo systemctl restart cubesatsim - exit +## exit elif [ "$1" = "-t" ]; then @@ -212,10 +221,11 @@ elif [ "$1" = "-t" ]; then echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg echo - echo "Rebooting CubeSatSim with new configuration file" - echo +## echo "Rebooting CubeSatSim with new configuration file" +## echo - sudo reboot now + reboot=1 +## sudo reboot now # sudo systemctl restart cubesatsim elif [ "$1" = "-c" ]; then @@ -258,9 +268,10 @@ elif [ "$1" = "-c" ]; then echo else echo - echo "Rebooting CubeSatSim with new configuration file" - echo - sudo reboot now +## echo "Rebooting CubeSatSim with new configuration file" +## echo + reboot=1 +## sudo reboot now # sudo systemctl restart cubesatsim fi @@ -310,10 +321,11 @@ elif [ "$1" = "-r" ]; then if [ "$norestart" = "1" ]; then echo else - echo - echo "Rebooting CubeSatSim with new configuration file" - echo - sudo reboot now +## echo +## echo "Rebooting CubeSatSim with new configuration file" +## echo + reboot=1 +## sudo reboot now # sudo systemctl restart cubesatsim fi @@ -385,10 +397,11 @@ elif [ "$1" = "-l" ]; then if [ "$norestart" = "1" ]; then echo else - echo - echo "Rebooting CubeSatSim with new configuration file" - echo - sudo reboot now +## echo +## echo "Rebooting CubeSatSim with new configuration file" +## echo + reboot=1 +## sudo reboot now # sudo systemctl restart cubesatsim fi @@ -421,9 +434,10 @@ elif [ "$1" = "-C" ]; then sudo journalctl --rotate sudo journalctl --vacuum-time=1s - sudo systemctl reboot now + reboot=1 +## sudo systemctl reboot now - echo "rebooting" +## echo "rebooting" elif [ "$1" = "-T" ]; then @@ -442,9 +456,10 @@ elif [ "$1" = "-T" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control set to OFF" sudo rm /home/pi/CubeSatSim/command_control - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now + reboot=1 +## echo "rebooting" +## sudo systemctl stop rpitx +## sudo reboot now fi else @@ -457,9 +472,10 @@ elif [ "$1" = "-T" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control set to ON" sudo touch /home/pi/CubeSatSim/command_control - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now +## echo "rebooting" + reboot=1 +## sudo systemctl stop rpitx +## sudo reboot now fi fi @@ -508,7 +524,7 @@ elif [ "$1" = "-B" ]; then read saver echo - reboot=0 +## reboot=0 if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then if [ "$mode" = "0" ] ; then @@ -531,11 +547,13 @@ elif [ "$1" = "-B" ]; then set -- $value if [ "$1" = "a" ] || [ "$1" = "s" ] || [ "$1" = "m" ] ; then - echo "rebooting" - sudo reboot now + reboot=1 +## echo "rebooting" +## sudo reboot now else - echo "restarting" - sudo systemctl restart cubesatsim + restart=1 +## echo "restarting" +## sudo systemctl restart cubesatsim fi fi @@ -580,10 +598,11 @@ elif [ "$1" = "-q" ]; then echo $1 $2 $3 $4 $5 $sq $7 $8 $9 $10 $11 echo $1 $2 $3 $4 $4 $sq $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg echo - echo "Rebooting CubeSatSim with new configuration file" - echo +## echo "Rebooting CubeSatSim with new configuration file" +## echo - sudo reboot now + reboot=1 +## sudo reboot now # sudo systemctl restart cubesatsim @@ -647,10 +666,11 @@ elif [ "$1" = "-P" ]; then echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl > /home/pi/CubeSatSim/sim.cfg echo - echo "Rebooting CubeSatSim with new configuration file" - echo +## echo "Rebooting CubeSatSim with new configuration file" +## echo - sudo reboot now + reboot=1 +## sudo reboot now # sudo systemctl restart cubesatsim elif [ "$1" = "-F" ]; then @@ -705,9 +725,10 @@ elif [ "$1" = "-F" ]; then # echo # else echo - echo "Rebooting CubeSatSim with new configuration file" - echo - sudo reboot now +## echo "Rebooting CubeSatSim with new configuration file" +## echo + reboot=1 +## sudo reboot now # sudo systemctl restart cubesatsim # fi elif [ "$1" = "-H" ]; then @@ -749,10 +770,11 @@ elif [ "$1" = "-H" ]; then echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 > /home/pi/CubeSatSim/sim.cfg echo - echo "Rebooting CubeSatSim with new configuration file" - echo +## echo "Rebooting CubeSatSim with new configuration file" +## echo - sudo reboot now + reboot=1 +## sudo reboot now # sudo systemctl restart cubesatsim elif [ "$1" = "-p" ]; then @@ -808,3 +830,22 @@ else fi # sudo systemctl restart cubesatsim + +echo "Checking for reboot or restart" + +if [ "$noreboot" = "0" ] ; then + + if [ "$reboot" = "1" ] ; then + echo "Rebooting" + fi + + if [ "$restart" = "1" ] ; then + echo "Restarting" + fi +else + + echo "Reboot disabled" + +fi + + From 7cce37972754cbaabe660ab1f49aab44b1e386c8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 12:20:01 -0400 Subject: [PATCH 034/402] Update update fixed typo in sim.cfg update --- update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update b/update index 31b37d60..66f5d0e5 100755 --- a/update +++ b/update @@ -252,8 +252,8 @@ if [ $changed -eq 1 ]; then echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $10 $11 - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 > /home/pi/CubeSatSim/sim.cfg echo fi From ad4d89be610d4c207493a387d95ae241eef43bfe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 12:21:56 -0400 Subject: [PATCH 035/402] Update update print output of sim.cfg --- update | 1 + 1 file changed, 1 insertion(+) diff --git a/update b/update index 66f5d0e5..8e4ecff3 100755 --- a/update +++ b/update @@ -231,6 +231,7 @@ git pull --no-rebase > .updated_p changed=0 value=`cat /home/pi/CubeSatSim/sim.cfg` +echo "$value" echo "$value" > /dev/null set -- $value From cf383519833926e76b14a69a10e092e7d27cef6f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 12:29:44 -0400 Subject: [PATCH 036/402] Update update fixed variables in sim.cfg update --- update | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/update b/update index 8e4ecff3..be3bbbd5 100755 --- a/update +++ b/update @@ -244,8 +244,8 @@ if [ -z "$6" ] ; then n6="3" ; changed=1 ; else n6=$6 ; fi # squelch if [ -z "$7" ] ; then n7="434.9000" ; changed=1 ; else n7=$7 ; fi # transmit frequency if [ -z "$8" ] ; then n8="435.0000" ; changed=1 ; else n8=$8 ; fi # receive frequency if [ -z "$9" ] ; then n9="no" ; changed=1 ; else n9=$9 ; fi # hab mode -if [ -z "$10" ] ; then n10="0" ; changed=1 ; else n10=$10 ; fi # rx pl code -if [ -z "$11" ] ; then n11="0" ; changed=1 ; else n11=$11 ; fi # tx pl code +if [ -z "$10" ] ; then m1="0" ; changed=1 ; else m1=$10 ; fi # rx pl code +if [ -z "$11" ] ; then m2="0" ; changed=1 ; else m2=$11 ; fi # tx pl code if [ $changed -eq 1 ]; then echo -e "Current sim.cfg configuration file:" @@ -253,8 +253,8 @@ if [ $changed -eq 1 ]; then echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 - echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 > /home/pi/CubeSatSim/sim.cfg + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2 + echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2 > /home/pi/CubeSatSim/sim.cfg echo fi From efd6dee641f1ea0085b9e638b871a77924869563 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 12:36:11 -0400 Subject: [PATCH 037/402] Update update fix $10 and $11 --- update | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/update b/update index be3bbbd5..3147540c 100755 --- a/update +++ b/update @@ -231,7 +231,7 @@ git pull --no-rebase > .updated_p changed=0 value=`cat /home/pi/CubeSatSim/sim.cfg` -echo "$value" +# echo "$value" echo "$value" > /dev/null set -- $value @@ -244,13 +244,13 @@ if [ -z "$6" ] ; then n6="3" ; changed=1 ; else n6=$6 ; fi # squelch if [ -z "$7" ] ; then n7="434.9000" ; changed=1 ; else n7=$7 ; fi # transmit frequency if [ -z "$8" ] ; then n8="435.0000" ; changed=1 ; else n8=$8 ; fi # receive frequency if [ -z "$9" ] ; then n9="no" ; changed=1 ; else n9=$9 ; fi # hab mode -if [ -z "$10" ] ; then m1="0" ; changed=1 ; else m1=$10 ; fi # rx pl code -if [ -z "$11" ] ; then m2="0" ; changed=1 ; else m2=$11 ; fi # tx pl code +if [ -z "${10}" ] ; then m1="0" ; changed=1 ; else m1=${10} ; fi # rx pl code +if [ -z "${11}" ] ; then m2="0" ; changed=1 ; else m2=${11} ; fi # tx pl code if [ $changed -eq 1 ]; then echo -e "Current sim.cfg configuration file:" echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2 From 801bdbe836e5825beecab277a39a37ecf0734a78 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 12:43:37 -0400 Subject: [PATCH 038/402] Update config fixed $10 and $11 --- config | 62 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/config b/config index 3279211a..cc1471a3 100755 --- a/config +++ b/config @@ -72,10 +72,10 @@ if [ "$1" = "" ]; then echo echo -n "RX PL code is: " - echo $10 + echo ${10} echo echo -n "TX PL code is: " - echo $11 + echo echo FILE=/home/pi/CubeSatSim/battery_saver @@ -89,7 +89,7 @@ if [ "$1" = "" ]; then echo -e "Current sim.cfg configuration file:" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} echo echo "To change, include an OPTION" @@ -201,7 +201,7 @@ elif [ "$1" = "-t" ]; then echo -# $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 +# $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} echo "Do you want Simulated Telemetry ON (y/n) " read sim @@ -218,8 +218,8 @@ elif [ "$1" = "-t" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 - echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} + echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} > /home/pi/CubeSatSim/sim.cfg echo ## echo "Rebooting CubeSatSim with new configuration file" ## echo @@ -246,7 +246,7 @@ elif [ "$1" = "-c" ]; then echo $1 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} echo "Enter callsign in all capitals: " read callsign @@ -260,8 +260,8 @@ elif [ "$1" = "-c" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 - echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} + echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -294,7 +294,7 @@ elif [ "$1" = "-r" ]; then echo $2 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} echo -e "Enter Reset Count (integer): " @@ -314,8 +314,8 @@ elif [ "$1" = "-r" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $resets $3 $4 $5 $6 $7 $8 $9 $10 $11 - echo $1 $resets $3 $4 $5 $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -349,7 +349,7 @@ elif [ "$1" = "-l" ]; then echo $3 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} echo -e "Enter latitude (decimal degrees, positive is north): " @@ -391,8 +391,8 @@ elif [ "$1" = "-l" ]; then fi echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $2 $lat $long $5 $6 $7 $8 $9 $10 $11 - echo $1 $2 $lat $long $5 $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} + echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg if [ "$norestart" = "1" ]; then echo @@ -573,7 +573,7 @@ elif [ "$1" = "-q" ]; then echo $6 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} echo -e "Enter squelch (integer 0 - 8): " @@ -595,8 +595,8 @@ elif [ "$1" = "-q" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $5 $sq $7 $8 $9 $10 $11 - echo $1 $2 $3 $4 $4 $sq $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $sq $7 $8 $9 ${10} ${11} + echo $1 $2 $3 $4 $4 $sq $7 $8 $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg echo ## echo "Rebooting CubeSatSim with new configuration file" ## echo @@ -619,12 +619,12 @@ elif [ "$1" = "-P" ]; then echo echo "Current value of RX PL is" - echo $10 + echo ${10} echo "Current value of TX PL is" - echo $11 + echo ${11} echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} echo -e "Enter RX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)" @@ -632,14 +632,14 @@ elif [ "$1" = "-P" ]; then if [ -z $rxpl ] ; then - rxpl="$10" + rxpl="${10}" echo "Keeping value of" $rxpl fi if ! [[ $rxpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then echo "Error: not a number!" - rxpl="$10" + rxpl="${10}" echo "Keeping value of" $rxpl fi @@ -649,14 +649,14 @@ elif [ "$1" = "-P" ]; then if [ -z $txpl ] ; then - txpl="$11" + txpl="${11}" echo "Keeping value of" $txpl fi if ! [[ $txpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then echo "Error: not a number!" - txpl="$11" + txpl="${11}" echo "Keeping value of" $txpl fi @@ -694,7 +694,7 @@ elif [ "$1" = "-F" ]; then echo $8 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} echo "Enter tx frequency as 4XX.XXXX: " read tx @@ -717,8 +717,8 @@ elif [ "$1" = "-F" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $2 $3 $4 $5 $6 $tx $rx $9 $10 $11 - echo $1 $2 $3 $4 $5 $6 $tx $rx $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} + echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg # fi # if [ "$norestart" = "1" ]; then @@ -750,7 +750,7 @@ elif [ "$1" = "-H" ]; then echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} echo "Do you want Balloon mode ON (y/n) " read hab @@ -767,8 +767,8 @@ elif [ "$1" = "-H" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 - echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} + echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} > /home/pi/CubeSatSim/sim.cfg echo ## echo "Rebooting CubeSatSim with new configuration file" ## echo From ec799a0a3db23e92565d9e4a4a7f75047016425e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 12:47:54 -0400 Subject: [PATCH 039/402] Update config TX PL print and print parameters --- config | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config b/config index cc1471a3..3725b2ef 100755 --- a/config +++ b/config @@ -2,6 +2,9 @@ echo "CubeSatSim v1.3.2 configuration tool" echo +echo $1 +echo $2 +echo if [ "$2" = "-n" ]; then norestart=1 @@ -75,7 +78,7 @@ if [ "$1" = "" ]; then echo ${10} echo echo -n "TX PL code is: " - echo + echo ${11} echo FILE=/home/pi/CubeSatSim/battery_saver From 8d2409a559c57e1d3c76afe4564565df511cc66a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 13:07:43 -0400 Subject: [PATCH 040/402] Update config changed from n to -n --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 3725b2ef..d83942f7 100755 --- a/config +++ b/config @@ -6,7 +6,7 @@ echo $1 echo $2 echo -if [ "$2" = "-n" ]; then +if [ "$2" = "n" ]; then norestart=1 else norestart=0 From f203e8df162206cd758234b433ead5a83a0b40ca Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 13:11:25 -0400 Subject: [PATCH 041/402] Update config changed to any second parameter is no restart --- config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config b/config index d83942f7..206eb317 100755 --- a/config +++ b/config @@ -6,10 +6,11 @@ echo $1 echo $2 echo -if [ "$2" = "n" ]; then - norestart=1 -else +# if [ "$2" = "n" ]; then +if [ -z "$2"]; then norestart=0 +else + norestart=1 fi reboot=0 From 37175717247aa1903c82935ba385dd91b8e2400e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 13:12:45 -0400 Subject: [PATCH 042/402] Update config adde space --- config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config b/config index 206eb317..4ead94c4 100755 --- a/config +++ b/config @@ -6,11 +6,11 @@ echo $1 echo $2 echo -# if [ "$2" = "n" ]; then -if [ -z "$2"]; then - norestart=0 -else +# if [ "$2" = "n" ] ; then +# if [ -z "$2"]; then norestart=1 +else + norestart=0 fi reboot=0 From 8e37af0fa8ba60d68894e90ac7c6701fa81b759f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 13:13:18 -0400 Subject: [PATCH 043/402] Update config comment back in --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 4ead94c4..11000e2f 100755 --- a/config +++ b/config @@ -6,7 +6,7 @@ echo $1 echo $2 echo -# if [ "$2" = "n" ] ; then +if [ "$2" = "n" ] ; then # if [ -z "$2"]; then norestart=1 else From 68cf6c413f6d10e2f45e5ab385ba9386892b370e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 13:14:32 -0400 Subject: [PATCH 044/402] Update config print no restart --- config | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config b/config index 11000e2f..b7cea74e 100755 --- a/config +++ b/config @@ -6,13 +6,16 @@ echo $1 echo $2 echo -if [ "$2" = "n" ] ; then -# if [ -z "$2"]; then - norestart=1 -else +# if [ "$2" = "n" ] ; then +if [ -z "$2"] ; then norestart=0 +else + norestart=1 fi +echo "No restart" +echo $norestart + reboot=0 restart=0 From 55d89b91869326d901b75bb0a60252eab30e62bc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 13:17:23 -0400 Subject: [PATCH 045/402] Update config changed to no reboot --- config | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config b/config index b7cea74e..0fcc6f7b 100755 --- a/config +++ b/config @@ -8,13 +8,13 @@ echo # if [ "$2" = "n" ] ; then if [ -z "$2"] ; then - norestart=0 + noreboot=0 else - norestart=1 + noreboot=1 fi -echo "No restart" -echo $norestart +echo "No reboot" +echo $noreboot reboot=0 restart=0 @@ -840,6 +840,8 @@ fi echo "Checking for reboot or restart" +echo $noreboot + if [ "$noreboot" = "0" ] ; then if [ "$reboot" = "1" ] ; then From ddf114a8b2b6cd5d478258d5d499a1a3439aae6e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 19 Jun 2024 13:17:58 -0400 Subject: [PATCH 046/402] Update config added space --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 0fcc6f7b..294a3c08 100755 --- a/config +++ b/config @@ -7,7 +7,7 @@ echo $2 echo # if [ "$2" = "n" ] ; then -if [ -z "$2"] ; then +if [ -z "$2" ] ; then noreboot=0 else noreboot=1 From 091a0910aa1fc81e343a97423db9cbd83359bbfc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:33:43 -0400 Subject: [PATCH 047/402] Update main.h added tx_pl and rx_pl --- main.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.h b/main.h index 2f5b3fe6..136718cb 100644 --- a/main.h +++ b/main.h @@ -132,6 +132,8 @@ char sim_yes[10]; char hab_yes[10]; int squelch = 3; // default squelch char rx[12], tx[12]; +int tx_pl = 0; +int rx_pl = 0; int bitRate, mode, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod; float sleepTime; From ab3abb67cf75311ea32c2dd5782a6435f6ead8b8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:35:38 -0400 Subject: [PATCH 048/402] Update main.c added rx_pl and tx_pl support --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 75e9bb2f..eeb1496c 100644 --- a/main.c +++ b/main.c @@ -59,11 +59,11 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; - fscanf(config_file, "%s %d %f %f %s %d %s %s %s", - call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes); + fscanf(config_file, "%s %d %f %f %s %d %s %s %s %s %s", + call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes, & rx_pl, & tx_pl); fclose(config_file); - fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s\n", - call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes); + fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %s %s\n", + call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl); fprintf(stderr, "Transmit on %s Receive on %s\n", tx, rx); @@ -325,7 +325,7 @@ int main(int argc, char * argv[]) { } */ config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %s %s", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl)); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From 89b08b9a4a1c6c372d825a30f4b728c282783144 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:37:08 -0400 Subject: [PATCH 049/402] Update main.c extra ) --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index eeb1496c..a94f7d6c 100644 --- a/main.c +++ b/main.c @@ -325,7 +325,7 @@ int main(int argc, char * argv[]) { } */ config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %s %s", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl)); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %s %s", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From dcab3cbb63d4bebac3cd701f0abec7066b5e7509 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:38:37 -0400 Subject: [PATCH 050/402] Update update fixed aa typo --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index 3147540c..fb4f23d0 100755 --- a/update +++ b/update @@ -251,7 +251,7 @@ if [ $changed -eq 1 ]; then echo -e "Current sim.cfg configuration file:" echo echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} - echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" + echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" echo echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2 echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2 > /home/pi/CubeSatSim/sim.cfg From 445f782a25d4b8dd87add5285522a5b624185eaf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:41:21 -0400 Subject: [PATCH 051/402] Update main.c fixed writing of sim.cfg --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index a94f7d6c..f0fa5112 100644 --- a/main.c +++ b/main.c @@ -62,7 +62,7 @@ int main(int argc, char * argv[]) { fscanf(config_file, "%s %d %f %f %s %d %s %s %s %s %s", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes, & rx_pl, & tx_pl); fclose(config_file); - fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %s %s\n", + fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d\n", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl); fprintf(stderr, "Transmit on %s Receive on %s\n", tx, rx); @@ -325,7 +325,7 @@ int main(int argc, char * argv[]) { } */ config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %s %s", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From 34f8f6800ba3f7e8c9b8ef532c85bf1a02bba972 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:46:04 -0400 Subject: [PATCH 052/402] Update config don't print args --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index 294a3c08..a0582719 100755 --- a/config +++ b/config @@ -2,9 +2,9 @@ echo "CubeSatSim v1.3.2 configuration tool" echo -echo $1 -echo $2 -echo +# echo $1 +# echo $2 +# echo # if [ "$2" = "n" ] ; then if [ -z "$2" ] ; then From a86b7f3955dfd0bf4b4f361bfa40980f6445d3df Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:46:49 -0400 Subject: [PATCH 053/402] Update update added notebook arg --- update | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/update b/update index fb4f23d0..5efaed2c 100755 --- a/update +++ b/update @@ -2,6 +2,16 @@ echo -e "\nupdate script for CubeSatSim v1.3.2\n" +if [ "$1" = "n" ] ; then +# if [ -z "$2" ] ; then + noreboot=0 +else + noreboot=1 +fi + +echo "No reboot" +echo $noreboot + sudo rm /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/id.txt /home/pi/CubeSatSim/cw.txt > /dev/null 2>&1 if [ "$1" = "u" ]; then From 927e63c0eeed53ec3db37aff496410f4a757c0a1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:49:10 -0400 Subject: [PATCH 054/402] Update update swapped notebook --- update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update b/update index 5efaed2c..61e62873 100755 --- a/update +++ b/update @@ -4,9 +4,9 @@ echo -e "\nupdate script for CubeSatSim v1.3.2\n" if [ "$1" = "n" ] ; then # if [ -z "$2" ] ; then - noreboot=0 -else noreboot=1 +else + noreboot=0 fi echo "No reboot" From 8167df5d5e27e9562fbc924f4d2e407093b24bc6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:52:03 -0400 Subject: [PATCH 055/402] Update update changed reboot --- update | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/update b/update index 61e62873..685466d0 100755 --- a/update +++ b/update @@ -268,20 +268,26 @@ if [ $changed -eq 1 ]; then echo fi -if [ $FLAG -eq 1 ]; then - echo "systemctl daemon-reload and reboot" - sudo systemctl daemon-reload - sudo reboot -h now +if [ "$noreboot" = "0" ] ; then + + if [ $FLAG -eq 1 ]; then + echo "systemctl daemon-reload and reboot" + sudo systemctl daemon-reload + sudo reboot -h now # sudo systemctl restart cubesatsim -else - grep 'changed' /home/pi/CubeSatSim/.updated - if [[ $(grep 'changed' /home/pi/CubeSatSim/.updated) ]]; then - echo "reboot" - sudo reboot -h now + else + grep 'changed' /home/pi/CubeSatSim/.updated + if [[ $(grep 'changed' /home/pi/CubeSatSim/.updated) ]]; then + echo "reboot" + sudo reboot -h now # sudo systemctl restart cubesatsim - else - echo "nothing to do." - fi + else + echo "nothing to do." + fi + fi +else + + echo "Reboot disabled" fi - - echo "CubeSatSim update complete." + +echo "CubeSatSim update complete." From 6f05182f248536afd5c1a6112cc54aaa721db901 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:53:04 -0400 Subject: [PATCH 056/402] Update update don't show reboot status --- update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update b/update index 685466d0..4f6d2779 100755 --- a/update +++ b/update @@ -9,8 +9,8 @@ else noreboot=0 fi -echo "No reboot" -echo $noreboot +# echo "No reboot" +# echo $noreboot sudo rm /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/id.txt /home/pi/CubeSatSim/cw.txt > /dev/null 2>&1 From 0d0939c75041b5b22f402cc2e546e8a1f57f5549 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:55:11 -0400 Subject: [PATCH 057/402] Update update print reboot needed if disabled --- update | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/update b/update index 4f6d2779..d877a13e 100755 --- a/update +++ b/update @@ -286,8 +286,9 @@ if [ "$noreboot" = "0" ] ; then fi fi else - - echo "Reboot disabled" + if [ $FLAG -eq 1 ]; then + echo "reboot needed for changes to take effect" + fi fi echo "CubeSatSim update complete." From a2e36b02b646834f38fae74a26d4b90fd767fd71 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 02:58:14 -0400 Subject: [PATCH 058/402] Update config print reboot needed for changes to take effect --- config | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config b/config index a0582719..b9c26fb8 100755 --- a/config +++ b/config @@ -842,19 +842,19 @@ echo "Checking for reboot or restart" echo $noreboot -if [ "$noreboot" = "0" ] ; then - if [ "$reboot" = "1" ] ; then +if [ "$reboot" = "1" ] ; then + if [ "$noreboot" = "0" ] ; then echo "Rebooting" + else + echo "Reboot needed for changes to take effect" fi +fi - if [ "$restart" = "1" ] ; then +if [ "$restart" = "1" ] ; then + if [ "$reboot" = "1" ] ; then echo "Restarting" + else + echo "Restart needed for changes to take effect" fi -else - - echo "Reboot disabled" - fi - - From 606701a3d517e0f39c11ba077ec2a3fb0535ce2f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 09:32:21 -0400 Subject: [PATCH 059/402] Update main.c changed %s to %d --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index f0fa5112..1705a9bd 100644 --- a/main.c +++ b/main.c @@ -59,7 +59,7 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; - fscanf(config_file, "%s %d %f %f %s %d %s %s %s %s %s", + fscanf(config_file, "%s %d %f %f %s %d %s %s %s %d %d", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes, & rx_pl, & tx_pl); fclose(config_file); fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d\n", From 53230f2a47dfb3e8948ec0c33a59e646c444ebe5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 09:36:00 -0400 Subject: [PATCH 060/402] Update config added $11 --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index b9c26fb8..b8234200 100755 --- a/config +++ b/config @@ -96,7 +96,7 @@ if [ "$1" = "" ]; then echo -e "Current sim.cfg configuration file:" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} echo echo "To change, include an OPTION" From f9baa157327b2b9418d97a53f6847d871030540a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 09:42:39 -0400 Subject: [PATCH 061/402] Update config turn back on reboot and restart --- config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config b/config index b8234200..20ca4276 100755 --- a/config +++ b/config @@ -846,6 +846,8 @@ echo $noreboot if [ "$reboot" = "1" ] ; then if [ "$noreboot" = "0" ] ; then echo "Rebooting" + sudo systemctl stop rpitx + sudo reboot now else echo "Reboot needed for changes to take effect" fi @@ -854,6 +856,7 @@ fi if [ "$restart" = "1" ] ; then if [ "$reboot" = "1" ] ; then echo "Restarting" + sudo systemctl restart cubesatsim else echo "Restart needed for changes to take effect" fi From 9a7ccafbfb69e46b8da2c4dcdf2325a9312a4955 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 09:44:40 -0400 Subject: [PATCH 062/402] Update config remove prints --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index 20ca4276..24f3dd38 100755 --- a/config +++ b/config @@ -838,9 +838,9 @@ fi # sudo systemctl restart cubesatsim -echo "Checking for reboot or restart" +# echo "Checking for reboot or restart" -echo $noreboot +# echo $noreboot if [ "$reboot" = "1" ] ; then From 04ca68d48a55fa6fd812db2b06cc8cd6680b15d7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 10:09:19 -0400 Subject: [PATCH 063/402] Update config restart after PL change --- config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config b/config index 24f3dd38..b166bb5e 100755 --- a/config +++ b/config @@ -641,6 +641,8 @@ elif [ "$1" = "-P" ]; then rxpl="${10}" echo "Keeping value of" $rxpl + else + restart=1 fi if ! [[ $rxpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then @@ -648,6 +650,8 @@ elif [ "$1" = "-P" ]; then echo "Error: not a number!" rxpl="${10}" echo "Keeping value of" $rxpl + else + restart=1 fi echo -e "Enter TX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)" From 89dd4233e7dab4f165d39d8989de24aed0d72b9f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 10:12:20 -0400 Subject: [PATCH 064/402] Update rpitx.py don't print debug sim.cfg --- rpitx.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rpitx.py b/rpitx.py index 536d6f94..8328424a 100644 --- a/rpitx.py +++ b/rpitx.py @@ -320,28 +320,29 @@ if __name__ == "__main__": callsign = config[0] if len(config) > 5: sq = config[5] + print(sq) if len(config) > 6: txf = float(config[6]) - print(txf) +# print(txf) # print( "{:.4f}".format(txf)) tx = "{:.4f}".format(txf) print(tx) if len(config) > 7: rxf = float(config[7]) - print(rxf) +# print(rxf) # print( "{:.4f}".format(rxf)) rx = "{:.4f}".format(rxf) print(rx) if len(config) > 9: rxpl = float(config[9]) - print(rxpl) - print( "{:.0f}".format(rxpl)) + # print(rxpl) + # print( "{:.0f}".format(rxpl)) rxpl_value = "{:.0f}".format(rxpl) print(rxpl_value) if len(config) > 10: txpl = float(config[10]) - print(txpl) - print( "{:.0f}".format(txpl)) + # print(txpl) + # print( "{:.0f}".format(txpl)) rxpl_value = "{:.0f}".format(txpl) print(txpl_value) print(config) From f225ce729f29ee647db6a7ff335913f4a1096d3f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 10:13:52 -0400 Subject: [PATCH 065/402] Update rpitx.py print uhf_string --- rpitx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rpitx.py b/rpitx.py index 8328424a..81dedf1d 100644 --- a/rpitx.py +++ b/rpitx.py @@ -389,6 +389,7 @@ if __name__ == "__main__": print(ser.portstr) # uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n" uhf_string = "AT+DMOSETGROUP=0," + rx + "," + tx + "," + rxpl_value + "," + sq + "," + txpl_value + ",0\r\n" + print(uhf_string) for i in range(6): # ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") ser.write(uhf_string.encode()) From fd96863a5ca6c41d1448c5c37fab048539946d2f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 10:15:32 -0400 Subject: [PATCH 066/402] Update config remove No reboot print --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index b166bb5e..e7300210 100755 --- a/config +++ b/config @@ -13,8 +13,8 @@ else noreboot=1 fi -echo "No reboot" -echo $noreboot +# echo "No reboot" +# echo $noreboot reboot=0 restart=0 From 0b28433ce4756de2036157a75714fd37a41a2e49 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 10:26:28 -0400 Subject: [PATCH 067/402] Update rpitx.py print for reading sim.cfg --- rpitx.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rpitx.py b/rpitx.py index 81dedf1d..ead913fb 100644 --- a/rpitx.py +++ b/rpitx.py @@ -214,7 +214,7 @@ elif GPIO.input(27) == False: txLedOff = 1 elif GPIO.input(13) == False: print("Version is v1 with VHF BPF") - print("VHF transmit not implemented yet") + print("VHF transmit not imemented yet") # transmit = True txLed = 27 txLedOn = 1 @@ -307,8 +307,8 @@ if __name__ == "__main__": print("Command_count: ") print(command_count) - txpl_value = '0' - rxpl_value = '0' + tx_value = '0' + rx_value = '0' sq = '0' tx = '434.9000' rx = '435.0000' @@ -335,14 +335,14 @@ if __name__ == "__main__": print(rx) if len(config) > 9: rxpl = float(config[9]) - # print(rxpl) - # print( "{:.0f}".format(rxpl)) + print(rxpl) + print( "{:.0f}".format(rxpl)) rxpl_value = "{:.0f}".format(rxpl) print(rxpl_value) if len(config) > 10: txpl = float(config[10]) - # print(txpl) - # print( "{:.0f}".format(txpl)) + print(txpl) + print( "{:.0f}".format(txpl)) rxpl_value = "{:.0f}".format(txpl) print(txpl_value) print(config) From 08f9505e48a52d364eafbc141db9735458deaa53 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 20 Jun 2024 10:30:50 -0400 Subject: [PATCH 068/402] Update rpitx.py fix bug in tx_pl --- rpitx.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpitx.py b/rpitx.py index ead913fb..ed5c0733 100644 --- a/rpitx.py +++ b/rpitx.py @@ -335,15 +335,15 @@ if __name__ == "__main__": print(rx) if len(config) > 9: rxpl = float(config[9]) - print(rxpl) - print( "{:.0f}".format(rxpl)) + # print(rxpl) + # print( "{:.0f}".format(rxpl)) rxpl_value = "{:.0f}".format(rxpl) print(rxpl_value) if len(config) > 10: txpl = float(config[10]) - print(txpl) - print( "{:.0f}".format(txpl)) - rxpl_value = "{:.0f}".format(txpl) +# print(txpl) +# print( "{:.0f}".format(txpl)) + txpl_value = "{:.0f}".format(txpl) print(txpl_value) print(config) print From 6572c2c2dd93abff1fb3476c5b6788a24787a3b2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Jun 2024 04:04:26 -0400 Subject: [PATCH 069/402] Update config display reboot disabled when n set --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index e7300210..cc7024bf 100755 --- a/config +++ b/config @@ -11,6 +11,7 @@ if [ -z "$2" ] ; then noreboot=0 else noreboot=1 + echo "Reboot disabled" fi # echo "No reboot" From 37b6cdbd197f567890b5c3c2d0f9a21c63daaf54 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 21 Jun 2024 05:05:14 -0400 Subject: [PATCH 070/402] Update config only allow squelch 1-8 not 0 --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index cc7024bf..fdb2f786 100755 --- a/config +++ b/config @@ -583,7 +583,7 @@ elif [ "$1" = "-q" ]; then # echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} - echo -e "Enter squelch (integer 0 - 8): " + echo -e "Enter squelch (integer 1 - 8): " read sq From 45b18c5050a9b1e356f732e0260bcd3bf7b41581 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 11:58:07 -0400 Subject: [PATCH 071/402] Update aprs_in.py increment command_count --- aprs_in.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index 83331bd6..e696bb6d 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -38,6 +38,22 @@ if __name__ == "__main__": mode = 'm' change_mode = True if (debug_mode == False) and (change_mode == True): + 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) + print("\n/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode) change_mode = False From 19c87b04f0afb4c63c4ef6045eb10bf07aee0999 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:34:23 -0400 Subject: [PATCH 072/402] Create squelch_cc.py code moved from spitx.py --- squelch_cc.py | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 squelch_cc.py diff --git a/squelch_cc.py b/squelch_cc.py new file mode 100644 index 00000000..4a28f8c8 --- /dev/null +++ b/squelch_cc.py @@ -0,0 +1,165 @@ +import RPi.GPIO as GPIO +from RPi.GPIO import output + +def command_control_check(): + +# global command_control +# global no_command +# global debug_mode + command_count = 0 + +# output(pd, 1) +# output(ptt, 1) +# sleep(1) +# if (no_command == False and GPIO.input(squelch) == False): + if GPIO.input(squelch) == False: + print("carrier received!") + # command_tx = not command_tx +# print(command_tx) + + 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) + + increment_mode() + +# if (command_tx == True): +# print("Turning on transmit") +# system("echo > command_tx True") +# output(txLed, txLedOn) +# sleep(0.5) +# output(txLed, txLedff) +# else: +# print("Turning off transmit") +# system("echo > command_tx False") + else: + print("No carrier received!") +# output(pd, 0) +# sleep(1) + +def increment_mode(): + print("increment mode") + powerPin = 16 + try: + file = open("/home/pi/CubeSatSim/.mode") + mode = file.read(1) + except: +# mode = "f" + if (debug_mode == 1): + print("Can't open .mode file") # , defaulting to FSK") + file.close() + print("Mode is: ") + print(mode) + if (mode == 'a'): + mode = 'f' + GPIO.output(powerPin, 0) # blink two times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + + elif (mode == 'f'): + mode = 'b' + GPIO.output(powerPin, 0) # blink three times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + + elif (mode == 'b'): + mode = 's' + GPIO.output(powerPin, 0) # blink four times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + + elif (mode == 's'): + mode = 'm' + GPIO.output(powerPin, 0) # blink five times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1); + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + else: + mode = 'a' + GPIO.output(powerPin, 0) # blink one time + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + + try: + file = open("/home/pi/CubeSatSim/.mode", "w") + count_string = str(command_count) + file.write(mode) + file.close() + print(".mode file written") + + GPIO.setwarnings(False) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + print("sudo reboot -h now") + GPIO.setwarnings(False) + GPIO.setup(powerPin, GPIO.OUT) + GPIO.output(powerPin, 0); +# system("reboot -h now") +# release = True; + + print("Changing mode now") +# system("/home/pi/CubeSatSim/config -" + mode) + system("reboot -h now") + + sleep(10); + except: + print("can't write to .mode file") + +while True: + command_control_check() From a73d7721dc7293f9b44f5d8efbdb69f5634b458d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:37:48 -0400 Subject: [PATCH 073/402] Update squelch_cc.py fixed indents --- squelch_cc.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 4a28f8c8..8b474790 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -5,8 +5,8 @@ def command_control_check(): # global command_control # global no_command -# global debug_mode - command_count = 0 +# global debug_mode + command_count = 0 # output(pd, 1) # output(ptt, 1) @@ -17,21 +17,21 @@ def command_control_check(): # command_tx = not command_tx # print(command_tx) - 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) + 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) increment_mode() @@ -162,4 +162,4 @@ def increment_mode(): print("can't write to .mode file") while True: - command_control_check() + command_control_check() From c85a5c4ebf6defc727e924cb5fc02945527f5061 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:39:47 -0400 Subject: [PATCH 074/402] Update squelch_cc.py added squelch pin --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index 8b474790..c3a8ae2a 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -7,6 +7,7 @@ def command_control_check(): # global no_command # global debug_mode command_count = 0 + squelch = 6 # output(pd, 1) # output(ptt, 1) From 6896eaf02683f1e43cc24cb31b18ee9eafc5f2c5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:41:26 -0400 Subject: [PATCH 075/402] Update squelch_cc.py add gpio set mode --- squelch_cc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/squelch_cc.py b/squelch_cc.py index c3a8ae2a..0c766daf 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -161,6 +161,8 @@ def increment_mode(): sleep(10); except: print("can't write to .mode file") - + +GPIO.setmode(GPIO.BCM) +GPIO.setwarnings(False) while True: command_control_check() From 12bf7a2ba1bfb8d742f7b4dec5c7fefcd46a4ed0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:44:24 -0400 Subject: [PATCH 076/402] Update squelch_cc.py set squelch pin mode --- squelch_cc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/squelch_cc.py b/squelch_cc.py index 0c766daf..b5487e1c 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -164,5 +164,7 @@ def increment_mode(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) +GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected + while True: command_control_check() From 047ee2e215a6989723bd6780937c41ab8dd8be67 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:45:28 -0400 Subject: [PATCH 077/402] Update squelch_cc.py set squelch to 6 --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index b5487e1c..9df6735f 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -164,6 +164,7 @@ def increment_mode(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) +squelch = 6 GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected while True: From 19d21393b2d6035f406caa53f76c8b592d93d60c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:47:35 -0400 Subject: [PATCH 078/402] Update squelch_cc.py set powerPin mode --- squelch_cc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/squelch_cc.py b/squelch_cc.py index 9df6735f..ebf7eac2 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -165,7 +165,9 @@ def increment_mode(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) squelch = 6 +powerPin = 16 GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected +GPIO.setup(powerPin, GPIO.OUT) while True: command_control_check() From 602aa71e2ecade9e9e3b1adb973a97c5bcdabdff Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:48:38 -0400 Subject: [PATCH 079/402] Update squelch_cc.py fix sleep --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index ebf7eac2..306dca58 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -1,5 +1,6 @@ import RPi.GPIO as GPIO from RPi.GPIO import output +import time def command_control_check(): From 46a4bf4c883b028f002e9536c5fe28f0e5690ddc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:50:06 -0400 Subject: [PATCH 080/402] Update squelch_cc.py fix sleep --- squelch_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squelch_cc.py b/squelch_cc.py index 306dca58..e15c5010 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -1,6 +1,6 @@ import RPi.GPIO as GPIO from RPi.GPIO import output -import time +from time import sleep def command_control_check(): From 3767408a56c2f442419f4e4e162e63441ac99d83 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:54:09 -0400 Subject: [PATCH 081/402] Update squelch_cc.py change to config script --- squelch_cc.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index e15c5010..5787f4e2 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -139,29 +139,32 @@ def increment_mode(): sleep(2.5) try: - file = open("/home/pi/CubeSatSim/.mode", "w") - count_string = str(command_count) - file.write(mode) - file.close() - print(".mode file written") + print("/home/pi/CubeSatSim/config -" + mode) + system("/home/pi/CubeSatSim/config -" + mode) - GPIO.setwarnings(False) - GPIO.output(txLed, 0) - GPIO.output(powerPin, 0) - print("sudo reboot -h now") - GPIO.setwarnings(False) - GPIO.setup(powerPin, GPIO.OUT) - GPIO.output(powerPin, 0); +# file = open("/home/pi/CubeSatSim/.mode", "w") +# count_string = str(command_count) +# file.write(mode) +# file.close() +# print(".mode file written") + +# GPIO.setwarnings(False) +# GPIO.output(txLed, 0) +# GPIO.output(powerPin, 0) +# print("sudo reboot -h now") +# GPIO.setwarnings(False) +# GPIO.setup(powerPin, GPIO.OUT) +# GPIO.output(powerPin, 0); # system("reboot -h now") # release = True; print("Changing mode now") # system("/home/pi/CubeSatSim/config -" + mode) - system("reboot -h now") +# system("reboot -h now") sleep(10); except: - print("can't write to .mode file") + print("can't change mode") GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) From 908012ed779e0ec1a639c4a4c7873c19579e05a3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:57:08 -0400 Subject: [PATCH 082/402] Update squelch_cc.py remove debug mode --- squelch_cc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 5787f4e2..c8da9147 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -59,8 +59,8 @@ def increment_mode(): mode = file.read(1) except: # mode = "f" - if (debug_mode == 1): - print("Can't open .mode file") # , defaulting to FSK") +# if (debug_mode == 1): + print("Can't open .mode file") # , defaulting to FSK") file.close() print("Mode is: ") print(mode) From 6b52d10a54e1b9583139581ccbc3bd5154b32ce1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 13:01:08 -0400 Subject: [PATCH 083/402] Update squelch_cc.py import system --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index c8da9147..32a4a2b8 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -1,6 +1,7 @@ import RPi.GPIO as GPIO from RPi.GPIO import output from time import sleep +from os import system def command_control_check(): From 40c65cd5fc30b242f6aff93ee3b0a1da2c186bc0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 13:11:07 -0400 Subject: [PATCH 084/402] Update squelch_cc.py add sleep 0.5 --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index 32a4a2b8..2ba4c4c5 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -176,3 +176,4 @@ GPIO.setup(powerPin, GPIO.OUT) while True: command_control_check() + sleep(0.5) From 1f3cd708b36dc0f8cb2f870ada711e39b489869d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 14:40:23 -0400 Subject: [PATCH 085/402] Update squelch_cc.py add debug mode with d --- squelch_cc.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 2ba4c4c5..bb9e2240 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -7,7 +7,7 @@ def command_control_check(): # global command_control # global no_command -# global debug_mode + global debug_mode command_count = 0 squelch = 6 @@ -47,12 +47,14 @@ def command_control_check(): # else: # print("Turning off transmit") # system("echo > command_tx False") - else: - print("No carrier received!") +## else: +## print("No carrier received!") # output(pd, 0) # sleep(1) def increment_mode(): + global debug_mode + print("increment mode") powerPin = 16 try: @@ -141,7 +143,8 @@ def increment_mode(): try: print("/home/pi/CubeSatSim/config -" + mode) - system("/home/pi/CubeSatSim/config -" + mode) + if (debug_mode == False): + system("/home/pi/CubeSatSim/config -" + mode) # file = open("/home/pi/CubeSatSim/.mode", "w") # count_string = str(command_count) @@ -166,7 +169,13 @@ def increment_mode(): sleep(10); except: print("can't change mode") - + +debug_mode = False +if (len(sys.argv)) > 1: +# print("There are arguments!") + if ('d' == sys.argv[1]): + debug_mode = True + GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) squelch = 6 From a04f63bb2e707b141bb4879217603b7bfba34041 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 14:41:50 -0400 Subject: [PATCH 086/402] Update squelch_cc.py import sys --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index bb9e2240..2297c811 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -2,6 +2,7 @@ import RPi.GPIO as GPIO from RPi.GPIO import output from time import sleep from os import system +import sys def command_control_check(): From 580b15c9c134a01b5577e9b63f26e1463ee7dfc6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 14:47:03 -0400 Subject: [PATCH 087/402] Update squelch_cc.py add print --- squelch_cc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 2297c811..9d774817 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -163,19 +163,21 @@ def increment_mode(): # system("reboot -h now") # release = True; - print("Changing mode now") + print("Changing mode now") # system("/home/pi/CubeSatSim/config -" + mode) # system("reboot -h now") - - sleep(10); + print +# sleep(10); except: print("can't change mode") +print("Squelch Command and Control active") debug_mode = False if (len(sys.argv)) > 1: # print("There are arguments!") if ('d' == sys.argv[1]): debug_mode = True + print("Debug mode - mode changes not made") GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) From 21b9bc8dc85c89e8605ed1dc5ef32467483e3988 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 14:48:23 -0400 Subject: [PATCH 088/402] Update rpitx.py don't do command and control check --- rpitx.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpitx.py b/rpitx.py index ed5c0733..57d0391b 100644 --- a/rpitx.py +++ b/rpitx.py @@ -17,6 +17,8 @@ def command_control_check(): global no_command global debug_mode global command_count + + return output(pd, 1) output(ptt, 1) From 15061986d953e4c7f6f1b022eaec2c320c294738 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:01:44 -0400 Subject: [PATCH 089/402] Update rpitx.py add sleep 0.5 between CW channels --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 57d0391b..b3018d52 100644 --- a/rpitx.py +++ b/rpitx.py @@ -526,7 +526,8 @@ if __name__ == "__main__": 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, txLedOff) - command_control_check() + command_control_check() + sleep(0.5) f.close() sleep(5) except: From 26621eb84c87122a9a868b1e202158742b3b3778 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:12:37 -0400 Subject: [PATCH 090/402] Update squelch_cc.py turn off LEDs and tx --- squelch_cc.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 9d774817..18d2d09d 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -77,7 +77,7 @@ def increment_mode(): GPIO.output(powerPin, 0) sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) elif (mode == 'f'): mode = 'b' @@ -92,7 +92,7 @@ def increment_mode(): GPIO.output(powerPin, 0) sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) elif (mode == 'b'): mode = 's' @@ -111,7 +111,7 @@ def increment_mode(): GPIO.output(powerPin, 0) sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) elif (mode == 's'): mode = 'm' @@ -134,13 +134,13 @@ def increment_mode(): GPIO.output(powerPin, 0) sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) else: mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) try: print("/home/pi/CubeSatSim/config -" + mode) @@ -153,9 +153,10 @@ def increment_mode(): # file.close() # print(".mode file written") -# GPIO.setwarnings(False) -# GPIO.output(txLed, 0) -# GPIO.output(powerPin, 0) + GPIO.setwarnings(False) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + system("sudo systemctl stop rpitx") # print("sudo reboot -h now") # GPIO.setwarnings(False) # GPIO.setup(powerPin, GPIO.OUT) @@ -183,8 +184,10 @@ GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) squelch = 6 powerPin = 16 +txLed = 27 GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected GPIO.setup(powerPin, GPIO.OUT) +GPIO.setup(txLed, GPIO.OUT) while True: command_control_check() From e2a2ef8d37d78ed9b63265b9edc728a0d09c8dba Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:15:00 -0400 Subject: [PATCH 091/402] Update squelch_cc.py fix txLED variable --- squelch_cc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/squelch_cc.py b/squelch_cc.py index 18d2d09d..3461d2ae 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -10,7 +10,8 @@ def command_control_check(): # global no_command global debug_mode command_count = 0 - squelch = 6 + global squelch + global txLed # output(pd, 1) # output(ptt, 1) From 145b5b363b93395f6e628ae684c31b1a123d33fc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:20:22 -0400 Subject: [PATCH 092/402] Update squelch_cc.py turn off LEDs sooner --- squelch_cc.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 3461d2ae..b6973e94 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -145,30 +145,27 @@ def increment_mode(): try: print("/home/pi/CubeSatSim/config -" + mode) - if (debug_mode == False): + if (debug_mode == False): + GPIO.setwarnings(False) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + system("sudo systemctl stop rpitx") system("/home/pi/CubeSatSim/config -" + mode) - + print("Changing mode now") # file = open("/home/pi/CubeSatSim/.mode", "w") # count_string = str(command_count) # file.write(mode) # file.close() # print(".mode file written") - - GPIO.setwarnings(False) - GPIO.output(txLed, 0) - GPIO.output(powerPin, 0) - system("sudo systemctl stop rpitx") # print("sudo reboot -h now") # GPIO.setwarnings(False) # GPIO.setup(powerPin, GPIO.OUT) # GPIO.output(powerPin, 0); # system("reboot -h now") # release = True; - - print("Changing mode now") # system("/home/pi/CubeSatSim/config -" + mode) # system("reboot -h now") - print + print(" ") # sleep(10); except: print("can't change mode") From f91318b661e7fac79b824ba43c3c80ce382505dc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:22:47 -0400 Subject: [PATCH 093/402] Update aprs_in.py add immediate LED and tx stop --- aprs_in.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index e696bb6d..a4860715 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -1,8 +1,11 @@ import sys from os import system +import RPi.GPIO as GPIO +from RPi.GPIO import output if __name__ == "__main__": - + powerPin = 16 + txLed = 27 change_mode = False debug_mode = False if (len(sys.argv)) > 1: @@ -38,6 +41,11 @@ if __name__ == "__main__": mode = 'm' change_mode = True if (debug_mode == False) and (change_mode == True): + GPIO.setmode(GPIO.BCM) + GPIO.setwarnings(False) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + system("sudo systemctl stop rpitx") try: file = open("/home/pi/CubeSatSim/command_count.txt", "r") string = file.read() From 024eae76f1f8e736b50f1d17ed0a0f49cf4d01e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:28:05 -0400 Subject: [PATCH 094/402] Update aprs_in.py fix gpio settings --- aprs_in.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index a4860715..846a309f 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -43,6 +43,8 @@ if __name__ == "__main__": if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) + GPIO.setup(powerPin, GPIO.OUT) + GPIO.setup(txLed, GPIO.OUT) GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") From 3e966603831221fd8973097131312dbba4e3a46d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:31:23 -0400 Subject: [PATCH 095/402] Update aprs_in.py add LED blinks --- aprs_in.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index 846a309f..b5775f75 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -45,6 +45,76 @@ if __name__ == "__main__": GPIO.setwarnings(False) GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(txLed, GPIO.OUT) + + if (mode == 'f'): + GPIO.output(powerPin, 0) # blink two times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + + elif (mode == 'b'): + GPIO.output(powerPin, 0) # blink three times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + + elif (mode == 's'): + GPIO.output(powerPin, 0) # blink four times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + + elif (mode == 'm'): + GPIO.output(powerPin, 0) # blink five times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1); + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + else: + GPIO.output(powerPin, 0) # blink one time + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") From 5b7ebaf077976468d728fd0685a6ff6ea36d77e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:32:36 -0400 Subject: [PATCH 096/402] Update aprs_in.py fix sleep --- aprs_in.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aprs_in.py b/aprs_in.py index b5775f75..4dc3b0d5 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -2,6 +2,7 @@ import sys from os import system import RPi.GPIO as GPIO from RPi.GPIO import output +from time import sleep if __name__ == "__main__": powerPin = 16 From a6736af1cc1cce217fe0c753cddd21032d914de1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:44:01 -0400 Subject: [PATCH 097/402] Update command to check for USB sound card, exit if C&C off --- command | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/command b/command index b995446d..80c81525 100755 --- a/command +++ b/command @@ -5,28 +5,36 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then echo "Radio command and control is ON" - echo "Turning Command and control to OFF" - sudo rm /home/pi/CubeSatSim/command_control - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now +# echo "Turning Command and control to OFF" +# sudo rm /home/pi/CubeSatSim/command_control +# echo "rebooting" +# sudo systemctl stop rpitx +# sudo reboot now # fi else echo "Radio command and control is OFF" + exit 1 fi -echo "Starting direwolf" -if [ "$1" = "d" ]; then +# if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then + if [[ $(arecord -l | grep card) ]]; then -echo "debug mode" - -direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py d + echo "Starting direwolf" + if [ "$1" = "d" ]; then + + echo "debug mode" + + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py d + + else + + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py + + fi else - -direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py + echo "Starting squelch C&C" fi - From ba0bea860c0bb0b330ec5b3c3db2dc6f0f406879 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:48:41 -0400 Subject: [PATCH 098/402] Update command add squelch python command --- command | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/command b/command index 80c81525..a79c617f 100755 --- a/command +++ b/command @@ -37,4 +37,15 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" else echo "Starting squelch C&C" + if [ "$1" = "d" ]; then + + echo "debug mode" + + python3 /home/pi/CubeSatSim/squelch_cc.py d + + else + + python3 /home/pi/CubeSatSim/squelch_cc.py + + fi fi From 9ca5a669af35a25780a274becf634c073096eaa6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:06:35 -0400 Subject: [PATCH 099/402] Update rpitx.py activate command script in background --- rpitx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rpitx.py b/rpitx.py index b3018d52..38d97c8c 100644 --- a/rpitx.py +++ b/rpitx.py @@ -375,6 +375,7 @@ if __name__ == "__main__": else: print("command and control is activated") no_command = False + system("/home/pi/CubeSatSim/command &") except: print("command and control not activated") no_command = True From 3ee9217c821b0704606c1d1b4b332384bc509151 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:16:20 -0400 Subject: [PATCH 100/402] Update config added reboot to wall echo --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index fdb2f786..5f103d62 100755 --- a/config +++ b/config @@ -850,6 +850,7 @@ fi if [ "$reboot" = "1" ] ; then if [ "$noreboot" = "0" ] ; then + echo 'Reboot due to mode change!' | wall echo "Rebooting" sudo systemctl stop rpitx sudo reboot now From 30b23193efb31b9d4c7bbb62bdea970196418ed5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:31:22 -0400 Subject: [PATCH 101/402] Update rpitx.py to clog.txt --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 38d97c8c..a24c8fdc 100644 --- a/rpitx.py +++ b/rpitx.py @@ -375,7 +375,7 @@ if __name__ == "__main__": else: print("command and control is activated") no_command = False - system("/home/pi/CubeSatSim/command &") + system("/home/pi/CubeSatSim/command & > cclog.txt") except: print("command and control not activated") no_command = True From c7ba0ca01cff55431f2fdc79de13b7ac5dcf4ae8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:42:36 -0400 Subject: [PATCH 102/402] Update aprs_in.py set mode to a in else --- aprs_in.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aprs_in.py b/aprs_in.py index 4dc3b0d5..585de872 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -111,6 +111,7 @@ if __name__ == "__main__": GPIO.output(powerPin, 1) sleep(1) else: + mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) GPIO.output(powerPin, 1) From 8005d1129dd37a604979ab515183e307a3fcadea Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:46:26 -0400 Subject: [PATCH 103/402] Update aprs_in.py move rpitx stop --- aprs_in.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index 585de872..db16c593 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -117,9 +117,6 @@ if __name__ == "__main__": GPIO.output(powerPin, 1) sleep(1) - GPIO.output(txLed, 0) - GPIO.output(powerPin, 0) - system("sudo systemctl stop rpitx") try: file = open("/home/pi/CubeSatSim/command_count.txt", "r") string = file.read() @@ -138,5 +135,9 @@ if __name__ == "__main__": print("\n/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + system("sudo systemctl stop rpitx") + change_mode = False print("Done") From 4ce3dc5d54a8eca42d5af2f3cea0aeac073fc474 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:47:40 -0400 Subject: [PATCH 104/402] Update squelch_cc.py also move rpitx stop --- squelch_cc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index b6973e94..a0dc8604 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -147,11 +147,12 @@ def increment_mode(): print("/home/pi/CubeSatSim/config -" + mode) if (debug_mode == False): GPIO.setwarnings(False) + system("/home/pi/CubeSatSim/config -" + mode) + print("Changing mode now") GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") - system("/home/pi/CubeSatSim/config -" + mode) - print("Changing mode now") + # file = open("/home/pi/CubeSatSim/.mode", "w") # count_string = str(command_count) # file.write(mode) From 6fa3673cd5c3d8a55bf864b5b8b16f8bc069c96b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:48:39 -0400 Subject: [PATCH 105/402] Update rpitx.py remove cclog.txt since didn't work --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index a24c8fdc..38d97c8c 100644 --- a/rpitx.py +++ b/rpitx.py @@ -375,7 +375,7 @@ if __name__ == "__main__": else: print("command and control is activated") no_command = False - system("/home/pi/CubeSatSim/command & > cclog.txt") + system("/home/pi/CubeSatSim/command &") except: print("command and control not activated") no_command = True From b09d964641cd1d08bb3bc99e1eba59fab8ac360c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:53:47 -0400 Subject: [PATCH 106/402] Update rpitx.py don't activate command and control here --- rpitx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpitx.py b/rpitx.py index 38d97c8c..6fa3a32b 100644 --- a/rpitx.py +++ b/rpitx.py @@ -373,9 +373,9 @@ if __name__ == "__main__": print("squelch not set correctly, no command input!") no_command = True else: - print("command and control is activated") + print("NOT: command and control is activated") no_command = False - system("/home/pi/CubeSatSim/command &") +# system("/home/pi/CubeSatSim/command &") except: print("command and control not activated") no_command = True From 9270698d36c0807544f841d0383a098bebc3cb04 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:55:41 -0400 Subject: [PATCH 107/402] Update main.c start c&c here --- main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.c b/main.c index 1705a9bd..b835aac0 100644 --- a/main.c +++ b/main.c @@ -101,6 +101,9 @@ int main(int argc, char * argv[]) { // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); + + FILE * cc_start = popen("python3 /home/pi/CubeSatSim/command &", "r"); + pclose(cc_stop); // FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); // pclose(file_deletes); From af32be02ce3fb6c91b52797d74de606c42c67e62 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:57:34 -0400 Subject: [PATCH 108/402] Update main.c typo cc_start --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index b835aac0..0e65ec4f 100644 --- a/main.c +++ b/main.c @@ -103,7 +103,7 @@ int main(int argc, char * argv[]) { pclose(rpitx_stop); FILE * cc_start = popen("python3 /home/pi/CubeSatSim/command &", "r"); - pclose(cc_stop); + pclose(cc_start); // FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); // pclose(file_deletes); From f831bf1a291b2548cc2b06e9a784aa406d39628b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 17:04:11 -0400 Subject: [PATCH 109/402] Update main.c typo in command command --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 0e65ec4f..6e65740e 100644 --- a/main.c +++ b/main.c @@ -102,7 +102,7 @@ int main(int argc, char * argv[]) { FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); - FILE * cc_start = popen("python3 /home/pi/CubeSatSim/command &", "r"); + FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r"); pclose(cc_start); // FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); From 808992cb5fbfe51cee02616bd644d9f8aae1860f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 17:49:00 -0400 Subject: [PATCH 110/402] Create command.service for c&c --- systemd/command.service | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 systemd/command.service diff --git a/systemd/command.service b/systemd/command.service new file mode 100644 index 00000000..3f19fa8a --- /dev/null +++ b/systemd/command.service @@ -0,0 +1,16 @@ +[Unit] +Description=Command service + +[Service] +TimeoutStopSec=5 +ExecStart=/home/pi/CubeSatSim/command +WorkingDirectory=/home/pi/CubeSatSim +StandardOutput=inherit +StandardError=inherit +Restart=always +User=root +CPUAccounting=true +CPUQuota=5% + +[Install] +WantedBy=default.target From 9bb40c77a6444a471677a5c18262730e578b97fd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 17:50:32 -0400 Subject: [PATCH 111/402] Update main.c don't start command here --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 6e65740e..ce9e8c05 100644 --- a/main.c +++ b/main.c @@ -102,8 +102,8 @@ int main(int argc, char * argv[]) { FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); - FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r"); - pclose(cc_start); +// FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r"); +// pclose(cc_start); // FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); // pclose(file_deletes); From 84dad54f1e78e38a7eff6a20fbdc773e52d07de3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 17:54:13 -0400 Subject: [PATCH 112/402] Update update added command.service and echo wall --- update | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/update b/update index d877a13e..77f14002 100755 --- a/update +++ b/update @@ -85,6 +85,14 @@ if [ ! -f "$FILE" ]; then echo "Copying SSTV image 2." cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg fi + +if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then + echo "changed rpitx.service." + sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + FLAG=1 +else + echo "no changes to command.service." +fi grep 'update' /home/pi/CubeSatSim/.updated if [[ $(grep 'update' /home/pi/CubeSatSim/.updated) ]]; then @@ -278,7 +286,7 @@ if [ "$noreboot" = "0" ] ; then else grep 'changed' /home/pi/CubeSatSim/.updated if [[ $(grep 'changed' /home/pi/CubeSatSim/.updated) ]]; then - echo "reboot" + echo "reboot due to code changes " | wall sudo reboot -h now # sudo systemctl restart cubesatsim else From 95b6a695a98a76e0217bb225fd5faba0136882ba Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:00:58 -0400 Subject: [PATCH 113/402] Update update create command.service if not present --- update | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/update b/update index 77f14002..7b81d0d1 100755 --- a/update +++ b/update @@ -74,6 +74,21 @@ else echo "no changes to rpitx.service." fi +FILE=/etc/systemd/system/command.service +if [ -f "$FILE" ]; then + if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then + echo "changed command.service." + sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + FLAG=1 + else + echo "no change to command.service." + fi +else + echo "creating command.service." + sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + FLAG=1 +fi + FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then echo "Copying SSTV image 1." @@ -85,14 +100,6 @@ if [ ! -f "$FILE" ]; then echo "Copying SSTV image 2." cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg fi - -if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then - echo "changed rpitx.service." - sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service - FLAG=1 -else - echo "no changes to command.service." -fi grep 'update' /home/pi/CubeSatSim/.updated if [[ $(grep 'update' /home/pi/CubeSatSim/.updated) ]]; then From ebd21e267d9978290c379c15b88c0ff4917c1b04 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:06:15 -0400 Subject: [PATCH 114/402] Update rpitx.py start command.service --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 6fa3a32b..d6f906af 100644 --- a/rpitx.py +++ b/rpitx.py @@ -373,9 +373,10 @@ if __name__ == "__main__": print("squelch not set correctly, no command input!") no_command = True else: - print("NOT: command and control is activated") + print("command and control is activated") no_command = False # system("/home/pi/CubeSatSim/command &") + system("sudo systemctl start command") except: print("command and control not activated") no_command = True From e5590666aa3c29c5793dc50bb78797fa8cf4dffa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:08:49 -0400 Subject: [PATCH 115/402] Update aprs_in.py print all messages --- aprs_in.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index db16c593..9b5416c9 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -15,8 +15,8 @@ if __name__ == "__main__": debug_mode = True for line in sys.stdin: - if (debug_mode): - print(line, end =" ") +# if (debug_mode): + print(line, end =" ") # if '^c' == line.rstrip(): # break From 749e9b3b4d33bef789444355a93ade5f0cf040c0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:19:54 -0400 Subject: [PATCH 116/402] Update command.service increase cpu quota to 10% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 3f19fa8a..1c4e2bc3 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=10% [Install] WantedBy=default.target From 5ca157712a8263d166d0a2880800cf8b14f962b7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:25:54 -0400 Subject: [PATCH 117/402] Update command wait 20 seconds --- command | 2 ++ 1 file changed, 2 insertions(+) diff --git a/command b/command index a79c617f..90b4942e 100755 --- a/command +++ b/command @@ -2,6 +2,8 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" +sleep 20 + FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then echo "Radio command and control is ON" From c944be611333e9ef9e064c4bb4da8ce1c49a90b6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:33:03 -0400 Subject: [PATCH 118/402] Update aprs_in.py stop rpitx and CubeSatSim before change mode --- aprs_in.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index 9b5416c9..d341563c 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -131,13 +131,16 @@ if __name__ == "__main__": except: print("Can't write command_count file!") print("Command_count: ") - print(command_count) - - print("\n/home/pi/CubeSatSim/config -" + mode) - system("/home/pi/CubeSatSim/config -" + mode) + print(command_count) + GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") + system("sudo systemctl stop cubesatsim") + + print("\n/home/pi/CubeSatSim/config -" + mode) + system("/home/pi/CubeSatSim/config -" + mode) + change_mode = False print("Done") From 865e908b163119089abba24d9250c7fdcf010a46 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:34:52 -0400 Subject: [PATCH 119/402] Update squelch_cc.py stop rpitx and CubeSatSim before change mode --- squelch_cc.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index a0dc8604..9faa6ca8 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -147,11 +147,14 @@ def increment_mode(): print("/home/pi/CubeSatSim/config -" + mode) if (debug_mode == False): GPIO.setwarnings(False) - system("/home/pi/CubeSatSim/config -" + mode) - print("Changing mode now") GPIO.output(txLed, 0) GPIO.output(powerPin, 0) - system("sudo systemctl stop rpitx") + system("sudo systemctl stop rpitx") + system("sudo systemctl stop cubesatsim") + + system("/home/pi/CubeSatSim/config -" + mode) + print("Changing mode now") + # file = open("/home/pi/CubeSatSim/.mode", "w") # count_string = str(command_count) From 8c9fbf3ab0dee09956e082ac22b4369b9a675ef8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:39:39 -0400 Subject: [PATCH 120/402] Update aprs_in.py added sleep 5 at the end --- aprs_in.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index d341563c..33966cb0 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -143,4 +143,8 @@ if __name__ == "__main__": change_mode = False + + print("Waiting 5 seconds to allow unplug and plug of soundcard") + sleep(5) print("Done") + From c88492e74c816d32fc18a5aeed2e97f44d40c424 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 11:25:17 -0400 Subject: [PATCH 121/402] Update command.service reduce to 5% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 1c4e2bc3..3f19fa8a 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=10% +CPUQuota=5% [Install] WantedBy=default.target From 888e8425c2801c8d15cbf8bdcbd3c2326d343698 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 11:31:22 -0400 Subject: [PATCH 122/402] Update command.service 7% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 3f19fa8a..a68c3a7b 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=7% [Install] WantedBy=default.target From 56fd4e9398cdeff2037915faf1c1ab8ee7f9b6e9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 11:55:48 -0400 Subject: [PATCH 123/402] Update aprs_in.py added logging warning --- aprs_in.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index 33966cb0..6f61b015 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -3,6 +3,8 @@ from os import system import RPi.GPIO as GPIO from RPi.GPIO import output from time import sleep +import logging +logging.warning('CC-Warning!') if __name__ == "__main__": powerPin = 16 From 0d74f6f68a297dad55ff72f6c07d2dc756fa961a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 11:57:09 -0400 Subject: [PATCH 124/402] Update command.service 8% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index a68c3a7b..e58a2678 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=7% +CPUQuota=8% [Install] WantedBy=default.target From 4bf4203bd5171817eabe05c5b179abf42e883d49 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 12:13:10 -0400 Subject: [PATCH 125/402] Update command.service up to 10% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index e58a2678..1c4e2bc3 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=8% +CPUQuota=10% [Install] WantedBy=default.target From ce796dc6ce681cdd6a3ddc3830611bc98124f6b6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 12:13:31 -0400 Subject: [PATCH 126/402] Update cubesatsim.service down to 3% --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 11966c22..d8738632 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=3% [Install] WantedBy=default.target From 050dd4477bd9542a47503fbe19fd87f9fe413199 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 12:25:40 -0400 Subject: [PATCH 127/402] Update cubesatsim.service back to 5% --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index d8738632..11966c22 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=3% +CPUQuota=5% [Install] WantedBy=default.target From f75ccfed3209226488b8ed25c2bd0e86dca396a2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 12:25:53 -0400 Subject: [PATCH 128/402] Update command.service up to 15% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 1c4e2bc3..c3201151 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=10% +CPUQuota=15% [Install] WantedBy=default.target From 0bd59be7d024575efb9ddc083d340afa9707c04e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:07:50 -0400 Subject: [PATCH 129/402] Update command.service remove CPU quota --- systemd/command.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/systemd/command.service b/systemd/command.service index c3201151..9354154f 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,8 +9,6 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root -CPUAccounting=true -CPUQuota=15% [Install] WantedBy=default.target From 661f191e0057529b4044913722d157a14b6345f8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:28:01 -0400 Subject: [PATCH 130/402] Update cubesatsim.service reduced to 4 --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 11966c22..73436333 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=4% [Install] WantedBy=default.target From c6fe2867140d67a2a62c043e7e143d982cf83ab2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:28:28 -0400 Subject: [PATCH 131/402] Update command.service set quota to 11 --- systemd/command.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/systemd/command.service b/systemd/command.service index 9354154f..9161a653 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,6 +9,8 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root +CPUAccounting=true +CPUQuota=11% [Install] WantedBy=default.target From fd5f4c86e9a1ed5dd96ba377eaa9b7b3fc50d040 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:39:43 -0400 Subject: [PATCH 132/402] Update main.c remove printfs --- main.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/main.c b/main.c index ce9e8c05..db50337c 100644 --- a/main.c +++ b/main.c @@ -559,7 +559,7 @@ int main(int argc, char * argv[]) { uptime = (int) (uptime_sec + 0.5); // printf("Uptime sec: %f \n", uptime_sec); // #ifdef DEBUG_LOGGING - printf("INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime); +// printf("INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime); // #endif fclose(uptime_file); @@ -572,7 +572,7 @@ int main(int argc, char * argv[]) { char * token; fputc('\n', file1); fgets(cmdbuffer, 1000, file1); - fprintf(stderr, "Python read Result: %s\n", cmdbuffer); +// fprintf(stderr, "Python read Result: %s\n", cmdbuffer); // serialPuts(uart_fd, cmdbuffer); // write INA data to Pico over serial @@ -614,22 +614,22 @@ int main(int argc, char * argv[]) { // if ((payload == ON) && (mode != BPSK)) { // moved to here // STEMBoardFailure = 0; payload = get_payload_serial(FALSE); - printf("get_payload_status: %d \n", payload); // not debug +// printf("get_payload_status: %d \n", payload); // not debug fflush(stdout); - printf("String: %s\n", buffer2); +// printf("String: %s\n", buffer2); fflush(stdout); strcpy(sensor_payload, buffer2); - printf(" Response from STEM Payload board: %s\n", sensor_payload); +// printf(" Response from STEM Payload board: %s\n", sensor_payload); telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "a"); - printf("Writing payload string\n"); +// printf("Writing payload string\n"); time_t timeStamp; time(&timeStamp); // get timestamp // printf("Timestamp: %s\n", ctime(&timeStamp)); char timeStampNoNl[31], bat_string[31]; snprintf(timeStampNoNl, 30, "%.24s", ctime(&timeStamp)); - printf("TimeStamp: %s\n", timeStampNoNl); +// printf("TimeStamp: %s\n", timeStampNoNl); snprintf(bat_string, 30, "BAT %4.2f %5.1f", batteryVoltage, batteryCurrent); fprintf(telem_file, "%s %s %s\n", timeStampNoNl, bat_string, sensor_payload); // write telemetry string to telem.txt file fclose(telem_file); @@ -776,7 +776,7 @@ int main(int argc, char * argv[]) { } #ifdef DEBUG_LOGGING - fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); +// fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); #endif if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode) @@ -822,7 +822,7 @@ int main(int argc, char * argv[]) { FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w"); if (fp != NULL) { - printf("Writing telem_string.txt\n"); +// printf("Writing telem_string.txt\n"); if (batteryVoltage != 4.5) fprintf(fp, "BAT %4.2fV %5.1fmA\n", batteryVoltage, batteryCurrent); else @@ -842,16 +842,16 @@ int main(int argc, char * argv[]) { if ((mode == AFSK) || (mode == CW)) { get_tlm(); sleep(25); - fprintf(stderr, "INFO: Sleeping for 25 sec\n"); +// fprintf(stderr, "INFO: Sleeping for 25 sec\n"); int rand_sleep = (int)rnd_float(0.0, 5.0); sleep(rand_sleep); - fprintf(stderr, "INFO: Sleeping for extra %d sec\n", rand_sleep); +// fprintf(stderr, "INFO: Sleeping for extra %d sec\n", rand_sleep); } else if ((mode == FSK) || (mode == BPSK)) {// FSK or BPSK get_tlm_fox(); } else { // SSTV - fprintf(stderr, "Sleeping\n"); +// fprintf(stderr, "Sleeping\n"); sleep(50); } @@ -865,17 +865,17 @@ int main(int argc, char * argv[]) { #ifdef DEBUG_LOGGING // printf("Tx LED On 1\n"); #endif - printf("Sleeping to allow BPSK transmission to finish.\n"); +// printf("Sleeping to allow BPSK transmission to finish.\n"); sleep((unsigned int)(loop_count * 5)); - printf("Done sleeping\n"); + // printf("Done sleeping\n"); // digitalWrite(txLed, txLedOff); #ifdef DEBUG_LOGGING // printf("Tx LED Off\n"); #endif } else if (mode == FSK) { - printf("Sleeping to allow FSK transmission to finish.\n"); +// printf("Sleeping to allow FSK transmission to finish.\n"); sleep((unsigned int)loop_count); - printf("Done sleeping\n"); +// printf("Done sleeping\n"); } return 0; @@ -1192,7 +1192,7 @@ void get_tlm_fox() { sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ - printf("Sleep period: %d\n", millis() - startSleep); +// printf("Sleep period: %d\n", millis() - startSleep); fflush(stdout); sampleTime = (unsigned int) millis(); @@ -1225,7 +1225,7 @@ void get_tlm_fox() { if (mode == FSK) { if (loop % 32 == 0) { // was 8 - printf("Sending MIN frame \n"); +// printf("Sending MIN frame \n"); frm_type = 0x03; for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (count1 < 3) @@ -1239,7 +1239,7 @@ void get_tlm_fox() { } } if ((loop + 16) % 32 == 0) { // was 8 - printf("Sending MAX frame \n"); +// printf("Sending MAX frame \n"); frm_type = 0x02; for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (count1 < 3) @@ -1483,7 +1483,7 @@ void get_tlm_fox() { } else printf("Error opening command_count.txt!\n"); - printf("Command count: %d\n", groundCommandCount); +// printf("Command count: %d\n", groundCommandCount); int status = STEMBoardFailure + SafeMode * 2 + sim_mode * 4 + PayloadFailure1 * 8 + (i2c_bus0 == OFF) * 16 + (i2c_bus1 == OFF) * 32 + (i2c_bus3 == OFF) * 64 + (camera == OFF) * 128 + groundCommandCount * 256; @@ -1769,7 +1769,7 @@ void get_tlm_fox() { { start = millis(); // send frame until buffer fills sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0); - printf("socket send %d in %d ms bytes: %d \n\n",times + 2, (unsigned int)millis() - start, sock_ret); +// printf("socket send %d in %d ms bytes: %d \n\n",times + 2, (unsigned int)millis() - start, sock_ret); if ((millis() - start) > 500) { printf("Buffer over filled!\n"); From 80dbebc9cfeb205c466343d079bebca9d836f255 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:48:10 -0400 Subject: [PATCH 133/402] Update rpitx.py remove cc check for bps --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index d6f906af..f2a57e6a 100644 --- a/rpitx.py +++ b/rpitx.py @@ -757,7 +757,7 @@ if __name__ == "__main__": # output(txLed, txLedOn) # sleep(0.03) # output(txLed, txLedOff) - command_control_check() +# command_control_check() if (command_tx == True): output(txLed, txLedOn) From 0c9da136a306bac585e51807c2c9eede8ffc9835 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:49:11 -0400 Subject: [PATCH 134/402] Update main.c removed last two prints --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index db50337c..88eed849 100644 --- a/main.c +++ b/main.c @@ -563,8 +563,8 @@ int main(int argc, char * argv[]) { // #endif fclose(uptime_file); - printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); - fflush(stdout); +// printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); +// fflush(stdout); loopTime = millis(); { @@ -1738,14 +1738,14 @@ void get_tlm_fox() { // printf("Sending %d buffer bytes over socket after %d ms!\n", ctr, (long unsigned int)millis() - start); start = millis(); int sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0); - printf("socket send 1 %d ms bytes: %d \n\n", (unsigned int)millis() - start, sock_ret); +// printf("socket send 1 %d ms bytes: %d \n\n", (unsigned int)millis() - start, sock_ret); fflush(stdout); if (sock_ret < (ctr * 2 + 2)) { // printf("Not resending\n"); sleep(0.5); sock_ret = send(sock, &buffer[sock_ret], (unsigned int)(ctr * 2 + 2 - sock_ret), 0); - printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret); +// printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret); } loop_count++; From a05b584769003fc62545033eeaca9d3f98f7902c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 08:04:57 -0400 Subject: [PATCH 135/402] Update config add c&c DTMF/APRS or carrier listing --- config | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config b/config index 5f103d62..12394467 100755 --- a/config +++ b/config @@ -73,7 +73,11 @@ if [ "$1" = "" ]; then FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then - echo "Radio command and control is ON" + + if [[ $(arecord -l | grep card) ]]; then + echo "Radio DTMF/APRS command and control is ON" + else + echo "Radio carrier command and control is ON" else echo "Radio command and control is OFF" fi From 71fb2d21ae6477bbdae266f8248b4f9a90482859 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 08:06:40 -0400 Subject: [PATCH 136/402] Update log add -c for c&c log --- log | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/log b/log index 9518703d..3ce868f7 100755 --- a/log +++ b/log @@ -5,7 +5,11 @@ echo -e "\nLog file script for CubeSatSim\n" if [ "$1" = "-r" ]; then sudo journalctl -a -u rpitx > /home/pi/CubeSatSim/logr.txt cat /home/pi/CubeSatSim/logr.txt - echo -e "\nLog file also saved as /home/pi/CubeSatSim/logr.txt" + echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logr.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" else sudo journalctl -a -u cubesatsim > /home/pi/CubeSatSim/log.txt cat /home/pi/CubeSatSim/log.txt From a2abf2115bc6985acaea50ea83ed4f321cbf20e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 08:10:54 -0400 Subject: [PATCH 137/402] Update rpitx.py 10 seconds between SSTV and CW frames --- rpitx.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rpitx.py b/rpitx.py index f2a57e6a..280c58e5 100644 --- a/rpitx.py +++ b/rpitx.py @@ -529,11 +529,11 @@ if __name__ == "__main__": output(txLed, txLedOff) command_control_check() - sleep(0.5) + sleep(2) f.close() - sleep(5) + sleep(10) except: - command_control_check() +# command_control_check() sleep(1) elif (mode == 's'): print("SSTV") @@ -714,12 +714,12 @@ if __name__ == "__main__": output(txLed, txLedOff) # output (ptt, 1) # output(pd, 0) - sleep(5) + sleep(10) except: print("image 2 did not load - copy from CubeSatSim/sstv directory") if (txc == False): if (command_tx == True): - system("(while true; do (sleep 5 && cat /home/pi/CubeSatSim/wav/sstv.wav); done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") + system("(while true; do (sleep 10 && cat /home/pi/CubeSatSim/wav/sstv.wav); done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") while 1: if (command_tx == True): command_control_check() @@ -741,7 +741,7 @@ if __name__ == "__main__": sleep(1) elif (mode == 'b'): - command_control_check() +# command_control_check() print("BPSK") print("turn on FM rx") output(pd, 1) @@ -777,7 +777,7 @@ if __name__ == "__main__": # output(txLed, txLedOn) # sleep(0.03) # output(txLed, txLedOff) - command_control_check() +# command_control_check() if (command_tx == True): output(txLed, txLedOn) sleep(4.2) From 7020ad16a5936f180e09b8b22756a6c4ab44b105 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 08:17:50 -0400 Subject: [PATCH 138/402] Update config missing fi --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index 12394467..7eb5db72 100755 --- a/config +++ b/config @@ -78,6 +78,7 @@ if [ "$1" = "" ]; then echo "Radio DTMF/APRS command and control is ON" else echo "Radio carrier command and control is ON" + fi else echo "Radio command and control is OFF" fi From 0accaf48ea7ca9994fa1f23f4ab55ca9a0050383 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 11:37:12 -0400 Subject: [PATCH 139/402] Update config add command_control_direwolf --- config | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config b/config index 7eb5db72..40ac1e1a 100755 --- a/config +++ b/config @@ -75,13 +75,19 @@ if [ "$1" = "" ]; then if [ -f "$FILE" ]; then if [[ $(arecord -l | grep card) ]]; then - echo "Radio DTMF/APRS command and control is ON" + FILE=/home/pi/CubeSatSim/command_control_direwolf + if [ -f "$FILE" ]; then + echo "Radio DTMF/APRS command and control is ON" + else + echo "Radio carrier command and control is ON" + fi else echo "Radio carrier command and control is ON" fi else echo "Radio command and control is OFF" fi + echo echo -n "RX PL code is: " From 8b938a7ab86f20b70d06dcd9f97178d8f433b7e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 11:44:50 -0400 Subject: [PATCH 140/402] Update command add test for command_control_direwolf --- command | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/command b/command index 90b4942e..a136a93f 100755 --- a/command +++ b/command @@ -19,9 +19,8 @@ sleep 20 exit 1 fi - -# if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then - if [[ $(arecord -l | grep card) ]]; then +FILE=/home/pi/CubeSatSim/command_control_direwolf +if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "Starting direwolf" From 85b8cc2f6aec8c01f5f4fe2e9ec6adebbf1e4b81 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 11:54:52 -0400 Subject: [PATCH 141/402] Update config add -d to turn Direwolf on and off --- config | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/config b/config index 40ac1e1a..6fb21e82 100755 --- a/config +++ b/config @@ -499,6 +499,49 @@ elif [ "$1" = "-T" ]; then fi +elif [ "$1" = "-d" ]; then + + echo + echo "Change command and control Direwolf state" + echo + + FILE=/home/pi/CubeSatSim/command_control_direwolf + if [ -f "$FILE" ]; then + echo "Radio command and control with Direwolf for DTMF and APRS is ON" + echo + echo "Do you want to turn Direwolf OFF and do Carrier command and control (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control Direwolf set to OFF" + sudo rm /home/pi/CubeSatSim/command_control_direwolf + reboot=1 +## echo "rebooting" +## sudo systemctl stop rpitx +## sudo reboot now + fi + + else + echo "Radio command and control with Direwolf for DTMF and APRS is OFF so carrier command and control is enabled" + echo + echo "Do you want to set command and control with Direwolf for DTMF and APRS to ON (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control Direwolf set to ON" + sudo touch /home/pi/CubeSatSim/command_control_direwolf +## echo "rebooting" + reboot=1 +## sudo systemctl stop rpitx +## sudo reboot now + fi + + fi + + + elif [ "$1" = "-R" ]; then echo From 13cbc124d96aff1db3c83175040e3689e1f0dba0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 12:00:02 -0400 Subject: [PATCH 142/402] Update config add -d to list and restart command not reboot --- config | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config b/config index 6fb21e82..a854b663 100755 --- a/config +++ b/config @@ -516,9 +516,9 @@ elif [ "$1" = "-d" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control Direwolf set to OFF" sudo rm /home/pi/CubeSatSim/command_control_direwolf - reboot=1 +# reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx + sudo systemctl restart command ## sudo reboot now fi @@ -533,8 +533,8 @@ elif [ "$1" = "-d" ]; then echo "Command and control Direwolf set to ON" sudo touch /home/pi/CubeSatSim/command_control_direwolf ## echo "rebooting" - reboot=1 -## sudo systemctl stop rpitx +# reboot=1 + sudo systemctl restart command ## sudo reboot now fi @@ -877,6 +877,7 @@ elif [ "$1" = "-h" ]; then echo " -S Scan both I2C buses on the Raspberry Pi" echo " -C Clear logs" 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" echo " -B Change Safe Mode (battery saver mode) manually" echo " -q Change the Squelch setting for command receiver" From 0ac105e87bdcf8b2c4e9ab4358f59c69fbf883d1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 20:54:20 -0400 Subject: [PATCH 143/402] Update config don't reboot on c&c on/off --- config | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config b/config index a854b663..5717e25f 100755 --- a/config +++ b/config @@ -475,9 +475,9 @@ elif [ "$1" = "-T" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control set to OFF" sudo rm /home/pi/CubeSatSim/command_control - reboot=1 -## echo "rebooting" -## sudo systemctl stop rpitx +# reboot=1 + echo "restarting command and control" + sudo systemctl restart command ## sudo reboot now fi @@ -491,9 +491,9 @@ elif [ "$1" = "-T" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control set to ON" sudo touch /home/pi/CubeSatSim/command_control -## echo "rebooting" - reboot=1 -## sudo systemctl stop rpitx + echo "restarting command and control" +# reboot=1 + sudo systemctl restart command ## sudo reboot now fi From cf3dfa0571fdd94616485272c610248247a20956 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 20:58:23 -0400 Subject: [PATCH 144/402] Update command only delay 20 sec for direwolf --- command | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/command b/command index a136a93f..da3eea85 100755 --- a/command +++ b/command @@ -2,8 +2,6 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" -sleep 20 - FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then echo "Radio command and control is ON" @@ -22,7 +20,9 @@ sleep 20 FILE=/home/pi/CubeSatSim/command_control_direwolf if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then - echo "Starting direwolf" + echo "Starting direwolf after 20 second delay" + + sleep 20 if [ "$1" = "d" ]; then From 652747bfebe51ba80df01e530a73677d404cc501 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 21:12:55 -0400 Subject: [PATCH 145/402] Update command off while sleep loop --- command | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/command b/command index da3eea85..b4b999d8 100755 --- a/command +++ b/command @@ -14,7 +14,13 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" else echo "Radio command and control is OFF" - exit 1 + + while true + do + sleep 60 + done + +# exit 1 fi FILE=/home/pi/CubeSatSim/command_control_direwolf From d19593e48e70e2b6a75722c66d4acea49f09b472 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:11:32 -0400 Subject: [PATCH 146/402] Update install install command.service --- install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install b/install index 4e3fbeed..4b5f3aef 100755 --- a/install +++ b/install @@ -128,6 +128,10 @@ sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service sudo systemctl enable rpitx +sudo cp ~/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + +sudo systemctl enable command + sudo cp /boot/config.txt /boot/config.txt.0 sudo cp /boot/cmdline.txt /boot/cmdline.txt.0 From 265476ff184b89494b3935089af142b458a62c27 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:15:10 -0400 Subject: [PATCH 147/402] Update update add enable command.service --- update | 1 + 1 file changed, 1 insertion(+) diff --git a/update b/update index 7b81d0d1..66f33928 100755 --- a/update +++ b/update @@ -86,6 +86,7 @@ if [ -f "$FILE" ]; then else echo "creating command.service." sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + sudo systemctl enable command FLAG=1 fi From 22fff4df09f62439f6d4a9dc7223e72b6c188d94 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:25:22 -0400 Subject: [PATCH 148/402] Update config prompt to turn C&C on if off during direwolf change --- config | 55 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/config b/config index 5717e25f..ddd9a25e 100755 --- a/config +++ b/config @@ -122,7 +122,7 @@ elif [ "$1" = "-i" ]; then reboot=1 ## echo "Rebooting CubeSatSim" ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" @@ -139,9 +139,9 @@ elif [ "$1" = "-a" ]; then reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-m" ]; then @@ -158,9 +158,9 @@ elif [ "$1" = "-m" ]; then fi reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-f" ]; then echo "changing CubeSatSim to FSK mode" @@ -168,9 +168,9 @@ elif [ "$1" = "-f" ]; then # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-b" ]; then echo "changing CubeSatSim to BPSK mode" @@ -178,9 +178,9 @@ elif [ "$1" = "-b" ]; then # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" @@ -196,9 +196,9 @@ elif [ "$1" = "-s" ]; then fi reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-t" ]; then @@ -245,7 +245,7 @@ elif [ "$1" = "-t" ]; then reboot=1 ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim elif [ "$1" = "-c" ]; then @@ -447,6 +447,7 @@ elif [ "$1" = "-C" ]; then sudo systemctl stop cubesatsim sudo systemctl stop rpitx + sudo systemctl stop command sudo mv -f /home/pi/CubeSatSim/telem.txt /home/pi/CubeSatSim/telem.txt.bk @@ -540,6 +541,28 @@ elif [ "$1" = "-d" ]; then fi + FILE=/home/pi/CubeSatSim/command_control + if [ -f "$FILE" ]; then + echo + + else + echo "Radio command and control is OFF" + echo + echo "Do you want to set command and control to ON (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control set to ON" + sudo touch /home/pi/CubeSatSim/command_control + echo "restarting command and control" +# reboot=1 + sudo systemctl restart command +## sudo reboot now + fi + + fi + elif [ "$1" = "-R" ]; then @@ -869,7 +892,7 @@ elif [ "$1" = "-h" ]; then echo " -f Change to FSK/DUV mode" echo " -b Change to BPSK mode" echo " -s Change to SSTV mode" - echo " -i Reboots CubeSatsim software" + 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" @@ -881,8 +904,8 @@ elif [ "$1" = "-h" ]; then echo " -R Change the Commands Count in the file command_count.txt" echo " -B Change Safe Mode (battery saver mode) manually" echo " -q Change the Squelch setting for command receiver" - echo " -F Change the rx and tx frequency" - echo " -H Chnage the Balloon mode" + echo " -F Change the RX and TX frequency" + echo " -H Change the Balloon (HAB) mode" echo " -p Display payload sensor data" echo " -v Display voltage and current data" echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX" @@ -905,7 +928,7 @@ fi if [ "$reboot" = "1" ] ; then if [ "$noreboot" = "0" ] ; then - echo 'Reboot due to mode change!' | wall + echo 'Reboot due to config change!' | wall echo "Rebooting" sudo systemctl stop rpitx sudo reboot now From 12c765804c8673fe6913b070fad0b1cc43530551 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:30:19 -0400 Subject: [PATCH 149/402] Update aprs_in.py add logging.waring of each line --- aprs_in.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aprs_in.py b/aprs_in.py index 6f61b015..6363db0e 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -19,6 +19,7 @@ if __name__ == "__main__": for line in sys.stdin: # if (debug_mode): print(line, end =" ") + logging.warning(line) # if '^c' == line.rstrip(): # break From 376502fdfb4e3bb01055386c7a2d01c614d31821 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:36:56 -0400 Subject: [PATCH 150/402] Update command move 20 sec --- command | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/command b/command index b4b999d8..b026f648 100755 --- a/command +++ b/command @@ -23,12 +23,14 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" # exit 1 fi +echo "Waiting 20 seconds for USB" + +sleep 20 + FILE=/home/pi/CubeSatSim/command_control_direwolf if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then - echo "Starting direwolf after 20 second delay" - - sleep 20 + echo "Starting Direwolf DTMF and APRS Command and Control" if [ "$1" = "d" ]; then @@ -42,7 +44,7 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then fi else - echo "Starting squelch C&C" + echo "Starting Carrier (squelch) Command and Control" if [ "$1" = "d" ]; then From 381399fffd7a3b1e7d6f4f6f7f4662ab29b5ae8d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:43:21 -0400 Subject: [PATCH 151/402] Update and rename aprs_in.py to dtmf_aprs_cc.py and fix log --- aprs_in.py => dtmf_aprs_cc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename aprs_in.py => dtmf_aprs_cc.py (98%) diff --git a/aprs_in.py b/dtmf_aprs_cc.py similarity index 98% rename from aprs_in.py rename to dtmf_aprs_cc.py index 6363db0e..1da9797b 100644 --- a/aprs_in.py +++ b/dtmf_aprs_cc.py @@ -4,7 +4,8 @@ import RPi.GPIO as GPIO from RPi.GPIO import output from time import sleep import logging -logging.warning('CC-Warning!') +logging.basicConfig(format='%(message)s') +# logging.warning('CC-Warning!') if __name__ == "__main__": powerPin = 16 From 45c68a3619c9eeedb9de52aa18231af417f530b8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:44:24 -0400 Subject: [PATCH 152/402] Update command changed to dtmf_aprs_cc filename --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index b026f648..9d96cb24 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From e224c01bc91712c29323a4b09812732e05d45ae0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:58:33 -0400 Subject: [PATCH 153/402] Update main.c added echo broadcast to wall for shutdown and reboots --- main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 75e9bb2f..b16d0cf8 100644 --- a/main.c +++ b/main.c @@ -800,7 +800,11 @@ int main(int argc, char * argv[]) { fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage); digitalWrite(txLed, txLedOff); digitalWrite(onLed, onLedOff); - + + FILE * file6; + file6 = popen("echo 'shutdown due to low battery voltage!' | wall", "r"); + pclose(file6); + sleep(1); digitalWrite(onLed, onLedOn); sleep(1); @@ -810,7 +814,6 @@ int main(int argc, char * argv[]) { sleep(1); digitalWrite(onLed, onLedOff); - FILE * file6; // = popen("/home/pi/CubeSatSim/log > shutdown_log.txt", "r"); file6 = popen("sudo shutdown -h now > /dev/null 2>&1", "r"); pclose(file6); sleep(10); @@ -2140,6 +2143,8 @@ if (setting == ON) { fprintf(stderr,"Turning Safe Mode ON\n"); fprintf(stderr,"Turning Battery saver mode ON\n"); if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { + command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r"); + pclose(command) command = popen("sudo reboot now", "r"); pclose(command); sleep(60); @@ -2154,6 +2159,8 @@ if (setting == ON) { pclose(command); fprintf(stderr,"Turning Battery saver mode OFF\n"); if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { + command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r"); + pclose(command) command = popen("sudo reboot now", "r"); pclose(command); sleep(60); From 914ca2b9b08ab0c992a431bfa631b16a19bf8fa6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 11:04:56 -0400 Subject: [PATCH 154/402] Update main.c missing ; --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index e7879034..5b3b85c5 100644 --- a/main.c +++ b/main.c @@ -2147,7 +2147,7 @@ if (setting == ON) { fprintf(stderr,"Turning Battery saver mode ON\n"); if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r"); - pclose(command) + pclose(command); command = popen("sudo reboot now", "r"); pclose(command); sleep(60); @@ -2163,7 +2163,7 @@ if (setting == ON) { fprintf(stderr,"Turning Battery saver mode OFF\n"); if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r"); - pclose(command) + pclose(command); command = popen("sudo reboot now", "r"); pclose(command); sleep(60); From b6a82762608d290bc0b51d887b411253eb4f9aad Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 11:29:11 -0400 Subject: [PATCH 155/402] Update config added -Q --- config | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config b/config index ddd9a25e..baba560e 100755 --- a/config +++ b/config @@ -690,6 +690,14 @@ elif [ "$1" = "-q" ]; then ## sudo reboot now # sudo systemctl restart cubesatsim +elif [ "$1" = "-Q" ]; then + + echo + echo "Reading current Squelch for 10 seconds" + echo "Squelch is active low (0 means squelch broken)" + echo + + timeout 10 bash -c -- 'while true; do (gpio read 22 && sleep 1); done' elif [ "$1" = "-P" ]; then From f9cb1e1a870d879ce9e8283d501f66ae07e08745 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 11:30:36 -0400 Subject: [PATCH 156/402] Update config removed blank line --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index baba560e..62149c36 100755 --- a/config +++ b/config @@ -131,7 +131,7 @@ elif [ "$1" = "-a" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then echo "Safe Mode! Battery saver mode is ON." -# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi +# if ! grep force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else echo "Battery saver mode is OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt @@ -692,7 +692,7 @@ elif [ "$1" = "-q" ]; then elif [ "$1" = "-Q" ]; then - echo +# echo echo "Reading current Squelch for 10 seconds" echo "Squelch is active low (0 means squelch broken)" echo From 953cb4a7376c1a666f062bfe3142fff19df3012a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 13:44:20 -0400 Subject: [PATCH 157/402] Update command if direwolf mode but no soundcard, print --- command | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/command b/command index 9d96cb24..1f72333c 100755 --- a/command +++ b/command @@ -44,7 +44,17 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then fi else - echo "Starting Carrier (squelch) Command and Control" + + if [ -f "$FILE" ]; then + + echo "Direwolf mode set but no USB soundcard detected!" + echo "Instead, starting Carrier (squelch) Command and Control" + + else + + echo "Starting Carrier (squelch) Command and Control" + + fi if [ "$1" = "d" ]; then From 382dcce298f6b249a26e5374f9f1d761258ba2d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:08:57 -0400 Subject: [PATCH 158/402] Update install missing python --- install | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/install b/install index 4b5f3aef..9881f5f6 100755 --- a/install +++ b/install @@ -47,13 +47,11 @@ sudo dpkg -i wiringpi-latest.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 sudo pip3 install --upgrade setuptools -sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 - - +sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow cd ~/CubeSatSim From f1de675a3b797b8142003e7b0dd0d9f7f4df7882 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:16:36 -0400 Subject: [PATCH 159/402] Update update changed to python3-pil --- update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update b/update index 66f33928..8dc2c0c6 100755 --- a/update +++ b/update @@ -219,8 +219,8 @@ git pull --no-rebase > .updated_p script/install sudo apt-get update && sudo apt-get dist-upgrade -y - sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 -y - sudo pip3 install pillow + sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil +# sudo pip3 install pillow fi From 6f153062dcb9110fce1ed1230df1b99b0e24814f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:19:27 -0400 Subject: [PATCH 160/402] Update install python3-serial --- install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install b/install index 9881f5f6..96b0c694 100755 --- a/install +++ b/install @@ -47,11 +47,11 @@ sudo dpkg -i wiringpi-latest.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil python3-serial sudo pip3 install --upgrade setuptools -sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow +sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 cd ~/CubeSatSim From 8870177db7ba263f08cff462a1fff6c38cd5389c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:21:54 -0400 Subject: [PATCH 161/402] Update rpitx.py move ser.close() --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 280c58e5..b50d34e3 100644 --- a/rpitx.py +++ b/rpitx.py @@ -398,9 +398,9 @@ if __name__ == "__main__": # ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") ser.write(uhf_string.encode()) sleep(0.1) + ser.close() except: print("Error in serial write") - ser.close() output(pd, 0) sleep(10) # delay so cubesatsim code catches up From 970e39780c050aa48fb1a9701217cf3276b1aacf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:27:53 -0400 Subject: [PATCH 162/402] Update update changed to /boot/firmware --- update | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/update b/update index 8dc2c0c6..7929d66f 100755 --- a/update +++ b/update @@ -32,7 +32,7 @@ sudo sed -i 's/more information/more\ninformation/g' /etc/motd sudo sed -i 's/update to/update\nto/g' /etc/motd -sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # single core if Pi Zero 2 +sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2 cd /home/pi/CubeSatSim @@ -190,27 +190,27 @@ git pull --no-rebase > .updated_p echo "nothing to do for pi-power-button." fi - if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then - echo "dtparam=audio=on already in /boot/config.txt" + if [[ $(grep 'dtparam=audio=on' /boot/firmware/config.txt) ]]; then + echo "dtparam=audio=on already in /boot/firmware/config.txt" else - echo "adding dtparam=audio=on to /boot/config.txt" - sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt' + echo "adding dtparam=audio=on to /boot/firmware/config.txt" + sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/firmware/config.txt' FLAG=1 fi - if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then - echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt" + if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/firmware/config.txt) ]]; then + echo "dtoverlay=audremap,enable_jack=on already in /boot/firmware/config.txt" else - echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt' + echo "adding dtoverlay=audremap,enable_jack=on to /boot/firmware/config.txt" + sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/firmware/config.txt' FLAG=1 fi - if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then - echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt" + if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/firmware/config.txt) ]]; then + echo "dtoverlay=pwm,pin=18,func=2 already in /boot/firmware/config.txt" else - echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt' + echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/firmware/config.txt" + sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/firmware/config.txt' FLAG=1 cd /home/pi/pi-power-button @@ -224,24 +224,24 @@ git pull --no-rebase > .updated_p fi - if [[ $(grep 'disable_splash=1' /boot/config.txt) ]]; then - echo "disable_splash=1 already in /boot/config.txt" + if [[ $(grep 'disable_splash=1' /boot/firmware/config.txt) ]]; then + echo "disable_splash=1 already in /boot/firmware/config.txt" else - echo "adding to /boot/config.txt" - sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt' + echo "adding to /boot/firmware/config.txt" + sudo sh -c 'echo "\ndisable_splash=1" >> /boot/firmware/config.txt' FLAG=1 fi - if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then - echo "boot_delay=0 already in /boot/config.txt" + if [[ $(grep 'boot_delay=0' /boot/firmware/config.txt) ]]; then + echo "boot_delay=0 already in /boot/firmware/config.txt" else - echo "adding to /boot/config.txt" - sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt' + echo "adding to /boot/firmware/config.txt" + sudo sh -c 'echo "\nboot_delay=0" >> /boot/firmware/config.txt' FLAG=1 fi - if ! grep -q force_turbo=1 /boot/config.txt ; then - sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt' + if ! grep -q force_turbo=1 /boot/firmware/config.txt ; then + sudo sh -c 'echo "force_turbo=1" >> /boot/firmware/config.txt' FLAG=1 fi From deb73b8c2066e62bef9e2889683a6ff2cb9df3e4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:05:11 -0400 Subject: [PATCH 163/402] Update command dire wolf downsample -D 2 for lower cpu usage --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index 1f72333c..1c43ef12 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -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 -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 2 | 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 -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 2 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From ab53821e812f0fd52808bf9c6c5c3f67ff3f1cc5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:19:48 -0400 Subject: [PATCH 164/402] Update command.service changed to 15% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 9161a653..c3201151 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=11% +CPUQuota=15% [Install] WantedBy=default.target From f4ae72901d20e2578916fb8824d4b747f0614097 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:31:43 -0400 Subject: [PATCH 165/402] Update command.service remove cpu quota from command --- systemd/command.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/systemd/command.service b/systemd/command.service index c3201151..9354154f 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,8 +9,6 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root -CPUAccounting=true -CPUQuota=15% [Install] WantedBy=default.target From 9acae20e0d0871e3fae89a6497fbb877e157f6b9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:36:56 -0400 Subject: [PATCH 166/402] Update command dire wolf -D 3 --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index 1c43ef12..df2eee41 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 2 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 3 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 2 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 3 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From bcb4476b6474de74433be3eb55087fd5c63550b6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:38:52 -0400 Subject: [PATCH 167/402] Update update remove /firmware --- update | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/update b/update index 7929d66f..8dc2c0c6 100755 --- a/update +++ b/update @@ -32,7 +32,7 @@ sudo sed -i 's/more information/more\ninformation/g' /etc/motd sudo sed -i 's/update to/update\nto/g' /etc/motd -sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/firmware/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 cd /home/pi/CubeSatSim @@ -190,27 +190,27 @@ git pull --no-rebase > .updated_p echo "nothing to do for pi-power-button." fi - if [[ $(grep 'dtparam=audio=on' /boot/firmware/config.txt) ]]; then - echo "dtparam=audio=on already in /boot/firmware/config.txt" + if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then + echo "dtparam=audio=on already in /boot/config.txt" else - echo "adding dtparam=audio=on to /boot/firmware/config.txt" - sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/firmware/config.txt' + echo "adding dtparam=audio=on to /boot/config.txt" + sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt' FLAG=1 fi - if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/firmware/config.txt) ]]; then - echo "dtoverlay=audremap,enable_jack=on already in /boot/firmware/config.txt" + if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then + echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt" else - echo "adding dtoverlay=audremap,enable_jack=on to /boot/firmware/config.txt" - sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/firmware/config.txt' + echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt' FLAG=1 fi - if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/firmware/config.txt) ]]; then - echo "dtoverlay=pwm,pin=18,func=2 already in /boot/firmware/config.txt" + if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then + echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt" else - echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/firmware/config.txt" - sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/firmware/config.txt' + echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt' FLAG=1 cd /home/pi/pi-power-button @@ -224,24 +224,24 @@ git pull --no-rebase > .updated_p fi - if [[ $(grep 'disable_splash=1' /boot/firmware/config.txt) ]]; then - echo "disable_splash=1 already in /boot/firmware/config.txt" + if [[ $(grep 'disable_splash=1' /boot/config.txt) ]]; then + echo "disable_splash=1 already in /boot/config.txt" else - echo "adding to /boot/firmware/config.txt" - sudo sh -c 'echo "\ndisable_splash=1" >> /boot/firmware/config.txt' + echo "adding to /boot/config.txt" + sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt' FLAG=1 fi - if [[ $(grep 'boot_delay=0' /boot/firmware/config.txt) ]]; then - echo "boot_delay=0 already in /boot/firmware/config.txt" + if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then + echo "boot_delay=0 already in /boot/config.txt" else - echo "adding to /boot/firmware/config.txt" - sudo sh -c 'echo "\nboot_delay=0" >> /boot/firmware/config.txt' + echo "adding to /boot/config.txt" + sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt' FLAG=1 fi - if ! grep -q force_turbo=1 /boot/firmware/config.txt ; then - sudo sh -c 'echo "force_turbo=1" >> /boot/firmware/config.txt' + if ! grep -q force_turbo=1 /boot/config.txt ; then + sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt' FLAG=1 fi From 1026c5d82d60b70d6bada88cd4ac438439df4f3e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:42:25 -0400 Subject: [PATCH 168/402] Update update add power button -cc branch --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index 8dc2c0c6..e2801b57 100755 --- a/update +++ b/update @@ -159,7 +159,7 @@ fi cd /home/pi/pi-power-button -# git checkout reboot-mode-change +git checkout reboot-mode-change-cc git pull --no-rebase > .updated_p From 3da4ec5b97d9d186d1f623d5a4f607aa1c062107 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:58:21 -0400 Subject: [PATCH 169/402] Update command.service adding back 9% --- systemd/command.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/systemd/command.service b/systemd/command.service index 9354154f..f9b9ead2 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,6 +9,8 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root +CPUAccounting=true +CPUQuota=9% [Install] WantedBy=default.target From e93bb1fa583df6c883a965efcc831b98bcdddf9e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 11:04:07 -0400 Subject: [PATCH 170/402] Update command try -D 4 --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index df2eee41..f9a7998e 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 3 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 4 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 3 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 4 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From 4454818fb5b749e9aa97a002e2873293d37625d9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 11:07:23 -0400 Subject: [PATCH 171/402] Update command.service 10% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index f9b9ead2..1c4e2bc3 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=9% +CPUQuota=10% [Install] WantedBy=default.target From ce0b71bd50f2574e4b7e65aebbf80aa626726576 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 11:10:54 -0400 Subject: [PATCH 172/402] Update command.service remove cpu quota --- systemd/command.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/systemd/command.service b/systemd/command.service index 1c4e2bc3..9354154f 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,8 +9,6 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root -CPUAccounting=true -CPUQuota=10% [Install] WantedBy=default.target From 91b780e11250bae693a02a786fde101c9a120814 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 13:19:46 -0400 Subject: [PATCH 173/402] Update cubesatsim.service back to 5% --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 73436333..11966c22 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=4% +CPUQuota=5% [Install] WantedBy=default.target From f30dcd3c7dd2d8003a05743416dfeac370bb24f1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 13:22:11 -0400 Subject: [PATCH 174/402] Update main.c print loop time, no gps --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 5b3b85c5..2332d47f 100644 --- a/main.c +++ b/main.c @@ -563,8 +563,8 @@ int main(int argc, char * argv[]) { // #endif fclose(uptime_file); -// printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); -// fflush(stdout); + printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); + fflush(stdout); loopTime = millis(); { @@ -675,8 +675,8 @@ int main(int argc, char * argv[]) { if ((millis() - newGpsTime) > 60000) { longitude += rnd_float(-0.05, 0.05) / 100.0; // was .05 latitude += rnd_float(-0.05, 0.05) / 100.0; - printf("GPS Location with Rnd: %f, %f \n", latitude, longitude); - printf("GPS Location with Rnd: APRS %07.2f, %08.2f \n", toAprsFormat(latitude), toAprsFormat(longitude)); +// printf("GPS Location with Rnd: %f, %f \n", latitude, longitude); +// printf("GPS Location with Rnd: APRS %07.2f, %08.2f \n", toAprsFormat(latitude), toAprsFormat(longitude)); newGpsTime = millis(); } From c23c116d6fae1071505725d4918b4544814592d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 13:34:47 -0400 Subject: [PATCH 175/402] Update main.c change sleep from -250 to -750 to reduce from 5.6 --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 2332d47f..3a716960 100644 --- a/main.c +++ b/main.c @@ -1188,10 +1188,10 @@ void get_tlm_fox() { /**/ // while ((millis() - sampleTime) < (unsigned int)samplePeriod) int startSleep = millis(); - if ((millis() - sampleTime) < ((unsigned int)frameTime - 250)) // was 250 100 500 for FSK + if ((millis() - sampleTime) < ((unsigned int)frameTime - 750)) // was 250 100 500 for FSK // sleep(2.0); // 0.5); // 25); // initial period sleep(1.0); // 0.5); // 25); // initial period - while ((millis() - sampleTime) < ((unsigned int)frameTime - 250)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime - 750)) // was 250 100 sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ From 40b0343ccfa03c287a3c1d84c383257167d9398b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 14:27:22 -0400 Subject: [PATCH 176/402] Update main.c add pi_zero_2_offset --- main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 3a716960..7cf3f1e5 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,6 @@ int main(int argc, char * argv[]) { - char resbuffer[1000]; const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902120'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 @@ -41,6 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); + pi_zero_2_offset = 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); @@ -646,7 +646,7 @@ int main(int argc, char * argv[]) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING - printf("sensor: %f ", sensor[count1]); // print sensor data +// printf("sensor: %f ", sensor[count1]); // print sensor data // #endif token = strtok(NULL, space); } @@ -1188,10 +1188,10 @@ void get_tlm_fox() { /**/ // while ((millis() - sampleTime) < (unsigned int)samplePeriod) int startSleep = millis(); - if ((millis() - sampleTime) < ((unsigned int)frameTime - 750)) // was 250 100 500 for FSK + if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 500 for FSK // sleep(2.0); // 0.5); // 25); // initial period sleep(1.0); // 0.5); // 25); // initial period - while ((millis() - sampleTime) < ((unsigned int)frameTime - 750)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offse)) // was 250 100 sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ @@ -1980,7 +1980,7 @@ int get_payload_serial(int debug_camera) { if (serialDataAvail(uart_fd)) { char octet = (char) serialGetchar(uart_fd); - printf("%c", octet); +// printf("%c", octet); fflush(stdout); if (start_flag_complete) { @@ -1996,7 +1996,7 @@ int get_payload_serial(int debug_camera) { if (flag_count >= strlen(end_flag)) { // complete image index1 -= strlen(end_flag); buffer2[index1++] = 0; - printf(" Payload length: %d \n",index1); +// printf(" Payload length: %d \n",index1); // write_jpg(); finished = TRUE; From b2f36403ab1e349597106f87df0b0b131e9deb85 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 14:28:05 -0400 Subject: [PATCH 177/402] Update main.h add pi_zero_2_offset --- main.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.h b/main.h index 136718cb..92c2e3f4 100644 --- a/main.h +++ b/main.h @@ -187,7 +187,9 @@ int jpeg_start = 0; #define CAMERA_TIMEOUT 2000 // 10000 // 20000 // Payload timeout in milli seconds void battery_saver(int setting); -int battery_saver_check(); +int battery_saver_check(); +int pi_zero_2_offset = 0; + int hab_mode = FALSE; int battery_saver_mode = FALSE; From 428432551611cb50de25d047afedd551591dc214 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 16:46:05 -0400 Subject: [PATCH 178/402] Update main.c typo missing t --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 7cf3f1e5..a75104ea 100644 --- a/main.c +++ b/main.c @@ -1191,7 +1191,7 @@ void get_tlm_fox() { if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 500 for FSK // sleep(2.0); // 0.5); // 25); // initial period sleep(1.0); // 0.5); // 25); // initial period - while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offse)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ From e9837610ebd1b90d0cb5dc1102d3141fa7d17f5b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 16:49:19 -0400 Subject: [PATCH 179/402] Update main.c change pi zero 2 offset to 700 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index a75104ea..2c103d2f 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - pi_zero_2_offset = 500; + pi_zero_2_offset = 700; // 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); From c16dc95d7b31193d352199d5843c4daada43d616 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 16:55:56 -0400 Subject: [PATCH 180/402] Update main.c print sleep period --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 2c103d2f..e7bda1ce 100644 --- a/main.c +++ b/main.c @@ -1195,7 +1195,7 @@ void get_tlm_fox() { sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ -// printf("Sleep period: %d\n", millis() - startSleep); + printf("Sleep period: %d\n", millis() - startSleep); fflush(stdout); sampleTime = (unsigned int) millis(); From be1cd81fff16abd97b88783e3a4263e8ddfe0035 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 17:00:43 -0400 Subject: [PATCH 181/402] Update main.c print time for sleep --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index e7bda1ce..858f6c87 100644 --- a/main.c +++ b/main.c @@ -1195,7 +1195,7 @@ void get_tlm_fox() { sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ - printf("Sleep period: %d\n", millis() - startSleep); + printf("Sleep period: %d while period: %d\n", millis() - startSleep, (unsigned int)frameTime - 750 - pi_zero_2_offset); fflush(stdout); sampleTime = (unsigned int) millis(); From 957cafaae944d6fbe2c029fc5fb3b1464f0197de Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:36:59 -0400 Subject: [PATCH 182/402] Update update add pip3 installs --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index d877a13e..430cdf6f 100755 --- a/update +++ b/update @@ -204,7 +204,7 @@ git pull --no-rebase > .updated_p sudo apt-get update && sudo apt-get dist-upgrade -y sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 -y - sudo pip3 install pillow + sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow fi From cc62c7bae36474f0a3dcb0261cd0f89a290adc90 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:38:00 -0400 Subject: [PATCH 183/402] Update update add pip3 installs --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index e2801b57..bd1c4fee 100755 --- a/update +++ b/update @@ -220,7 +220,7 @@ git pull --no-rebase > .updated_p sudo apt-get update && sudo apt-get dist-upgrade -y sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil -# sudo pip3 install pillow + sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow fi From 7359ece7b4fa83a16d02ae32126c7729c03cb90a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:41:34 -0400 Subject: [PATCH 184/402] Update install fixed python installs --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 96b0c694..6b2243f2 100755 --- a/install +++ b/install @@ -47,7 +47,7 @@ sudo dpkg -i wiringpi-latest.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil python3-serial +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial sudo pip3 install --upgrade setuptools From fab375e7515c651f8650e63072925a95fd380880 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:54:59 -0400 Subject: [PATCH 185/402] Update main.c fixed pi 2 offset --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 858f6c87..43dbc271 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - pi_zero_2_offset = 700; // 500; + _2_offset = 700; // 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); @@ -1188,14 +1188,14 @@ void get_tlm_fox() { /**/ // while ((millis() - sampleTime) < (unsigned int)samplePeriod) int startSleep = millis(); - if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 500 for FSK + if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 + pi_zero_2_offset)) // was 250 100 500 for FSK // sleep(2.0); // 0.5); // 25); // initial period sleep(1.0); // 0.5); // 25); // initial period - while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 + pi_zero_2_offset)) // was 250 100 sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ - printf("Sleep period: %d while period: %d\n", millis() - startSleep, (unsigned int)frameTime - 750 - pi_zero_2_offset); + printf("Sleep period: %d while period: %d\n", millis() - startSleep, (unsigned int)frameTime - 750 + pi_zero_2_offset); fflush(stdout); sampleTime = (unsigned int) millis(); From 0c1babcec5e075ca28767cb356621d72fa7693dd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:56:08 -0400 Subject: [PATCH 186/402] Update main.c typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 43dbc271..b64a4e59 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - _2_offset = 700; // 500; + pi_zero_2_offset = 700; // 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); From 47299a91d10683daf57dbad9661ac78da871df4b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 09:28:10 -0400 Subject: [PATCH 187/402] Update main.c sleep prints --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index b64a4e59..ac14ed71 100644 --- a/main.c +++ b/main.c @@ -1195,7 +1195,7 @@ void get_tlm_fox() { sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ - printf("Sleep period: %d while period: %d\n", millis() - startSleep, (unsigned int)frameTime - 750 + pi_zero_2_offset); + printf("Start sleep %d Sleep period: %d while period: %d\n", startSleep, millis() - startSleep, (unsigned int)frameTime - 750 + pi_zero_2_offset); fflush(stdout); sampleTime = (unsigned int) millis(); From aca3625b0f0c9226512653515469dfdc56bf2923 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 09:35:52 -0400 Subject: [PATCH 188/402] Update cubesatsim.service increase to 7% --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 11966c22..1101dc9e 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=7% [Install] WantedBy=default.target From 0ff8ae7716153372e604e1b633271ca892a0706e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 09:47:08 -0400 Subject: [PATCH 189/402] Update main.c debug payload read --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index ac14ed71..d0dc9df4 100644 --- a/main.c +++ b/main.c @@ -1980,7 +1980,7 @@ int get_payload_serial(int debug_camera) { if (serialDataAvail(uart_fd)) { char octet = (char) serialGetchar(uart_fd); -// printf("%c", octet); + printf("%c", octet); fflush(stdout); if (start_flag_complete) { @@ -1996,7 +1996,7 @@ int get_payload_serial(int debug_camera) { if (flag_count >= strlen(end_flag)) { // complete image index1 -= strlen(end_flag); buffer2[index1++] = 0; -// printf(" Payload length: %d \n",index1); + printf(" Payload length: %d \n",index1); // write_jpg(); finished = TRUE; From 95607a19a2d4f5bb1fb7b1a9145ecf0850edf720 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 10:02:41 -0400 Subject: [PATCH 190/402] Update main.h reduce camera timeout to 1s --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index 92c2e3f4..20d9b090 100644 --- a/main.h +++ b/main.h @@ -184,7 +184,7 @@ int start_flag_detected = FALSE; int start_flag_complete = FALSE; int end_flag_detected = FALSE; int jpeg_start = 0; -#define CAMERA_TIMEOUT 2000 // 10000 // 20000 // Payload timeout in milli seconds +#define CAMERA_TIMEOUT 1000 // 2000 // 10000 // 20000 // Payload timeout in milli seconds void battery_saver(int setting); int battery_saver_check(); From fa628ee0100ae26a923a7f7448def0880fb12f9b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 10:03:28 -0400 Subject: [PATCH 191/402] Update main.h change payload timeout to 1.5 s --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index 20d9b090..531d32e0 100644 --- a/main.h +++ b/main.h @@ -184,7 +184,7 @@ int start_flag_detected = FALSE; int start_flag_complete = FALSE; int end_flag_detected = FALSE; int jpeg_start = 0; -#define CAMERA_TIMEOUT 1000 // 2000 // 10000 // 20000 // Payload timeout in milli seconds +#define CAMERA_TIMEOUT 1500 // 2000 // 10000 // 20000 // Payload timeout in milli seconds void battery_saver(int setting); int battery_saver_check(); From 3f2eb6c061eaa10c2d3257ec1cd74eb58ef1db49 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 11:16:31 -0400 Subject: [PATCH 192/402] Update main.h payload timeout back to 2s --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index 531d32e0..bb1eb31f 100644 --- a/main.h +++ b/main.h @@ -184,7 +184,7 @@ int start_flag_detected = FALSE; int start_flag_complete = FALSE; int end_flag_detected = FALSE; int jpeg_start = 0; -#define CAMERA_TIMEOUT 1500 // 2000 // 10000 // 20000 // Payload timeout in milli seconds +#define CAMERA_TIMEOUT 2000 // 1500 // 2000 // 10000 // 20000 // Payload timeout in milli seconds void battery_saver(int setting); int battery_saver_check(); From 9ce364ed7b9c6c67ab724751aafd9407cbcec2e9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 17:21:33 -0400 Subject: [PATCH 193/402] Update main.c get payload --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index d0dc9df4..829900e2 100644 --- a/main.c +++ b/main.c @@ -381,7 +381,10 @@ int main(int argc, char * argv[]) { if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600 printf("Serial opened to Pico\n"); -// payload = ON; +// payload = ON; + payload = get_payload_serial(FALSE); + printf("get_payload_status: %d \n", payload); // not debug + } else { fprintf(stderr, "Unable to open UART: %s\n -> Did you configure /boot/config.txt and /boot/cmdline.txt?\n", strerror(errno)); } @@ -614,7 +617,7 @@ int main(int argc, char * argv[]) { // if ((payload == ON) && (mode != BPSK)) { // moved to here // STEMBoardFailure = 0; payload = get_payload_serial(FALSE); -// printf("get_payload_status: %d \n", payload); // not debug + printf("get_payload_status: %d \n", payload); // not debug fflush(stdout); // printf("String: %s\n", buffer2); fflush(stdout); From 70aac04d4d6af6fe68c5d255488d5df2aee4f3bc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 17:25:55 -0400 Subject: [PATCH 194/402] Update main.c print opening serial --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 829900e2..8f03c580 100644 --- a/main.c +++ b/main.c @@ -378,12 +378,12 @@ int main(int argc, char * argv[]) { if (!ax5043) // don't test for payload if AX5043 is present { payload = OFF; - + fprintf(stderr,"Opening serial\n"); if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600 - printf("Serial opened to Pico\n"); + fprintf(stderr,"Serial opened to Pico\n"); // payload = ON; payload = get_payload_serial(FALSE); - printf("get_payload_status: %d \n", payload); // not debug + fprintf(stderr,"Get_payload_status: %d \n", payload); // not debug } else { fprintf(stderr, "Unable to open UART: %s\n -> Did you configure /boot/config.txt and /boot/cmdline.txt?\n", strerror(errno)); From 8bd98edd3c295e38cff42c32c7ede32e1ccf6304 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 6 Jul 2024 08:39:42 -0400 Subject: [PATCH 195/402] Update command remove downsampling --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index f9a7998e..1f72333c 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 4 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 4 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From b4e84264dc4529436cd1ebf02e0aa0b0171e2848 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 7 Jul 2024 09:39:06 -0400 Subject: [PATCH 196/402] Update main.c change pi zero 2 offset to 500 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 8f03c580..11fd4f0d 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - pi_zero_2_offset = 700; // 500; + pi_zero_2_offset = 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); From ed83dcf2b84a449a35b72411f68881d473eb6d46 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 11:54:28 -0400 Subject: [PATCH 197/402] Update main.c add sleep 10 for Pi Zero --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 11fd4f0d..d4e678d9 100644 --- a/main.c +++ b/main.c @@ -37,10 +37,14 @@ int main(int argc, char * argv[]) { fprintf(stderr, " %x \n", resbuffer[1]); if ((resbuffer[0] == '9') && (resbuffer[1] == '0')) { - sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); pi_zero_2_offset = 500; + sleep(5); // try sleep at start to help boot + } + else { + printf("Pi Zero detected\n"); + sleep(10); } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); From 4fb596fd1a49565923e0acb1d2e14242cac5f643 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 15:04:01 -0400 Subject: [PATCH 198/402] Update update add shutdown power button fix --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index bd1c4fee..c766aaac 100755 --- a/update +++ b/update @@ -159,7 +159,7 @@ fi cd /home/pi/pi-power-button -git checkout reboot-mode-change-cc +git checkout reboot-mode-change-beta git pull --no-rebase > .updated_p From 5836db7ecb2ba5f81fb40a4c019d2b6ec936c594 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 15:17:55 -0400 Subject: [PATCH 199/402] Update main.c if command and control off, don't add extra delay --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index d4e678d9..a82dfc4a 100644 --- a/main.c +++ b/main.c @@ -43,7 +43,10 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot } else { - printf("Pi Zero detected\n"); + printf("Pi Zero detected\n"); + FILE * command_file = fopen("/home/pi/CubeSatSim/command_control", "r"); + if (command_file == NULL) + pi_zero_offset = 500; sleep(10); } From 1f44cfedf7cb7c160648509ebfe312f5c93dd65d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 15:19:23 -0400 Subject: [PATCH 200/402] Update main.c typo in offset --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index a82dfc4a..88a5ade4 100644 --- a/main.c +++ b/main.c @@ -46,7 +46,7 @@ int main(int argc, char * argv[]) { printf("Pi Zero detected\n"); FILE * command_file = fopen("/home/pi/CubeSatSim/command_control", "r"); if (command_file == NULL) - pi_zero_offset = 500; + pi_zero_2_offset = 500; sleep(10); } From 880cdce572f1c1a0936bbc5b25941df032002f59 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 15:47:01 -0400 Subject: [PATCH 201/402] Update main.c check for both c&c and direwolf --- main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 88a5ade4..b6244be3 100644 --- a/main.c +++ b/main.c @@ -45,8 +45,15 @@ int main(int argc, char * argv[]) { else { printf("Pi Zero detected\n"); FILE * command_file = fopen("/home/pi/CubeSatSim/command_control", "r"); - if (command_file == NULL) + if (command_file == NULL) { pi_zero_2_offset = 500; + printf("Command and control is OFF\n"); + } + command_file = fopen("/home/pi/CubeSatSim/command_control_direwolf", "r"); + if (command_file == NULL) { + pi_zero_2_offset = 500; + printf("Command and control Carrier (squelch) is ON\n"); + } sleep(10); } @@ -572,10 +579,6 @@ int main(int argc, char * argv[]) { // printf("INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime); // #endif fclose(uptime_file); - - printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); - fflush(stdout); - loopTime = millis(); { int count1; @@ -1211,6 +1214,10 @@ void get_tlm_fox() { sampleTime = (unsigned int) millis(); } else printf("first time - no sleep\n"); + + printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); + fflush(stdout); + loopTime = millis(); // if (mode == FSK) { // just moved From acdd148a530a4eba37c50e21f4790134e4a55747 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 15:54:08 -0400 Subject: [PATCH 202/402] Update main.h added loopTime --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index bb1eb31f..7b8a2c8c 100644 --- a/main.h +++ b/main.h @@ -193,3 +193,4 @@ int pi_zero_2_offset = 0; int hab_mode = FALSE; int battery_saver_mode = FALSE; +long int loopTime; From 8aeb6f55691db4ef83c2cc401ec8ad9c31fa2ee5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 15:54:29 -0400 Subject: [PATCH 203/402] Update main.c move loopTime --- main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.c b/main.c index b6244be3..de204f25 100644 --- a/main.c +++ b/main.c @@ -19,7 +19,6 @@ * along with this program. If not, see . */ - #include "main.h" //#define HAB // uncomment to change APRS icon from Satellite to Balloon and only BAT telemetry @@ -555,8 +554,7 @@ int main(int argc, char * argv[]) { other_min[i] = 1000.0; other_max[i] = -1000.0; } - - long int loopTime; + loopTime = millis(); while (loop-- != 0) { From ccfd2617dcd69543e01ccfdc56453099964f39bc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 16:01:11 -0400 Subject: [PATCH 204/402] Update main.c fixed delay detection --- main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index de204f25..d4c4ce91 100644 --- a/main.c +++ b/main.c @@ -47,11 +47,12 @@ int main(int argc, char * argv[]) { if (command_file == NULL) { pi_zero_2_offset = 500; printf("Command and control is OFF\n"); - } - command_file = fopen("/home/pi/CubeSatSim/command_control_direwolf", "r"); - if (command_file == NULL) { - pi_zero_2_offset = 500; - printf("Command and control Carrier (squelch) is ON\n"); + } else { + command_file = fopen("/home/pi/CubeSatSim/command_control_direwolf", "r"); + if (command_file == NULL) { + pi_zero_2_offset = 500; + printf("Command and control Carrier (squelch) is ON\n"); + } } sleep(10); } From feb9c809093a5c61611f3e17bfb8ab5ba213b66c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 16:12:13 -0400 Subject: [PATCH 205/402] Update config add warning about no sound card if dire wolf is chosen --- config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config b/config index 62149c36..20e45c1b 100755 --- a/config +++ b/config @@ -505,6 +505,11 @@ elif [ "$1" = "-d" ]; then echo echo "Change command and control Direwolf state" echo + if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then + else + echo "Note: No USB Sound Card is plugged in!" + echo "Direwolf will not run unless one is plugged in." + fi FILE=/home/pi/CubeSatSim/command_control_direwolf if [ -f "$FILE" ]; then From c98599c7487cdd5ebc6d1578eb82b706e5b3ee08 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 16:19:59 -0400 Subject: [PATCH 206/402] Update config with noop --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index 20e45c1b..0960baa8 100755 --- a/config +++ b/config @@ -506,6 +506,7 @@ elif [ "$1" = "-d" ]; then echo "Change command and control Direwolf state" echo if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then + : else echo "Note: No USB Sound Card is plugged in!" echo "Direwolf will not run unless one is plugged in." From dead11a75f9d3830118601087fde14b5d4f400d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 16:20:55 -0400 Subject: [PATCH 207/402] Update config put PL on same line --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index 0960baa8..7a8a17ab 100755 --- a/config +++ b/config @@ -92,8 +92,8 @@ if [ "$1" = "" ]; then echo -n "RX PL code is: " echo ${10} - echo - echo -n "TX PL code is: " +# echo + echo -n " TX PL code is: " echo ${11} echo From 6b945ee811d2b66b02ea6d0a44518028efa8c69f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 16:21:37 -0400 Subject: [PATCH 208/402] Update config PL one line fixed --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 7a8a17ab..ae05acb9 100755 --- a/config +++ b/config @@ -91,7 +91,7 @@ if [ "$1" = "" ]; then echo echo -n "RX PL code is: " - echo ${10} + echo -n ${10} # echo echo -n " TX PL code is: " echo ${11} From b5255ab054a3a28f1a65ade9f950a840df8cffb0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 16:22:56 -0400 Subject: [PATCH 209/402] Update config fix sound card detection --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index ae05acb9..515d816d 100755 --- a/config +++ b/config @@ -505,7 +505,7 @@ elif [ "$1" = "-d" ]; then echo echo "Change command and control Direwolf state" echo - if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then + if [[ $(arecord -l | grep card) ]]; then : else echo "Note: No USB Sound Card is plugged in!" From 01bde636d91490aef21d294b4e29028f54c36e12 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 8 Jul 2024 16:49:51 -0400 Subject: [PATCH 210/402] Update config restart CubeSatSim if direwolf turned on --- config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config b/config index 515d816d..229bedf7 100755 --- a/config +++ b/config @@ -542,6 +542,10 @@ elif [ "$1" = "-d" ]; then ## echo "rebooting" # reboot=1 sudo systemctl restart command + if [[ $(arecord -l | grep card) ]]; then + echo "restarting cubesaatsim software" + sudo systemctl restart cubesatsim + fi ## sudo reboot now fi From 2c4a233f612f87b94666b1a147217d5e1ca07167 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 10:43:03 -0400 Subject: [PATCH 211/402] Update update check pi-power-button for beta branch --- update | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/update b/update index c766aaac..c92b1450 100755 --- a/update +++ b/update @@ -159,9 +159,23 @@ fi cd /home/pi/pi-power-button -git checkout reboot-mode-change-beta +git checkout reboot-mode-change-beta > .updated_b -git pull --no-rebase > .updated_p + grep 'error' /home/pi/pi-power-button/.updated_b + if [[ $(grep 'error' /home/pi/pi-power-button/.updated_b) ]]; then + + echo "pi-power-button switching to beta branch" + + git pull + + git checkout reboot-mode-change-beta + + script/install + + FLAG=1 + fi + + git pull --no-rebase > .updated_p grep 'changed' /home/pi/pi-power-button/.updated_p if [[ $(grep 'changed' /home/pi/pi-power-button/.updated_p) ]]; then From 7a693c68269353f42bf7101323d5651a86d294d8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 11:32:00 -0400 Subject: [PATCH 212/402] Update install change pi-power-button to beta branch --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 6b2243f2..07b5516a 100755 --- a/install +++ b/install @@ -86,7 +86,7 @@ git clone https://github.com/alanbjohnston/pi-power-button.git cd pi-power-button -git checkout reboot-mode-change +git checkout reboot-mode-change-beta ./script/install From bdd1bf66f2846adee671502ed08e087b75f05053 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:01:42 -0400 Subject: [PATCH 213/402] Update config add -A to transmit APRS command --- config | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/config b/config index 229bedf7..e4d29de9 100755 --- a/config +++ b/config @@ -899,7 +899,42 @@ elif [ "$1" = "-v" ]; then echo /home/pi/CubeSatSim/telem +elif [ "$1" = "-A" ]; then + + echo "Transmit APRS control packets to control another CubeSatSim" + echo + echo + + sudo systemctl stop cubesatsim + + echo -n "Enter the mode number to change: 1=APRS, 2=FSK, 3=BPSK, 4=SSTV, 5=CW" + read MODE + + case $MODE in + + 1) + echo "Mode 1 is APRS" + ;; + 2) + echo "Mode 2 is FSK" + ;; + 3) + echo "Mode 3 is BPSK" + ;; + 4) + echo "Mode 4 is SSTV" + ;; + 5) + echo "Mode 5 is CW" + ;; + *) + echo "Unknown mode" + ;; + esac + + elif [ "$1" = "-h" ]; then + echo "config OPTION" echo echo "Changes CubeSatSim mode, resets, or modifies configuration file" @@ -927,6 +962,7 @@ elif [ "$1" = "-h" ]; then echo " -p Display payload sensor data" echo " -v Display voltage and current data" echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX" + echo " -A Transmit APRS control packets to control another CubeSatSim" echo exit From a3b9396ba3d9ad313165715a29a159cf178b3845 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:13:43 -0400 Subject: [PATCH 214/402] Update config add APRS tx --- config | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/config b/config index e4d29de9..4756b856 100755 --- a/config +++ b/config @@ -914,25 +914,36 @@ elif [ "$1" = "-A" ]; then 1) echo "Mode 1 is APRS" + STRING = "KU2Y-1>APCSS:MODE=a" ;; 2) echo "Mode 2 is FSK" + STRING = "KU2Y-1>APCSS:MODE=a" ;; 3) echo "Mode 3 is BPSK" + STRING = "KU2Y-1>APCSS:MODE=b" ;; 4) echo "Mode 4 is SSTV" + STRING = "KU2Y-1>APCSS:MODE=s" ;; 5) echo "Mode 5 is CW" + STRING = "KU2Y-1>APCSS:MODE=m" ;; *) echo "Unknown mode" + STRING = "KU2Y-1>APCSS:MODE=?" ;; esac + sudo rm /home/pi/CubeSatSim/t.txt + echo $STRING > /home/pi/CubeSatSim/t.txt + touch /home/pi/CubeSatSim/ready + sleep 1 + touch /home/pi/CubeSatSim/ready - + elif [ "$1" = "-h" ]; then echo "config OPTION" From b82b3d57ae1731e94d0b423d9ff551895c1627b7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:16:21 -0400 Subject: [PATCH 215/402] Update config fix variable --- config | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config b/config index 4756b856..fdc7c02d 100755 --- a/config +++ b/config @@ -914,27 +914,27 @@ elif [ "$1" = "-A" ]; then 1) echo "Mode 1 is APRS" - STRING = "KU2Y-1>APCSS:MODE=a" + STRING="KU2Y-1>APCSS:MODE=a" ;; 2) echo "Mode 2 is FSK" - STRING = "KU2Y-1>APCSS:MODE=a" + STRING="KU2Y-1>APCSS:MODE=a" ;; 3) echo "Mode 3 is BPSK" - STRING = "KU2Y-1>APCSS:MODE=b" + STRING="KU2Y-1>APCSS:MODE=b" ;; 4) echo "Mode 4 is SSTV" - STRING = "KU2Y-1>APCSS:MODE=s" + STRING="KU2Y-1>APCSS:MODE=s" ;; 5) echo "Mode 5 is CW" - STRING = "KU2Y-1>APCSS:MODE=m" + STRING="KU2Y-1>APCSS:MODE=m" ;; *) echo "Unknown mode" - STRING = "KU2Y-1>APCSS:MODE=?" + STRING="KU2Y-1>APCSS:MODE=?" ;; esac sudo rm /home/pi/CubeSatSim/t.txt From 36cf708cc8b3ac5a6b9824a65125959cc678028b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:19:34 -0400 Subject: [PATCH 216/402] Update config just restart on frequency change --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index fdc7c02d..b3aa151d 100755 --- a/config +++ b/config @@ -832,11 +832,11 @@ elif [ "$1" = "-F" ]; then # echo # else echo -## echo "Rebooting CubeSatSim with new configuration file" +## echo "Restarting CubeSatSim with new configuration file" ## echo - reboot=1 +# reboot=1 ## sudo reboot now -# sudo systemctl restart cubesatsim + sudo systemctl restart rpitx # fi elif [ "$1" = "-H" ]; then From fd489ff18938c40f9247145b245cd753c8133ed1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:31:54 -0400 Subject: [PATCH 217/402] Update config add while for -A --- config | 81 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/config b/config index b3aa151d..68a0224d 100755 --- a/config +++ b/config @@ -903,46 +903,55 @@ elif [ "$1" = "-A" ]; then echo "Transmit APRS control packets to control another CubeSatSim" echo - echo sudo systemctl stop cubesatsim - echo -n "Enter the mode number to change: 1=APRS, 2=FSK, 3=BPSK, 4=SSTV, 5=CW" - read MODE - - case $MODE in - - 1) - echo "Mode 1 is APRS" - STRING="KU2Y-1>APCSS:MODE=a" - ;; - 2) - echo "Mode 2 is FSK" - STRING="KU2Y-1>APCSS:MODE=a" - ;; - 3) - echo "Mode 3 is BPSK" - STRING="KU2Y-1>APCSS:MODE=b" - ;; - 4) - echo "Mode 4 is SSTV" - STRING="KU2Y-1>APCSS:MODE=s" - ;; - 5) - echo "Mode 5 is CW" - STRING="KU2Y-1>APCSS:MODE=m" - ;; - *) - echo "Unknown mode" - STRING="KU2Y-1>APCSS:MODE=?" - ;; - esac + sim="y" + + while [ "$sim" = "y" ] + do + + echo "Enter the mode number to change: 1=APRS, 2=FSK, 3=BPSK, 4=SSTV, 5=CW" + read MODE + + case $MODE in + + 1) + echo "Mode 1 is APRS" + STRING="KU2Y-1>APCSS:MODE=a" + ;; + 2) + echo "Mode 2 is FSK" + STRING="KU2Y-1>APCSS:MODE=a" + ;; + 3) + echo "Mode 3 is BPSK" + STRING="KU2Y-1>APCSS:MODE=b" + ;; + 4) + echo "Mode 4 is SSTV" + STRING="KU2Y-1>APCSS:MODE=s" + ;; + 5) + echo "Mode 5 is CW" + STRING="KU2Y-1>APCSS:MODE=m" + ;; + *) + echo "Unknown mode" + STRING="KU2Y-1>APCSS:MODE=?" + ;; + esac + sudo rm /home/pi/CubeSatSim/t.txt + echo $STRING > /home/pi/CubeSatSim/t.txt + touch /home/pi/CubeSatSim/ready + sleep 1 + touch /home/pi/CubeSatSim/ready + + echo "Do you want to send another command (y/n) " + read sim + done sudo rm /home/pi/CubeSatSim/t.txt - echo $STRING > /home/pi/CubeSatSim/t.txt - touch /home/pi/CubeSatSim/ready - sleep 1 - touch /home/pi/CubeSatSim/ready - + sudo systemctl restart cubesatsim elif [ "$1" = "-h" ]; then From 72e479cfc675ed67e7efce216af2f282fd63cc17 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:35:19 -0400 Subject: [PATCH 218/402] Update config adding print --- config | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config b/config index 68a0224d..53eb9272 100755 --- a/config +++ b/config @@ -943,11 +943,14 @@ elif [ "$1" = "-A" ]; then esac sudo rm /home/pi/CubeSatSim/t.txt echo $STRING > /home/pi/CubeSatSim/t.txt + echo -n "\nSending APRS packet " + echo $STRING touch /home/pi/CubeSatSim/ready - sleep 1 + sleep 5 touch /home/pi/CubeSatSim/ready - - echo "Do you want to send another command (y/n) " + + echo + echo "Do you want to send another APRS command packet (y/n) " read sim done sudo rm /home/pi/CubeSatSim/t.txt From 0f85239f5c4920575bae3660b7207fe627673aad Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:40:13 -0400 Subject: [PATCH 219/402] Update config sudo touch --- config | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config b/config index 53eb9272..cb40effb 100755 --- a/config +++ b/config @@ -943,15 +943,17 @@ elif [ "$1" = "-A" ]; then esac sudo rm /home/pi/CubeSatSim/t.txt echo $STRING > /home/pi/CubeSatSim/t.txt - echo -n "\nSending APRS packet " + echo + echo -n "Sending APRS packet " echo $STRING - touch /home/pi/CubeSatSim/ready + sudo touch /home/pi/CubeSatSim/ready sleep 5 - touch /home/pi/CubeSatSim/ready + sudo touch /home/pi/CubeSatSim/ready echo echo "Do you want to send another APRS command packet (y/n) " read sim + echo done sudo rm /home/pi/CubeSatSim/t.txt sudo systemctl restart cubesatsim From d86215a97284534c735414607db5f40438835fb3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:48:22 -0400 Subject: [PATCH 220/402] Update config restart after APRS commands --- config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config b/config index cb40effb..9fe19f2c 100755 --- a/config +++ b/config @@ -956,8 +956,9 @@ elif [ "$1" = "-A" ]; then echo done sudo rm /home/pi/CubeSatSim/t.txt - sudo systemctl restart cubesatsim - +# sudo systemctl restart cubesatsim + reboot=1 + elif [ "$1" = "-h" ]; then echo "config OPTION" From f555dcf62f719df8c8bc88008ae5c075f69034ec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 16:54:38 -0400 Subject: [PATCH 221/402] Update config fix ask mode --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 9fe19f2c..96ce4e01 100755 --- a/config +++ b/config @@ -922,7 +922,7 @@ elif [ "$1" = "-A" ]; then ;; 2) echo "Mode 2 is FSK" - STRING="KU2Y-1>APCSS:MODE=a" + STRING="KU2Y-1>APCSS:MODE=f" ;; 3) echo "Mode 3 is BPSK" From 99b886c09e2822e7f539655e2e21b5e3ecfeddd7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 17:02:29 -0400 Subject: [PATCH 222/402] Update config make APRS packet real --- config | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config b/config index 96ce4e01..dd3a44e0 100755 --- a/config +++ b/config @@ -918,27 +918,27 @@ elif [ "$1" = "-A" ]; then 1) echo "Mode 1 is APRS" - STRING="KU2Y-1>APCSS:MODE=a" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" ;; 2) echo "Mode 2 is FSK" - STRING="KU2Y-1>APCSS:MODE=f" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=f" ;; 3) echo "Mode 3 is BPSK" - STRING="KU2Y-1>APCSS:MODE=b" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=b" ;; 4) echo "Mode 4 is SSTV" - STRING="KU2Y-1>APCSS:MODE=s" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=s" ;; 5) echo "Mode 5 is CW" - STRING="KU2Y-1>APCSS:MODE=m" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE==m" ;; *) echo "Unknown mode" - STRING="KU2Y-1>APCSS:MODE=?" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=?" ;; esac sudo rm /home/pi/CubeSatSim/t.txt From 57c4c515ce270517f404e79e00147dafa1b420e3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 17:05:04 -0400 Subject: [PATCH 223/402] Update config make -F reboot --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index dd3a44e0..c0479ad9 100755 --- a/config +++ b/config @@ -834,9 +834,9 @@ elif [ "$1" = "-F" ]; then echo ## echo "Restarting CubeSatSim with new configuration file" ## echo -# reboot=1 + reboot=1 ## sudo reboot now - sudo systemctl restart rpitx +# sudo systemctl restart rpitx # fi elif [ "$1" = "-H" ]; then From d6a1dbd63ea233cc140abc4f9596ddb7c6cf1522 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 17:40:03 -0400 Subject: [PATCH 224/402] Update config fixed MODE=m typo --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index c0479ad9..c125c622 100755 --- a/config +++ b/config @@ -934,7 +934,7 @@ elif [ "$1" = "-A" ]; then ;; 5) echo "Mode 5 is CW" - STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE==m" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=m" ;; *) echo "Unknown mode" From b089be84a6806f0aaa387423eb7d3a2e9a236f25 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:18:00 -0400 Subject: [PATCH 225/402] Update rpitx.py add argument a to force aprs --- rpitx.py | 78 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/rpitx.py b/rpitx.py index b50d34e3..f14159d1 100644 --- a/rpitx.py +++ b/rpitx.py @@ -36,12 +36,12 @@ def command_control_check(): string = filec.write(command_count_string) filec.close() except: - if (debug_mode == 1): + if (debug_ == 1): print("Can't write command_count file!") print("Command_count: ") print(command_count) - increment_mode() + increment_() # if (command_tx == True): # print("Turning on transmit") @@ -64,27 +64,27 @@ def battery_saver_check(): f = open("/home/pi/CubeSatSim/battery_saver", "r") f.close() txc = False - print("Safe Mode!") + print("Safe !") print("battery saver activated") except: print("battery saver not activated") # txc = True -def increment_mode(): - print("increment mode") +def increment_(): + print("increment ") powerPin = 16 try: - file = open("/home/pi/CubeSatSim/.mode") - mode = file.read(1) + file = open("/home/pi/CubeSatSim/.") + = file.read(1) except: -# mode = "f" - if (debug_mode == 1): - print("Can't open .mode file") # , defaulting to FSK") +# = "f" + if (debug_ == 1): + print("Can't open . file") # , defaulting to FSK") file.close() - print("Mode is: ") - print(mode) - if (mode == 'a'): - mode = 'f' + print(" is: ") + print() + if ( == 'a'): + = 'f' GPIO.output(powerPin, 0) # blink two times sleep(0.1) GPIO.output(powerPin, 1) @@ -94,8 +94,8 @@ def increment_mode(): GPIO.output(powerPin, 1) sleep(2.5) - elif (mode == 'f'): - mode = 'b' + elif ( == 'f'): + = 'b' GPIO.output(powerPin, 0) # blink three times sleep(0.1) GPIO.output(powerPin, 1) @@ -109,8 +109,8 @@ def increment_mode(): GPIO.output(powerPin, 1) sleep(2.5) - elif (mode == 'b'): - mode = 's' + elif ( == 'b'): + = 's' GPIO.output(powerPin, 0) # blink four times sleep(0.1) GPIO.output(powerPin, 1) @@ -128,8 +128,8 @@ def increment_mode(): GPIO.output(powerPin, 1) sleep(2.5) - elif (mode == 's'): - mode = 'm' + elif ( == 's'): + = 'm' GPIO.output(powerPin, 0) # blink five times sleep(0.1) GPIO.output(powerPin, 1) @@ -151,18 +151,18 @@ def increment_mode(): GPIO.output(powerPin, 1) sleep(2.5) else: - mode = 'a' + = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) GPIO.output(powerPin, 1) sleep(2.5) try: - file = open("/home/pi/CubeSatSim/.mode", "w") + file = open("/home/pi/CubeSatSim/.", "w") count_string = str(command_count) - file.write(mode) + file.write() file.close() - print(".mode file written") + print(". file written") GPIO.setwarnings(False) GPIO.output(txLed, 0) @@ -174,13 +174,13 @@ def increment_mode(): # system("reboot -h now") # release = True; - print("Changing mode now") -# system("/home/pi/CubeSatSim/config -" + mode) + print("Changing now") +# system("/home/pi/CubeSatSim/config -" + ) system("reboot -h now") sleep(10); except: - print("can't write to .mode file") + print("can't write to . file") print("CubeSatSim v1.3.2 rpitx.py starting...") @@ -193,7 +193,7 @@ green = 16 command_tx = True -GPIO.setmode(GPIO.BCM) +GPIO.set(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) @@ -230,7 +230,7 @@ else: # GPIO.setup(txLed, GPIO.OUT) # output(txLed, txLedOff) -GPIO.setmode(GPIO.BCM) # Repeat to make LED work on Pi 4 +GPIO.set(GPIO.BCM) # Repeat to make LED work on Pi 4 GPIO.setwarnings(False) GPIO.setup(txLed, GPIO.OUT) @@ -262,21 +262,23 @@ print(txLed) debug_mode = 0 #no debugging rpitx if __name__ == "__main__": - + mode = "x" if (len(sys.argv)) > 1: # print("There are arguments!") if (('d' == sys.argv[1]) or ('-d' in sys.argv[1])): debug_mode = 1 - + else if (('a' == sys.argv[1]) or ('-a' in sys.argv[1])): + mode = "a" print(transmit) - try: - file = open("/home/pi/CubeSatSim/.mode") - mode = file.read(1) - except: - mode = "f" - if (debug_mode == 1): - print("Can't open .mode file, defaulting to FSK") + if ( mode == "x"): + try: + file = open("/home/pi/CubeSatSim/.mode") + mode = file.read(1) + except: + mode = "f" + if (debug_mode == 1): + print("Can't open .mode file, defaulting to FSK") print("Mode is: ") print(mode) From fa59a2856072f446f181f38cf5e6a7870f01a9e1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:19:09 -0400 Subject: [PATCH 226/402] Update config switch to aprs mode for -A --- config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config b/config index c125c622..730197d8 100755 --- a/config +++ b/config @@ -905,6 +905,9 @@ elif [ "$1" = "-A" ]; then echo sudo systemctl stop cubesatsim + sudo systemctl stop rpitx + + python3 -u /home/pi/CubeSatSim/rpitx.py a # Force APRS mode sim="y" From 5362df4c48a9db9ccb897e7d60ad8b633d640085 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:21:54 -0400 Subject: [PATCH 227/402] Update rpitx.py undo last edit --- rpitx.py | 78 +++++++++++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/rpitx.py b/rpitx.py index f14159d1..b50d34e3 100644 --- a/rpitx.py +++ b/rpitx.py @@ -36,12 +36,12 @@ def command_control_check(): string = filec.write(command_count_string) filec.close() except: - if (debug_ == 1): + if (debug_mode == 1): print("Can't write command_count file!") print("Command_count: ") print(command_count) - increment_() + increment_mode() # if (command_tx == True): # print("Turning on transmit") @@ -64,27 +64,27 @@ def battery_saver_check(): f = open("/home/pi/CubeSatSim/battery_saver", "r") f.close() txc = False - print("Safe !") + print("Safe Mode!") print("battery saver activated") except: print("battery saver not activated") # txc = True -def increment_(): - print("increment ") +def increment_mode(): + print("increment mode") powerPin = 16 try: - file = open("/home/pi/CubeSatSim/.") - = file.read(1) + file = open("/home/pi/CubeSatSim/.mode") + mode = file.read(1) except: -# = "f" - if (debug_ == 1): - print("Can't open . file") # , defaulting to FSK") +# mode = "f" + if (debug_mode == 1): + print("Can't open .mode file") # , defaulting to FSK") file.close() - print(" is: ") - print() - if ( == 'a'): - = 'f' + print("Mode is: ") + print(mode) + if (mode == 'a'): + mode = 'f' GPIO.output(powerPin, 0) # blink two times sleep(0.1) GPIO.output(powerPin, 1) @@ -94,8 +94,8 @@ def increment_(): GPIO.output(powerPin, 1) sleep(2.5) - elif ( == 'f'): - = 'b' + elif (mode == 'f'): + mode = 'b' GPIO.output(powerPin, 0) # blink three times sleep(0.1) GPIO.output(powerPin, 1) @@ -109,8 +109,8 @@ def increment_(): GPIO.output(powerPin, 1) sleep(2.5) - elif ( == 'b'): - = 's' + elif (mode == 'b'): + mode = 's' GPIO.output(powerPin, 0) # blink four times sleep(0.1) GPIO.output(powerPin, 1) @@ -128,8 +128,8 @@ def increment_(): GPIO.output(powerPin, 1) sleep(2.5) - elif ( == 's'): - = 'm' + elif (mode == 's'): + mode = 'm' GPIO.output(powerPin, 0) # blink five times sleep(0.1) GPIO.output(powerPin, 1) @@ -151,18 +151,18 @@ def increment_(): GPIO.output(powerPin, 1) sleep(2.5) else: - = 'a' + mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) GPIO.output(powerPin, 1) sleep(2.5) try: - file = open("/home/pi/CubeSatSim/.", "w") + file = open("/home/pi/CubeSatSim/.mode", "w") count_string = str(command_count) - file.write() + file.write(mode) file.close() - print(". file written") + print(".mode file written") GPIO.setwarnings(False) GPIO.output(txLed, 0) @@ -174,13 +174,13 @@ def increment_(): # system("reboot -h now") # release = True; - print("Changing now") -# system("/home/pi/CubeSatSim/config -" + ) + print("Changing mode now") +# system("/home/pi/CubeSatSim/config -" + mode) system("reboot -h now") sleep(10); except: - print("can't write to . file") + print("can't write to .mode file") print("CubeSatSim v1.3.2 rpitx.py starting...") @@ -193,7 +193,7 @@ green = 16 command_tx = True -GPIO.set(GPIO.BCM) +GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) @@ -230,7 +230,7 @@ else: # GPIO.setup(txLed, GPIO.OUT) # output(txLed, txLedOff) -GPIO.set(GPIO.BCM) # Repeat to make LED work on Pi 4 +GPIO.setmode(GPIO.BCM) # Repeat to make LED work on Pi 4 GPIO.setwarnings(False) GPIO.setup(txLed, GPIO.OUT) @@ -262,23 +262,21 @@ print(txLed) debug_mode = 0 #no debugging rpitx if __name__ == "__main__": - mode = "x" + if (len(sys.argv)) > 1: # print("There are arguments!") if (('d' == sys.argv[1]) or ('-d' in sys.argv[1])): debug_mode = 1 - else if (('a' == sys.argv[1]) or ('-a' in sys.argv[1])): - mode = "a" + print(transmit) - if ( mode == "x"): - try: - file = open("/home/pi/CubeSatSim/.mode") - mode = file.read(1) - except: - mode = "f" - if (debug_mode == 1): - print("Can't open .mode file, defaulting to FSK") + try: + file = open("/home/pi/CubeSatSim/.mode") + mode = file.read(1) + except: + mode = "f" + if (debug_mode == 1): + print("Can't open .mode file, defaulting to FSK") print("Mode is: ") print(mode) From 876c1ef0f27b6c137713cd573b81b5c13cb0344b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:25:28 -0400 Subject: [PATCH 228/402] Update rpitx.py add force APRS with a --- rpitx.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/rpitx.py b/rpitx.py index b50d34e3..3db29cf9 100644 --- a/rpitx.py +++ b/rpitx.py @@ -263,20 +263,23 @@ debug_mode = 0 #no debugging rpitx if __name__ == "__main__": + mode = "x" if (len(sys.argv)) > 1: # print("There are arguments!") if (('d' == sys.argv[1]) or ('-d' in sys.argv[1])): debug_mode = 1 - + else if (('a' == sys.argv[1]) or ('-a' in sys.argv[1])): + mode = "a" + print("Forcing APRS mode") print(transmit) - - try: - file = open("/home/pi/CubeSatSim/.mode") - mode = file.read(1) - except: - mode = "f" - if (debug_mode == 1): - print("Can't open .mode file, defaulting to FSK") + if ( mode == "x"): + try: + file = open("/home/pi/CubeSatSim/.mode") + mode = file.read(1) + except: + mode = "f" + if (debug_mode == 1): + print("Can't open .mode file, defaulting to FSK") print("Mode is: ") print(mode) From 562a3fb6076cb6ffd960ffce4cf16a3005107971 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:26:33 -0400 Subject: [PATCH 229/402] Update rpitx.py fix elif --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 3db29cf9..5f2ec96c 100644 --- a/rpitx.py +++ b/rpitx.py @@ -268,7 +268,7 @@ if __name__ == "__main__": # print("There are arguments!") if (('d' == sys.argv[1]) or ('-d' in sys.argv[1])): debug_mode = 1 - else if (('a' == sys.argv[1]) or ('-a' in sys.argv[1])): + elif (('a' == sys.argv[1]) or ('-a' in sys.argv[1])): mode = "a" print("Forcing APRS mode") print(transmit) From c35e99ea895895eeb300413eef5355a083f8d100 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:28:52 -0400 Subject: [PATCH 230/402] Update config -A background --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 730197d8..cc0e8639 100755 --- a/config +++ b/config @@ -907,7 +907,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop cubesatsim sudo systemctl stop rpitx - python3 -u /home/pi/CubeSatSim/rpitx.py a # Force APRS mode + python3 -u /home/pi/CubeSatSim/rpitx.py a > /dev/null 2>&1 & # Force APRS mode sim="y" From 75aad42a94d52219d114d797b875acf20b193569 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:33:43 -0400 Subject: [PATCH 231/402] Update config delete old t.txt --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index cc0e8639..2251c392 100755 --- a/config +++ b/config @@ -906,6 +906,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop cubesatsim sudo systemctl stop rpitx + sudo rm /home/pi/CubeSatSim/t.txt python3 -u /home/pi/CubeSatSim/rpitx.py a > /dev/null 2>&1 & # Force APRS mode From a3672f275eccd3433c19ab297d65ad12a05852e2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:40:27 -0400 Subject: [PATCH 232/402] Update config look at output --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 2251c392..b93369b0 100755 --- a/config +++ b/config @@ -908,7 +908,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop rpitx sudo rm /home/pi/CubeSatSim/t.txt - python3 -u /home/pi/CubeSatSim/rpitx.py a > /dev/null 2>&1 & # Force APRS mode + python3 -u /home/pi/CubeSatSim/rpitx.py a # > /dev/null 2>&1 & # Force APRS mode sim="y" From e1f060426c28b468864dc1a750827ba35e76aef7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:45:04 -0400 Subject: [PATCH 233/402] Update config background --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index b93369b0..be0d81e6 100755 --- a/config +++ b/config @@ -908,7 +908,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop rpitx sudo rm /home/pi/CubeSatSim/t.txt - python3 -u /home/pi/CubeSatSim/rpitx.py a # > /dev/null 2>&1 & # Force APRS mode + python3 -u /home/pi/CubeSatSim/rpitx.py a & # > /dev/null 2>&1 & # Force APRS mode sim="y" From 79537c2dc200773bee1be53404a9969be455e8a2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:47:17 -0400 Subject: [PATCH 234/402] Update config sudo --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index be0d81e6..f79d82fa 100755 --- a/config +++ b/config @@ -908,7 +908,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop rpitx sudo rm /home/pi/CubeSatSim/t.txt - python3 -u /home/pi/CubeSatSim/rpitx.py a & # > /dev/null 2>&1 & # Force APRS mode + sudo python3 -u /home/pi/CubeSatSim/rpitx.py a & # > /dev/null 2>&1 & # Force APRS mode sim="y" From ff2ec2d8bcdb6fc00ce696940af95bf31cf1e815 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:50:31 -0400 Subject: [PATCH 235/402] Update config change to x --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index f79d82fa..91c5605d 100755 --- a/config +++ b/config @@ -908,7 +908,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop rpitx sudo rm /home/pi/CubeSatSim/t.txt - sudo python3 -u /home/pi/CubeSatSim/rpitx.py a & # > /dev/null 2>&1 & # Force APRS mode + sudo python3 -u /home/pi/CubeSatSim/rpitx.py x > /dev/null 2>&1 & # Force APRS mode sim="y" From d6772e34373d0c3cb37c4e0df8f8ef5a1762a33f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:54:49 -0400 Subject: [PATCH 236/402] Update rpitx.py don't do CW ID or sleep 10 for mode x --- rpitx.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rpitx.py b/rpitx.py index 5f2ec96c..95159fcd 100644 --- a/rpitx.py +++ b/rpitx.py @@ -263,16 +263,16 @@ debug_mode = 0 #no debugging rpitx if __name__ == "__main__": - mode = "x" + mode = "y" if (len(sys.argv)) > 1: # print("There are arguments!") if (('d' == sys.argv[1]) or ('-d' in sys.argv[1])): debug_mode = 1 - elif (('a' == sys.argv[1]) or ('-a' in sys.argv[1])): + elif (('x' == sys.argv[1]) or ('-x' in sys.argv[1])): mode = "a" print("Forcing APRS mode") print(transmit) - if ( mode == "x"): + if ( mode == "y"): try: file = open("/home/pi/CubeSatSim/.mode") mode = file.read(1) @@ -405,8 +405,9 @@ if __name__ == "__main__": except: print("Error in serial write") output(pd, 0) - - sleep(10) # delay so cubesatsim code catches up + + if (mode != 'x'): + sleep(10) # delay so cubesatsim code catches up system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1") @@ -414,7 +415,7 @@ if __name__ == "__main__": # if (mode != ) and (command_tx == True): # if (command_tx == True): - if (mode != 'm'): + if (mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's'): # battery_saver_mode output(txLed, txLedOn) # if (txc): @@ -446,7 +447,7 @@ if __name__ == "__main__": # if (len(sys.argv)) > 1: # print("There are arguments!") - if (mode == 'a'): + if (mode == 'a') or (mode == 'x'): command_control_check() output(pd, 1) output(ptt, 1) From d820e7a59a0e623cec56394edf1281b0f58dc86d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Jul 2024 23:57:22 -0400 Subject: [PATCH 237/402] Update config don't rm t.txt at start --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 91c5605d..72ec3ebc 100755 --- a/config +++ b/config @@ -906,7 +906,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop cubesatsim sudo systemctl stop rpitx - sudo rm /home/pi/CubeSatSim/t.txt +# sudo rm /home/pi/CubeSatSim/t.txt sudo python3 -u /home/pi/CubeSatSim/rpitx.py x > /dev/null 2>&1 & # Force APRS mode From c7a5ac67dd341846285fa00a56e996af9fb12fa7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 11 Jul 2024 00:05:33 -0400 Subject: [PATCH 238/402] Update rpitx.py set x --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 95159fcd..d1d78318 100644 --- a/rpitx.py +++ b/rpitx.py @@ -269,7 +269,7 @@ if __name__ == "__main__": if (('d' == sys.argv[1]) or ('-d' in sys.argv[1])): debug_mode = 1 elif (('x' == sys.argv[1]) or ('-x' in sys.argv[1])): - mode = "a" + mode = "x" print("Forcing APRS mode") print(transmit) if ( mode == "y"): From e9a45d93ae617b1ffa30ffb9e5892307fc49655b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 11:01:05 -0400 Subject: [PATCH 239/402] Update config added -e and -n modes --- config | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/config b/config index 72ec3ebc..91cc98ef 100755 --- a/config +++ b/config @@ -35,6 +35,10 @@ if [ "$1" = "" ]; then echo "Mode is BPSK" elif [ "$1" = "s" ]; then echo "Mode is SSTV" + elif [ "$1" = "e" ]; then + echo "Mode is Repeater" + elif [ "$1" = "n" ]; then + echo "Mode is Transmit Command and Control" else echo fi @@ -899,16 +903,37 @@ elif [ "$1" = "-v" ]; then echo /home/pi/CubeSatSim/telem +elif [ "$1" = "-e" ]; then + + echo "changing CubeSatSim to Repeater mode" + sudo echo "e" > /home/pi/CubeSatSim/.mode + + restart=1 + +elif [ "$1" = "-n" ]; then + + echo "changing CubeSatSim to Transmit Command and Control mode" + sudo echo "n" > /home/pi/CubeSatSim/.mode + + restart=1 + elif [ "$1" = "-A" ]; then echo "Transmit APRS control packets to control another CubeSatSim" echo - sudo systemctl stop cubesatsim - sudo systemctl stop rpitx -# sudo rm /home/pi/CubeSatSim/t.txt + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + + if [ "$1" != "n" ]; then - sudo python3 -u /home/pi/CubeSatSim/rpitx.py x > /dev/null 2>&1 & # Force APRS mode + sudo systemctl stop cubesatsim + sudo systemctl stop rpitx + # sudo rm /home/pi/CubeSatSim/t.txt + + sudo python3 -u /home/pi/CubeSatSim/rpitx.py x > /dev/null 2>&1 & # Force APRS mode + fi sim="y" @@ -961,7 +986,10 @@ elif [ "$1" = "-A" ]; then done sudo rm /home/pi/CubeSatSim/t.txt # sudo systemctl restart cubesatsim - reboot=1 + + if [ "$1" != "n" ]; then + + reboot=1 elif [ "$1" = "-h" ]; then @@ -975,6 +1003,8 @@ elif [ "$1" = "-h" ]; then echo " -f Change to FSK/DUV mode" echo " -b Change to BPSK mode" echo " -s Change to SSTV mode" + echo " -n Change to Transmit Command and Control mode" + echo " -e Change to Repeater 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" @@ -1022,7 +1052,7 @@ if [ "$reboot" = "1" ] ; then fi if [ "$restart" = "1" ] ; then - if [ "$reboot" = "1" ] ; then + if [ "$reboot" = "0" ] ; then echo "Restarting" sudo systemctl restart cubesatsim else From bf10f967f49b6decc2513bed8cfbd177576f9942 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 11:53:23 -0400 Subject: [PATCH 240/402] Update rpitx.py add mode -n and mode -e --- rpitx.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index d1d78318..19413a0b 100644 --- a/rpitx.py +++ b/rpitx.py @@ -447,7 +447,7 @@ if __name__ == "__main__": # if (len(sys.argv)) > 1: # print("There are arguments!") - if (mode == 'a') or (mode == 'x'): + if (mode == 'a') or (mode == 'x') or (mode == 'n'): command_control_check() output(pd, 1) output(ptt, 1) @@ -766,6 +766,24 @@ if __name__ == "__main__": if (command_tx == True): output(txLed, txLedOn) sleep(4.2) + elif (mode == 'e'): + print("Repeater") + print("Stopping command and control") + system("sudo systemctl stop command") + print("turn on FM rx") + output(pd, 1) + output(ptt, 1) + while True: + sleep(0.5) + if (GPIO.input(squelch) == False): + print("Carrier detected, starting repeater") +# system("arecord -D hw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") + system("arecord -D hw:CARD=Device,DEV=0 -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 " + tx + "e3 &") + while (GPIO.input(squelch) == False): + sleep(1) + print("No carrier detected, stopping repeater") + system("sudo killall -9 arecord") + else: print("FSK") print("turn on FM rx") From e08946479fb35ca98d7ff6bd3f469c851f49bc0e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 12:01:59 -0400 Subject: [PATCH 241/402] Update config add transmit command to -a command --- config | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/config b/config index 91cc98ef..2b2916e2 100755 --- a/config +++ b/config @@ -128,25 +128,32 @@ elif [ "$1" = "-i" ]; then ## sudo reboot now # sudo restart cubesatsim ## exit + elif [ "$1" = "-a" ]; then - echo "changing CubeSatSim to AFSK mode" - sudo echo "a" > /home/pi/CubeSatSim/.mode - FILE=/home/pi/CubeSatSim/battery_saver - if [ -f "$FILE" ]; then - echo "Safe Mode! Battery saver mode is ON." -# if ! grep force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - else - echo "Battery saver mode is OFF." -# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt - fi + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit + if [ "$1" == "n" ]; then + + echo "Transmit mode 1 is APRS" + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" + sudo rm /home/pi/CubeSatSim/t.txt + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet " + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 5 + sudo touch /home/pi/CubeSatSim/ready + else + + echo "changing CubeSatSim to AFSK mode" + sudo echo "a" > /home/pi/CubeSatSim/.mode + reboot=1 + fi elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" From cca7cfe9f50fcdcc442ad099d9bb3b869963ad12 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 12:29:01 -0400 Subject: [PATCH 242/402] Update config add function transmit_command_aprs with DTMF --- config | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/config b/config index 2b2916e2..1f60af66 100755 --- a/config +++ b/config @@ -1066,3 +1066,23 @@ if [ "$restart" = "1" ] ; then echo "Restart needed for changes to take effect" fi fi + +function transmit_command_aprs { + + echo "Mode 1 is APRS" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" + sudo rm /home/pi/CubeSatSim/t.txt + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet " + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 5 + sudo touch /home/pi/CubeSatSim/ready + + sudo systemctl stop command + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-dtmf-aprs.conf + sudo systemctl start command + + exit +} From 35ca6faebbc09272d06c0f0f89518a5938a45a96 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 12:30:57 -0400 Subject: [PATCH 243/402] Create direwolf-transmit-dtmf-aprs.conf --- direwolf/direwolf-dtmf-aprs.conf | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 direwolf/direwolf-dtmf-aprs.conf diff --git a/direwolf/direwolf-dtmf-aprs.conf b/direwolf/direwolf-dtmf-aprs.conf new file mode 100644 index 00000000..8fd71980 --- /dev/null +++ b/direwolf/direwolf-dtmf-aprs.conf @@ -0,0 +1,4 @@ +MYCALL AMSAT +ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +DTMF +CBEACON dest="DTMF-3" info="1#" From 004d9bc3c17d1ddf9168b7e2106810dab957ec18 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 12:40:07 -0400 Subject: [PATCH 244/402] Update config add ptt to dumf --- config | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/config b/config index 1f60af66..ff091c43 100755 --- a/config +++ b/config @@ -1080,8 +1080,17 @@ function transmit_command_aprs { sleep 5 sudo touch /home/pi/CubeSatSim/ready + sleep 5 + echo "Stopping command and control" sudo systemctl stop command - timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-dtmf-aprs.conf + + echo "Transmit start" + gpio write 28 0 # ptt + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" sudo systemctl start command exit From 55af0480e0afc0b0dc9867f79c12dcf8252e60a0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 15:39:09 -0400 Subject: [PATCH 245/402] Update dtmf_aprs_cc.py added Mode=o for beacon_off --- dtmf_aprs_cc.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 1da9797b..8d79ee47 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -45,6 +45,19 @@ if __name__ == "__main__": system("echo '\nCW Mode!!\n'") mode = 'm' change_mode = True + if ((line.find("MODE=o")) > 0) or ((line.find("DTMF>APDW15:t10#")) > 0): + system("echo '\nBeacon Mode toggle!!\n'") + + try: + f = open("/home/pi/CubeSatSim/beacon_off", "r") + f.close() + print("Beacon is on, turning it OFF") + system("touch /home/pi/CubeSatSim/beacon_off") + except: + print("Beacon is off, turning it ON") + system("sudo rm /home/pi/CubeSatSim/beacon_off") + + change_mode = False if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) From 70e4aa21c47902e1dddfa57c1aff6241c1d887ad Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 15:41:14 -0400 Subject: [PATCH 246/402] Update rpitx.py use beacon_off to set command_tx --- rpitx.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/rpitx.py b/rpitx.py index 19413a0b..d8edc2a0 100644 --- a/rpitx.py +++ b/rpitx.py @@ -284,16 +284,13 @@ if __name__ == "__main__": print(mode) try: - file = open("/home/pi/CubeSatSim/command_tx") - char = file.read(1) - if (char == 'T'): - command_tx = True - else: - command_tx = False + file = open("/home/pi/CubeSatSim/beacon_off") + file.close() + command_tx = False except: command_tx = True if (debug_mode == 1): - print("Can't open command_tx file, defaulting to True") + print("Can't open beacon_off file, defaulting to False") print("Command_tx: ") print(command_tx) From f323bc16d588a7c78cb8ba2908d4ab2adac23ac5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 15:43:27 -0400 Subject: [PATCH 247/402] Update dtmf_aprs_cc.py add rpitx restart --- dtmf_aprs_cc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 8d79ee47..c42d92d1 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -47,7 +47,6 @@ if __name__ == "__main__": change_mode = True if ((line.find("MODE=o")) > 0) or ((line.find("DTMF>APDW15:t10#")) > 0): system("echo '\nBeacon Mode toggle!!\n'") - try: f = open("/home/pi/CubeSatSim/beacon_off", "r") f.close() @@ -55,8 +54,9 @@ if __name__ == "__main__": system("touch /home/pi/CubeSatSim/beacon_off") except: print("Beacon is off, turning it ON") - system("sudo rm /home/pi/CubeSatSim/beacon_off") - + system("sudo rm /home/pi/CubeSatSim/beacon_off") + print("Restarting rpitx") + system("sudo systemctl restart rpitx") change_mode = False if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) From be3eb191aa46e657784a03cf2ee959bd32f5400c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 12 Jul 2024 15:49:40 -0400 Subject: [PATCH 248/402] Update main.c changed to sleep(30) for SSTV and Transmit Command --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index d4c4ce91..68fdb3ba 100644 --- a/main.c +++ b/main.c @@ -867,7 +867,7 @@ int main(int argc, char * argv[]) { get_tlm_fox(); } else { // SSTV // fprintf(stderr, "Sleeping\n"); - sleep(50); + sleep(30); } #ifdef DEBUG_LOGGING From 0bddf8135e2630ca9fed03c3ed2b7452617f94fb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 13 Jul 2024 10:10:38 -0400 Subject: [PATCH 249/402] Update config added blue LED on/off to transmit function --- config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config b/config index ff091c43..dbb4b421 100755 --- a/config +++ b/config @@ -1086,7 +1086,9 @@ function transmit_command_aprs { echo "Transmit start" gpio write 28 0 # ptt + gpio write 27 1 # tx LED timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf + gpio write 27 0 # tx LED gpio write 28 1 #ptt echo "Transmit stop" From d9db0088f3cca0553f2ef02f32367054cb278b92 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 13 Jul 2024 10:17:25 -0400 Subject: [PATCH 250/402] Update rpitx.py add green and blue LED control for n and e modes --- rpitx.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rpitx.py b/rpitx.py index d8edc2a0..299e24c4 100644 --- a/rpitx.py +++ b/rpitx.py @@ -447,8 +447,12 @@ if __name__ == "__main__": if (mode == 'a') or (mode == 'x') or (mode == 'n'): command_control_check() output(pd, 1) - output(ptt, 1) - print("AFSK") + output(ptt, 1) + if (mode == 'a'): + print("AFSK") + else: + GPIO.output(powerPin, 0) + print("Transmit APRS Commands") # while True: # sleep(0.1) while True: @@ -770,15 +774,21 @@ if __name__ == "__main__": print("turn on FM rx") output(pd, 1) output(ptt, 1) + GPIO.output(powerPin, 0) while True: sleep(0.5) if (GPIO.input(squelch) == False): print("Carrier detected, starting repeater") + output(txLed, txLedOn) # system("arecord -D hw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") system("arecord -D hw:CARD=Device,DEV=0 -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 " + tx + "e3 &") + GPIO.output(powerPin, 1) + sleep(1) + GPIO.output(powerPin, 0) while (GPIO.input(squelch) == False): sleep(1) - print("No carrier detected, stopping repeater") + print("No carrier detected, stopping repeater") + output(txLed, txLedOff) system("sudo killall -9 arecord") else: From 43d997dd985a14040953e16eedec8a36f21ed596 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 13 Jul 2024 12:56:53 -0400 Subject: [PATCH 251/402] Update config add -D for APRS/DTMF --- config | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/config b/config index dbb4b421..ea5ef4da 100755 --- a/config +++ b/config @@ -38,7 +38,13 @@ if [ "$1" = "" ]; then elif [ "$1" = "e" ]; then echo "Mode is Repeater" elif [ "$1" = "n" ]; then - echo "Mode is Transmit Command and Control" + echo -n "Mode is Transmit Command and Control with " + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + echo -n "DTMF" + else + echo -n "APRS" + fi else echo fi @@ -584,7 +590,37 @@ elif [ "$1" = "-d" ]; then fi +elif [ "$1" = "-D" ]; then + + echo + echo "Change Transmit command state" + echo + + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + echo "Transmit commands in DTMF is set" + echo + echo "Do you want to transmit commands in APRS (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Transmit commands in APRS" + sudo rm /home/pi/CubeSatSim/transmit_dtmf + fi + + else + echo "Transmit commands in APRS is set" + echo + echo "Do you want to transmit commands in DTMF (y/n) " + read reset + echo + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Transmit commands in DTMF" + touch /home/pi/CubeSatSim/transmit_dtmf + fi + fi elif [ "$1" = "-R" ]; then @@ -1030,6 +1066,7 @@ elif [ "$1" = "-h" ]; then echo " -v Display voltage and current data" echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX" echo " -A Transmit APRS control packets to control another CubeSatSim" + echo " -D Change Transmit command state APRS or DTMF" echo exit From 8b5796fd78229ac34c6cfaca69fe4a4bbf87ec34 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 13 Jul 2024 13:01:05 -0400 Subject: [PATCH 252/402] Update config change_command using dtmf or APRS --- config | 52 +++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/config b/config index ea5ef4da..8f385a99 100755 --- a/config +++ b/config @@ -1106,31 +1106,37 @@ fi function transmit_command_aprs { - echo "Mode 1 is APRS" - STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" - sudo rm /home/pi/CubeSatSim/t.txt - echo $STRING > /home/pi/CubeSatSim/t.txt - echo - echo -n "Sending APRS packet " - echo $STRING - sudo touch /home/pi/CubeSatSim/ready - sleep 5 - sudo touch /home/pi/CubeSatSim/ready - - sleep 5 - echo "Stopping command and control" - sudo systemctl stop command + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + + echo "Stopping command and control" + sudo systemctl stop command + + echo "Transmit start" + gpio write 28 0 # ptt + gpio write 27 1 # tx LED + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf + gpio write 27 0 # tx LED + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" + sudo systemctl start command + + else - echo "Transmit start" - gpio write 28 0 # ptt - gpio write 27 1 # tx LED - timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf - gpio write 27 0 # tx LED - gpio write 28 1 #ptt - echo "Transmit stop" + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" + sudo rm /home/pi/CubeSatSim/t.txt + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet to change mode to APRS" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 5 + sudo touch /home/pi/CubeSatSim/ready + sleep 5 - echo "Resuming command and control" - sudo systemctl start command + fi exit } From 1928f15517444ec5ca7646b6d84895d36dc64777 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 14 Jul 2024 20:01:35 -0400 Subject: [PATCH 253/402] Update config remove function --- config | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/config b/config index 8f385a99..ae85767e 100755 --- a/config +++ b/config @@ -1103,40 +1103,3 @@ if [ "$restart" = "1" ] ; then echo "Restart needed for changes to take effect" fi fi - -function transmit_command_aprs { - - FILE=/home/pi/CubeSatSim/transmit_dtmf - if [ -f "$FILE" ]; then - - echo "Stopping command and control" - sudo systemctl stop command - - echo "Transmit start" - gpio write 28 0 # ptt - gpio write 27 1 # tx LED - timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf - gpio write 27 0 # tx LED - gpio write 28 1 #ptt - echo "Transmit stop" - - echo "Resuming command and control" - sudo systemctl start command - - else - - STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" - sudo rm /home/pi/CubeSatSim/t.txt - echo $STRING > /home/pi/CubeSatSim/t.txt - echo - echo -n "Sending APRS packet to change mode to APRS" - echo $STRING - sudo touch /home/pi/CubeSatSim/ready - sleep 5 - sudo touch /home/pi/CubeSatSim/ready - sleep 5 - - fi - - exit -} From e943ebbfae92cf6cee032e2b8dfef4bff40e9b50 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 14 Jul 2024 20:03:33 -0400 Subject: [PATCH 254/402] Update config missing fi --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index ae85767e..201756ac 100755 --- a/config +++ b/config @@ -1033,6 +1033,7 @@ elif [ "$1" = "-A" ]; then if [ "$1" != "n" ]; then reboot=1 + fi elif [ "$1" = "-h" ]; then From 77ab9936ae47cfd0bc767fa4becf20f6407efb39 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 14 Jul 2024 20:12:37 -0400 Subject: [PATCH 255/402] Update main.c added REPEATER and TXCOMMAND --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.c b/main.c index 68fdb3ba..d1e63bf7 100644 --- a/main.c +++ b/main.c @@ -193,6 +193,12 @@ int main(int argc, char * argv[]) { } else if ( mode_string == 'm') { mode = CW; printf("Mode is CW\n"); + } else if ( mode_string == 'e') { + mode = REPEATER; + printf("Mode is Repeater\n"); + } else if ( mode_string == 'n') { + mode = TXCOMMAND; + printf("Mode is Transmit Command\n"); } else { printf("Mode is FSK\n"); } From 14bf7637563aa39b4f7368b2b731e3aafc67c1a9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 14 Jul 2024 20:13:29 -0400 Subject: [PATCH 256/402] Update main.h add REPEATER and TXCOMMAND --- main.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.h b/main.h index 7b8a2c8c..b3627a21 100644 --- a/main.h +++ b/main.h @@ -105,6 +105,8 @@ FILE *telem_file; #define BPSK 3 #define SSTV 4 #define CW 5 +#define REPEATER 6 +#define TXCOMMAND 7 int rpitxStatus = -1; From 7076c566e0f3f69c1ed4cb8311ed28468cd9263a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 14 Jul 2024 20:17:19 -0400 Subject: [PATCH 257/402] Update rpitx.py add powerPin --- rpitx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rpitx.py b/rpitx.py index 299e24c4..f45febc7 100644 --- a/rpitx.py +++ b/rpitx.py @@ -190,6 +190,7 @@ ptt = 20 txc_pin = 7 squelch = 6 green = 16 +powerPin = 16 command_tx = True From b3b51cfb49fdb9efee0a1782aba84171439dc4e6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 08:32:04 -0400 Subject: [PATCH 258/402] Update config add function back --- config | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/config b/config index 201756ac..56a240eb 100755 --- a/config +++ b/config @@ -1104,3 +1104,40 @@ if [ "$restart" = "1" ] ; then echo "Restart needed for changes to take effect" fi fi + +function transmit_command_aprs { + + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + + echo "Stopping command and control" + sudo systemctl stop command + + echo "Transmit start" + gpio write 28 0 # ptt + gpio write 27 1 # tx LED + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf + gpio write 27 0 # tx LED + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" + sudo systemctl start command + + else + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" + sudo rm /home/pi/CubeSatSim/t.txt + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet to change mode to APRS" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 5 + sudo touch /home/pi/CubeSatSim/ready + sleep 5 + + fi + + exit +} From cbb454b97ad67ff5254c07c807cb82eaae62570a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 08:36:00 -0400 Subject: [PATCH 259/402] Update config use function --- config | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/config b/config index 56a240eb..19a57239 100755 --- a/config +++ b/config @@ -143,17 +143,19 @@ elif [ "$1" = "-a" ]; then if [ "$1" == "n" ]; then - echo "Transmit mode 1 is APRS" + transmit_command_aprs + +# echo "Transmit mode 1 is APRS" - STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" - sudo rm /home/pi/CubeSatSim/t.txt - echo $STRING > /home/pi/CubeSatSim/t.txt - echo - echo -n "Sending APRS packet " - echo $STRING - sudo touch /home/pi/CubeSatSim/ready - sleep 5 - sudo touch /home/pi/CubeSatSim/ready +# STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" +# sudo rm /home/pi/CubeSatSim/t.txt +# echo $STRING > /home/pi/CubeSatSim/t.txt +# echo +# echo -n "Sending APRS packet " +# echo $STRING +# sudo touch /home/pi/CubeSatSim/ready +# sleep 5 +# sudo touch /home/pi/CubeSatSim/ready else echo "changing CubeSatSim to AFSK mode" From ade065bf9d14a62bc526d51874be42b0273963fe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 08:36:42 -0400 Subject: [PATCH 260/402] Update config move function to start --- config | 72 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/config b/config index 19a57239..e1c8d8f1 100755 --- a/config +++ b/config @@ -1,5 +1,42 @@ #!/bin/bash +function transmit_command_aprs { + + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + + echo "Stopping command and control" + sudo systemctl stop command + + echo "Transmit start" + gpio write 28 0 # ptt + gpio write 27 1 # tx LED + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf + gpio write 27 0 # tx LED + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" + sudo systemctl start command + + else + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" + sudo rm /home/pi/CubeSatSim/t.txt + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet to change mode to APRS" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 5 + sudo touch /home/pi/CubeSatSim/ready + sleep 5 + + fi + + exit +} + echo "CubeSatSim v1.3.2 configuration tool" echo # echo $1 @@ -1107,39 +1144,4 @@ if [ "$restart" = "1" ] ; then fi fi -function transmit_command_aprs { - - FILE=/home/pi/CubeSatSim/transmit_dtmf - if [ -f "$FILE" ]; then - - echo "Stopping command and control" - sudo systemctl stop command - - echo "Transmit start" - gpio write 28 0 # ptt - gpio write 27 1 # tx LED - timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf - gpio write 27 0 # tx LED - gpio write 28 1 #ptt - echo "Transmit stop" - - echo "Resuming command and control" - sudo systemctl start command - - else - - STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" - sudo rm /home/pi/CubeSatSim/t.txt - echo $STRING > /home/pi/CubeSatSim/t.txt - echo - echo -n "Sending APRS packet to change mode to APRS" - echo $STRING - sudo touch /home/pi/CubeSatSim/ready - sleep 5 - sudo touch /home/pi/CubeSatSim/ready - sleep 5 - - fi - exit -} From 53bda9626be57bf75c946650860cf7070009117d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 08:38:39 -0400 Subject: [PATCH 261/402] Rename direwolf-dtmf-aprs.conf to direwolf-transmit-dtmf-aprs.conf --- .../{direwolf-dtmf-aprs.conf => direwolf-transmit-dtmf-aprs.conf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename direwolf/{direwolf-dtmf-aprs.conf => direwolf-transmit-dtmf-aprs.conf} (100%) diff --git a/direwolf/direwolf-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf similarity index 100% rename from direwolf/direwolf-dtmf-aprs.conf rename to direwolf/direwolf-transmit-dtmf-aprs.conf From cad7c6022f2a8c7230251cdb60fc4cac973d846a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 08:41:15 -0400 Subject: [PATCH 262/402] Update config fix dire wolf display --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index e1c8d8f1..f025840b 100755 --- a/config +++ b/config @@ -11,7 +11,7 @@ function transmit_command_aprs { echo "Transmit start" gpio write 28 0 # ptt gpio write 27 1 # tx LED - timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l gpio write 27 0 # tx LED gpio write 28 1 #ptt echo "Transmit stop" From bc5cf1f3262cdfd9854c2f88fec57241f0295b2e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 08:50:35 -0400 Subject: [PATCH 263/402] Update direwolf-transmit-dtmf-aprs.conf add space --- direwolf/direwolf-transmit-dtmf-aprs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index 8fd71980..f19ee5af 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -1,4 +1,4 @@ MYCALL AMSAT ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 DTMF -CBEACON dest="DTMF-3" info="1#" +CBEACON dest="DTMF-3" info="1 #" From 717aa15ca062cdb25d9daead588d458faca27ab7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 08:54:11 -0400 Subject: [PATCH 264/402] Update direwolf-transmit-dtmf-aprs.conf add CHANNEL --- direwolf/direwolf-transmit-dtmf-aprs.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index f19ee5af..6e6e76ea 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -1,3 +1,4 @@ +CHANNEL 0 MYCALL AMSAT ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 DTMF From b8ed40911af1858c7fca4ec205d75a000683326f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:15:36 -0400 Subject: [PATCH 265/402] Update config 30 seconds for DTMF --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index f025840b..60ed427d 100755 --- a/config +++ b/config @@ -11,7 +11,7 @@ function transmit_command_aprs { echo "Transmit start" gpio write 28 0 # ptt gpio write 27 1 # tx LED - timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l + timeout 30 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l gpio write 27 0 # tx LED gpio write 28 1 #ptt echo "Transmit stop" From d75815db4ad14826cc735e82b59c2c11fbd63605 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:21:42 -0400 Subject: [PATCH 266/402] Update direwolf-transmit-dtmf-aprs.conf add MODEM --- direwolf/direwolf-transmit-dtmf-aprs.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index 6e6e76ea..b78cabbc 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -1,4 +1,5 @@ CHANNEL 0 +MODEM 1200 MYCALL AMSAT ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 DTMF From b44ff2c05d7d6c29b34e6e788ecfac092bf4c349 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:23:35 -0400 Subject: [PATCH 267/402] Update direwolf-transmit-dtmf-aprs.conf change order --- direwolf/direwolf-transmit-dtmf-aprs.conf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index b78cabbc..7352fe74 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -1,6 +1,5 @@ +ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +MYCALL AMSAT CHANNEL 0 MODEM 1200 -MYCALL AMSAT -ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 -DTMF CBEACON dest="DTMF-3" info="1 #" From 0c48d333ec4d97e56d20b89af3024023f2f02586 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:24:46 -0400 Subject: [PATCH 268/402] Update direwolf-transmit-dtmf-aprs.conf exact match --- direwolf/direwolf-transmit-dtmf-aprs.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index 7352fe74..6da5bf00 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -1,5 +1,5 @@ ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 -MODEM 1200 -CBEACON dest="DTMF-3" info="1 #" +MODEM 1200" +CBEACON dest="DTMF-3" info="# # 6666" From 26b3ae327a1474941cdd0b377d41a090ba6c431d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:30:34 -0400 Subject: [PATCH 269/402] Update direwolf-transmit-dtmf-aprs.conf add delay 1 sec --- direwolf/direwolf-transmit-dtmf-aprs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index 6da5bf00..3b2a7b8a 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -2,4 +2,4 @@ ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200" -CBEACON dest="DTMF-3" info="# # 6666" +CBEACON dest="DTMF-3" info="# # 6666" delay=0:01 From 60fa71a8aa7f22992a35ff4c74de3937ffff50d2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:31:15 -0400 Subject: [PATCH 270/402] Update direwolf-transmit-dtmf-aprs.conf back to sending 1# after 1 sec --- direwolf/direwolf-transmit-dtmf-aprs.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index 3b2a7b8a..4f44b1c5 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -1,5 +1,5 @@ ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 -MODEM 1200" -CBEACON dest="DTMF-3" info="# # 6666" delay=0:01 +MODEM 1200 +CBEACON dest="DTMF-3" info="1 #" delay=0:01 From b359366dcce8dc14a54fd905cff7cc4a4502bf12 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:51:14 -0400 Subject: [PATCH 271/402] Update config 4 sec --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 60ed427d..30bc6f02 100755 --- a/config +++ b/config @@ -11,7 +11,7 @@ function transmit_command_aprs { echo "Transmit start" gpio write 28 0 # ptt gpio write 27 1 # tx LED - timeout 30 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l + timeout 4 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l gpio write 27 0 # tx LED gpio write 28 1 #ptt echo "Transmit stop" From 38dfbda40fd76add2b95dfadaaf56ccda52c21c8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:53:37 -0400 Subject: [PATCH 272/402] Update direwolf-transmit-dtmf-aprs.conf delay 0 --- direwolf/direwolf-transmit-dtmf-aprs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index 4f44b1c5..65cd5712 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -2,4 +2,4 @@ ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 -CBEACON dest="DTMF-3" info="1 #" delay=0:01 +CBEACON dest="DTMF-3" info="1 #" delay=0 From 27f4f013d4f88cdefaf20311494c9be5dc4f2eb2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 09:55:01 -0400 Subject: [PATCH 273/402] Update config 3 sec --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 30bc6f02..f025840b 100755 --- a/config +++ b/config @@ -11,7 +11,7 @@ function transmit_command_aprs { echo "Transmit start" gpio write 28 0 # ptt gpio write 27 1 # tx LED - timeout 4 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l gpio write 27 0 # tx LED gpio write 28 1 #ptt echo "Transmit stop" From 19de595d4fbc1b86df0fa65842efeccd75420ed3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 10:04:18 -0400 Subject: [PATCH 274/402] Update config change to blue LED, 3 sec delay for aprs --- config | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/config b/config index f025840b..b161a2bf 100755 --- a/config +++ b/config @@ -10,9 +10,9 @@ function transmit_command_aprs { echo "Transmit start" gpio write 28 0 # ptt - gpio write 27 1 # tx LED + gpio write 2 1 # tx LED timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l - gpio write 27 0 # tx LED + gpio write 2 0 # tx LED gpio write 28 1 #ptt echo "Transmit stop" @@ -22,15 +22,15 @@ function transmit_command_aprs { else STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" - sudo rm /home/pi/CubeSatSim/t.txt + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null echo $STRING > /home/pi/CubeSatSim/t.txt echo echo -n "Sending APRS packet to change mode to APRS" echo $STRING sudo touch /home/pi/CubeSatSim/ready - sleep 5 - sudo touch /home/pi/CubeSatSim/ready - sleep 5 + sleep 3 +# sudo touch /home/pi/CubeSatSim/ready +# sleep 5 fi @@ -185,7 +185,7 @@ elif [ "$1" = "-a" ]; then # echo "Transmit mode 1 is APRS" # STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" -# sudo rm /home/pi/CubeSatSim/t.txt +# sudo rm /home/pi/CubeSatSim/t.txt > /dev/null # echo $STRING > /home/pi/CubeSatSim/t.txt # echo # echo -n "Sending APRS packet " @@ -531,7 +531,7 @@ elif [ "$1" = "-T" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control set to OFF" - sudo rm /home/pi/CubeSatSim/command_control + sudo rm /home/pi/CubeSatSim/command_control > /dev/null # reboot=1 echo "restarting command and control" sudo systemctl restart command @@ -578,7 +578,7 @@ elif [ "$1" = "-d" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control Direwolf set to OFF" - sudo rm /home/pi/CubeSatSim/command_control_direwolf + sudo rm /home/pi/CubeSatSim/command_control_direwolf > /dev/null # reboot=1 ## echo "rebooting" sudo systemctl restart command @@ -645,7 +645,7 @@ elif [ "$1" = "-D" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Transmit commands in APRS" - sudo rm /home/pi/CubeSatSim/transmit_dtmf + sudo rm /home/pi/CubeSatSim/transmit_dtmf > /dev/null fi else @@ -676,7 +676,7 @@ elif [ "$1" = "-R" ]; then echo if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then - sudo rm /home/pi/CubeSatSim/command_count.txt + sudo rm /home/pi/CubeSatSim/command_count.txt > /dev/null echo "Commands count reset to 0" echo "0\n" > /home/pi/CubeSatSim/command_count.txt else @@ -717,7 +717,7 @@ elif [ "$1" = "-B" ]; then if [ "$mode" = "1" ] ; then echo "Safe Mode will be turned OFF. Battery saver mode will be turned OFF" - sudo rm /home/pi/CubeSatSim/battery_saver + sudo rm /home/pi/CubeSatSim/battery_saver > /dev/null reboot=1 fi fi @@ -1012,7 +1012,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop cubesatsim sudo systemctl stop rpitx - # sudo rm /home/pi/CubeSatSim/t.txt + # sudo rm /home/pi/CubeSatSim/t.txt > /dev/null sudo python3 -u /home/pi/CubeSatSim/rpitx.py x > /dev/null 2>&1 & # Force APRS mode fi @@ -1052,7 +1052,7 @@ elif [ "$1" = "-A" ]; then STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=?" ;; esac - sudo rm /home/pi/CubeSatSim/t.txt + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null echo $STRING > /home/pi/CubeSatSim/t.txt echo echo -n "Sending APRS packet " @@ -1066,7 +1066,7 @@ elif [ "$1" = "-A" ]; then read sim echo done - sudo rm /home/pi/CubeSatSim/t.txt + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null # sudo systemctl restart cubesatsim if [ "$1" != "n" ]; then From 4c02e60484f0cd7d924ad5555bf29ee95a3a82f8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 10:34:54 -0400 Subject: [PATCH 275/402] Update config added > /dev/null 2>&1 --- config | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config b/config index b161a2bf..9f0ac554 100755 --- a/config +++ b/config @@ -22,7 +22,7 @@ function transmit_command_aprs { else STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" - sudo rm /home/pi/CubeSatSim/t.txt > /dev/null + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 echo $STRING > /home/pi/CubeSatSim/t.txt echo echo -n "Sending APRS packet to change mode to APRS" @@ -185,7 +185,7 @@ elif [ "$1" = "-a" ]; then # echo "Transmit mode 1 is APRS" # STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" -# sudo rm /home/pi/CubeSatSim/t.txt > /dev/null +# sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 # echo $STRING > /home/pi/CubeSatSim/t.txt # echo # echo -n "Sending APRS packet " @@ -531,7 +531,7 @@ elif [ "$1" = "-T" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control set to OFF" - sudo rm /home/pi/CubeSatSim/command_control > /dev/null + sudo rm /home/pi/CubeSatSim/command_control > /dev/null 2>&1 # reboot=1 echo "restarting command and control" sudo systemctl restart command @@ -578,7 +578,7 @@ elif [ "$1" = "-d" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control Direwolf set to OFF" - sudo rm /home/pi/CubeSatSim/command_control_direwolf > /dev/null + sudo rm /home/pi/CubeSatSim/command_control_direwolf > /dev/null 2>&1 # reboot=1 ## echo "rebooting" sudo systemctl restart command @@ -645,7 +645,7 @@ elif [ "$1" = "-D" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Transmit commands in APRS" - sudo rm /home/pi/CubeSatSim/transmit_dtmf > /dev/null + sudo rm /home/pi/CubeSatSim/transmit_dtmf > /dev/null 2>&1 fi else @@ -676,7 +676,7 @@ elif [ "$1" = "-R" ]; then echo if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then - sudo rm /home/pi/CubeSatSim/command_count.txt > /dev/null + sudo rm /home/pi/CubeSatSim/command_count.txt > /dev/null 2>&1 echo "Commands count reset to 0" echo "0\n" > /home/pi/CubeSatSim/command_count.txt else @@ -717,7 +717,7 @@ elif [ "$1" = "-B" ]; then if [ "$mode" = "1" ] ; then echo "Safe Mode will be turned OFF. Battery saver mode will be turned OFF" - sudo rm /home/pi/CubeSatSim/battery_saver > /dev/null + sudo rm /home/pi/CubeSatSim/battery_saver > /dev/null 2>&1 reboot=1 fi fi @@ -1012,7 +1012,7 @@ elif [ "$1" = "-A" ]; then sudo systemctl stop cubesatsim sudo systemctl stop rpitx - # sudo rm /home/pi/CubeSatSim/t.txt > /dev/null + # sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 sudo python3 -u /home/pi/CubeSatSim/rpitx.py x > /dev/null 2>&1 & # Force APRS mode fi @@ -1052,7 +1052,7 @@ elif [ "$1" = "-A" ]; then STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=?" ;; esac - sudo rm /home/pi/CubeSatSim/t.txt > /dev/null + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 echo $STRING > /home/pi/CubeSatSim/t.txt echo echo -n "Sending APRS packet " @@ -1066,7 +1066,7 @@ elif [ "$1" = "-A" ]; then read sim echo done - sudo rm /home/pi/CubeSatSim/t.txt > /dev/null + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 # sudo systemctl restart cubesatsim if [ "$1" != "n" ]; then From 4c5037c983dd60eff4a12f31e0991fd8f41c3b29 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 10:51:08 -0400 Subject: [PATCH 276/402] Update config add other function calls --- config | 286 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 220 insertions(+), 66 deletions(-) diff --git a/config b/config index 9f0ac554..4ea1ab08 100755 --- a/config +++ b/config @@ -8,7 +8,7 @@ function transmit_command_aprs { echo "Stopping command and control" sudo systemctl stop command - echo "Transmit start" + echo "Transmit DTMF start" gpio write 28 0 # ptt gpio write 2 1 # tx LED timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-aprs.conf -t 0l @@ -29,8 +29,181 @@ function transmit_command_aprs { echo $STRING sudo touch /home/pi/CubeSatSim/ready sleep 3 -# sudo touch /home/pi/CubeSatSim/ready -# sleep 5 + + fi + + exit +} + +function transmit_command_fsk { + + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + + echo "Stopping command and control" + sudo systemctl stop command + + echo "Transmit DTMF start" + gpio write 28 0 # ptt + gpio write 2 1 # tx LED + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-fsk.conf -t 0l + gpio write 2 0 # tx LED + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" + sudo systemctl start command + + else + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=f" + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet to change mode to FSK" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 3 + + fi + + exit +} + +function transmit_command_bpsk { + + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + + echo "Stopping command and control" + sudo systemctl stop command + + echo "Transmit DTMF start" + gpio write 28 0 # ptt + gpio write 2 1 # tx LED + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-bpsk.conf -t 0l + gpio write 2 0 # tx LED + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" + sudo systemctl start command + + else + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=b" + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet to change mode to BPSK" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 3 + + fi + + exit +} + +function transmit_command_sstv { + + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + + echo "Stopping command and control" + sudo systemctl stop command + + echo "Transmit DTMF start" + gpio write 28 0 # ptt + gpio write 2 1 # tx LED + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-sstv.conf -t 0l + gpio write 2 0 # tx LED + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" + sudo systemctl start command + + else + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=s" + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet to change mode to SSTV" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 3 + + fi + + exit +} + +function transmit_command_bpsk { + + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + + echo "Stopping command and control" + sudo systemctl stop command + + echo "Transmit DTMF start" + gpio write 28 0 # ptt + gpio write 2 1 # tx LED + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-cw.conf -t 0l + gpio write 2 0 # tx LED + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" + sudo systemctl start command + + else + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=m" + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet to change mode to CW" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 3 + + fi + + exit +} + +function transmit_command_beacon { + + FILE=/home/pi/CubeSatSim/transmit_dtmf + if [ -f "$FILE" ]; then + + echo "Stopping command and control" + sudo systemctl stop command + + echo "Transmit DTMF start" + gpio write 28 0 # ptt + gpio write 2 1 # tx LED + timeout 3 direwolf -c /home/pi/CubeSatSim/direwolf/direwolf-transmit-dtmf-beacon.conf -t 0l + gpio write 2 0 # tx LED + gpio write 28 1 #ptt + echo "Transmit stop" + + echo "Resuming command and control" + sudo systemctl start command + + else + + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=o" + sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 + echo $STRING > /home/pi/CubeSatSim/t.txt + echo + echo -n "Sending APRS packet to toggle Beacon" + echo $STRING + sudo touch /home/pi/CubeSatSim/ready + sleep 3 fi @@ -166,11 +339,8 @@ if [ "$1" = "" ]; then elif [ "$1" = "-i" ]; then + reboot=1 -## echo "Rebooting CubeSatSim" -## sudo reboot now -# sudo restart cubesatsim -## exit elif [ "$1" = "-a" ]; then @@ -182,17 +352,6 @@ elif [ "$1" = "-a" ]; then transmit_command_aprs -# echo "Transmit mode 1 is APRS" - -# STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=a" -# sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 -# echo $STRING > /home/pi/CubeSatSim/t.txt -# echo -# echo -n "Sending APRS packet " -# echo $STRING -# sudo touch /home/pi/CubeSatSim/ready -# sleep 5 -# sudo touch /home/pi/CubeSatSim/ready else echo "changing CubeSatSim to AFSK mode" @@ -201,61 +360,56 @@ elif [ "$1" = "-a" ]; then fi elif [ "$1" = "-m" ]; then - echo "changing CubeSatSim to CW mode" - sudo echo "m" > /home/pi/CubeSatSim/.mode - FILE=/home/pi/CubeSatSim/battery_saver - if [ -f "$FILE" ]; then - echo "Safe Mode! Battery saver mode is ON." - # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - else - echo "Battery saver mode is OFF." - # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt + if [ "$1" == "n" ]; then + + transmit_command_cw + + else + + echo "changing CubeSatSim to CW mode" + sudo echo "m" > /home/pi/CubeSatSim/.mode + reboot=1 fi - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit + elif [ "$1" = "-f" ]; then - echo "changing CubeSatSim to FSK mode" - sudo echo "f" > /home/pi/CubeSatSim/.mode -# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit + + if [ "$1" == "n" ]; then + + transmit_command_fsk + + else + + echo "changing CubeSatSim to FSK mode" + sudo echo "f" > /home/pi/CubeSatSim/.mode + reboot=1 + fi + elif [ "$1" = "-b" ]; then - echo "changing CubeSatSim to BPSK mode" - sudo echo "b" > /home/pi/CubeSatSim/.mode -# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit + + if [ "$1" == "n" ]; then + + transmit_command_bpsk + + else + + echo "changing CubeSatSim to BPSK mode" + sudo echo "b" > /home/pi/CubeSatSim/.mode + reboot=1 + fi + elif [ "$1" = "-s" ]; then - echo "changing CubeSatSim to SSTV mode" - sudo echo "s" > /home/pi/CubeSatSim/.mode - FILE=/home/pi/CubeSatSim/battery_saver - if [ -f "$FILE" ]; then - echo "Safe Mode! Battery saver mode ON." -# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi - else - echo "Battery saver mode is OFF." -# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt + if [ "$1" == "n" ]; then + + transmit_command_sstv + + else + + echo "changing CubeSatSim to SSTV mode" + sudo echo "s" > /home/pi/CubeSatSim/.mode + reboot=1 fi - reboot=1 -## echo "rebooting" -## sudo stop rpitx -## sudo reboot now -# sudo restart cubesatsim -## exit elif [ "$1" = "-t" ]; then From 14813fb4de9b52da9e219bc151e1a3e562aec703 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 10:53:50 -0400 Subject: [PATCH 277/402] Update config add test --- config | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config b/config index 4ea1ab08..42f76fe0 100755 --- a/config +++ b/config @@ -361,6 +361,10 @@ elif [ "$1" = "-a" ]; then elif [ "$1" = "-m" ]; then + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + if [ "$1" == "n" ]; then transmit_command_cw @@ -374,6 +378,10 @@ elif [ "$1" = "-m" ]; then elif [ "$1" = "-f" ]; then + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + if [ "$1" == "n" ]; then transmit_command_fsk @@ -387,6 +395,10 @@ elif [ "$1" = "-f" ]; then elif [ "$1" = "-b" ]; then + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + if [ "$1" == "n" ]; then transmit_command_bpsk @@ -400,6 +412,10 @@ elif [ "$1" = "-b" ]; then elif [ "$1" = "-s" ]; then + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + if [ "$1" == "n" ]; then transmit_command_sstv From ea478a92d1cee75aa4823828801c5bcd4760e3a9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 10:59:43 -0400 Subject: [PATCH 278/402] Update config added cw fn --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index 42f76fe0..04d16ebc 100755 --- a/config +++ b/config @@ -140,7 +140,7 @@ function transmit_command_sstv { exit } -function transmit_command_bpsk { +function transmit_command_cw { FILE=/home/pi/CubeSatSim/transmit_dtmf if [ -f "$FILE" ]; then @@ -367,7 +367,7 @@ elif [ "$1" = "-m" ]; then if [ "$1" == "n" ]; then - transmit_command_cw + transmit_command else From 9169564361240c1dfba5d4e5ff663d43cea0a0f7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:00:18 -0400 Subject: [PATCH 279/402] Update config fix missing cw --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 04d16ebc..206f949b 100755 --- a/config +++ b/config @@ -367,7 +367,7 @@ elif [ "$1" = "-m" ]; then if [ "$1" == "n" ]; then - transmit_command + transmit_command_cw else From dee8062f0f2451bde16c57ae6f2904fa646c5463 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:01:39 -0400 Subject: [PATCH 280/402] Create direwolf-transmit-dtmf-fsk.conf --- direwolf/direwolf-transmit-dtmf-fsk.conf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 direwolf/direwolf-transmit-dtmf-fsk.conf diff --git a/direwolf/direwolf-transmit-dtmf-fsk.conf b/direwolf/direwolf-transmit-dtmf-fsk.conf new file mode 100644 index 00000000..780798f8 --- /dev/null +++ b/direwolf/direwolf-transmit-dtmf-fsk.conf @@ -0,0 +1,5 @@ +ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +MYCALL AMSAT +CHANNEL 0 +MODEM 1200 +CBEACON dest="DTMF-3" info="2 #" delay=0 From a2d41dc64bace2010fdf30a1da0ff295534d6ee7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:02:00 -0400 Subject: [PATCH 281/402] Create direwolf-transmit-dtmf-bpsk.conf --- direwolf/direwolf-transmit-dtmf-bpsk.conf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 direwolf/direwolf-transmit-dtmf-bpsk.conf diff --git a/direwolf/direwolf-transmit-dtmf-bpsk.conf b/direwolf/direwolf-transmit-dtmf-bpsk.conf new file mode 100644 index 00000000..2ddc75b3 --- /dev/null +++ b/direwolf/direwolf-transmit-dtmf-bpsk.conf @@ -0,0 +1,5 @@ +ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +MYCALL AMSAT +CHANNEL 0 +MODEM 1200 +CBEACON dest="DTMF-3" info="3 #" delay=0 From c2b78d13e45867025792693c1829fb0693d1006c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:02:30 -0400 Subject: [PATCH 282/402] Create direwolf-transmit-dtmf-sstv.conf --- direwolf/direwolf-transmit-dtmf-sstv.conf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 direwolf/direwolf-transmit-dtmf-sstv.conf diff --git a/direwolf/direwolf-transmit-dtmf-sstv.conf b/direwolf/direwolf-transmit-dtmf-sstv.conf new file mode 100644 index 00000000..65cd5712 --- /dev/null +++ b/direwolf/direwolf-transmit-dtmf-sstv.conf @@ -0,0 +1,5 @@ +ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +MYCALL AMSAT +CHANNEL 0 +MODEM 1200 +CBEACON dest="DTMF-3" info="1 #" delay=0 From ff323eab8ca17235765726b9275c3575696e2ee2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:02:58 -0400 Subject: [PATCH 283/402] Create direwolf-transmit-dtmf-cw.conf --- direwolf/direwolf-transmit-dtmf-cw.conf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 direwolf/direwolf-transmit-dtmf-cw.conf diff --git a/direwolf/direwolf-transmit-dtmf-cw.conf b/direwolf/direwolf-transmit-dtmf-cw.conf new file mode 100644 index 00000000..20f6f536 --- /dev/null +++ b/direwolf/direwolf-transmit-dtmf-cw.conf @@ -0,0 +1,5 @@ +ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +MYCALL AMSAT +CHANNEL 0 +MODEM 1200 +CBEACON dest="DTMF-3" info="5 #" delay=0 From 3f306c2464cb62e93776773b7558445b0b3c1300 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:03:10 -0400 Subject: [PATCH 284/402] Update direwolf-transmit-dtmf-sstv.conf --- direwolf/direwolf-transmit-dtmf-sstv.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-sstv.conf b/direwolf/direwolf-transmit-dtmf-sstv.conf index 65cd5712..79a601b1 100644 --- a/direwolf/direwolf-transmit-dtmf-sstv.conf +++ b/direwolf/direwolf-transmit-dtmf-sstv.conf @@ -2,4 +2,4 @@ ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 -CBEACON dest="DTMF-3" info="1 #" delay=0 +CBEACON dest="DTMF-3" info="4 #" delay=0 From 4525da69ea25500409294fb4db4579f44fc79e18 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:03:40 -0400 Subject: [PATCH 285/402] Create direwolf-transmit-dtmf-beacon.conf --- direwolf/direwolf-transmit-dtmf-beacon | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 direwolf/direwolf-transmit-dtmf-beacon diff --git a/direwolf/direwolf-transmit-dtmf-beacon b/direwolf/direwolf-transmit-dtmf-beacon new file mode 100644 index 00000000..ec3e6d8c --- /dev/null +++ b/direwolf/direwolf-transmit-dtmf-beacon @@ -0,0 +1,5 @@ +ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +MYCALL AMSAT +CHANNEL 0 +MODEM 1200 +CBEACON dest="DTMF-3" info="1 0 #" delay=0 From a3677fd5be42c0f3de0c75ae8844aa7b3ee9bf65 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:15:51 -0400 Subject: [PATCH 286/402] Update config added -o to turn beacon on/off --- config | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/config b/config index 206f949b..f9947e8f 100755 --- a/config +++ b/config @@ -1094,6 +1094,41 @@ elif [ "$1" = "-F" ]; then ## sudo reboot now # sudo systemctl restart rpitx # fi + +elif [ "$1" = "-o" ]; then + + echo + echo "Change telemetry beacon transmit state" + echo + + 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 + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Turn beacon telemetry ON" + sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1 + restart=1 + fi + + else + echo "Transmit beacon telemetry is on" + echo + echo "Do you want to turn beacon telemetry OFF(y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Turn beacon telemetry OFF" + touch /home/pi/CubeSatSim/beacon_off + restart=1 + fi + fi + elif [ "$1" = "-H" ]; then # echo @@ -1277,6 +1312,8 @@ elif [ "$1" = "-h" ]; then echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX" echo " -A Transmit APRS control packets to control another CubeSatSim" echo " -D Change Transmit command state APRS or DTMF" + echo " -o Change telemetry beacon transmit state" + echo exit From 924b70bfa7650d25ca048cb4157f9b505108a8f6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:17:52 -0400 Subject: [PATCH 287/402] Update config add print beacon state --- config | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config b/config index f9947e8f..aec9bf5f 100755 --- a/config +++ b/config @@ -324,6 +324,13 @@ if [ "$1" = "" ]; then echo "Battery saver mode is OFF" fi + FILE=/home/pi/CubeSatSim/beacon_off + if [ -f "$FILE" ]; then + echo "Transmit beacon telemetry is OFF" + else + echo "Transmit beacon telemetry is ON" + fi + echo echo -e "Current sim.cfg configuration file:" # echo @@ -1118,7 +1125,7 @@ elif [ "$1" = "-o" ]; then else echo "Transmit beacon telemetry is on" echo - echo "Do you want to turn beacon telemetry OFF(y/n) " + echo "Do you want to turn beacon telemetry OFF (y/n) " read reset echo From 32b8cced1a9ad1a847ad3b5a15ec38aece19be38 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:22:24 -0400 Subject: [PATCH 288/402] Update config -n toggles transmit C&C mode --- config | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/config b/config index aec9bf5f..afc9c020 100755 --- a/config +++ b/config @@ -1207,9 +1207,21 @@ elif [ "$1" = "-e" ]; then elif [ "$1" = "-n" ]; then echo "changing CubeSatSim to Transmit Command and Control mode" - sudo echo "n" > /home/pi/CubeSatSim/.mode - restart=1 + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + + if [ "$1" = "n" ]; then + echo "Turning Transmit Command and Control mode OFF" + echo "Switching to FSK mode" + sudo echo "f" > /home/pi/CubeSatSim/.mode + reboot=1 + else + echo "Turning Transmit Command and Control mode ON" + sudo echo "n" > /home/pi/CubeSatSim/.mode + restart=1 + fi elif [ "$1" = "-A" ]; then From 1dcb023601a8baa8ab6e73747f84e96fdca95969 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:31:34 -0400 Subject: [PATCH 289/402] Update config -o just restarts rpitx --- config | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config b/config index afc9c020..376272ed 100755 --- a/config +++ b/config @@ -1119,7 +1119,8 @@ elif [ "$1" = "-o" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Turn beacon telemetry ON" sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1 - restart=1 + sudo systemctl restart rpitx +# restart=1 fi else @@ -1132,7 +1133,8 @@ elif [ "$1" = "-o" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Turn beacon telemetry OFF" touch /home/pi/CubeSatSim/beacon_off - restart=1 + sudo systemctl restart rpitx +# restart=1 fi fi From 769089a920805e741057365ac52ec8cb63f0919f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 11:35:47 -0400 Subject: [PATCH 290/402] Update rpitx.py only transmit CW ID if beacon is on --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index f45febc7..25af87bf 100644 --- a/rpitx.py +++ b/rpitx.py @@ -413,7 +413,7 @@ if __name__ == "__main__": # if (mode != ) and (command_tx == True): # if (command_tx == True): - if (mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's'): + if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's')) and (command_tx == True): # battery_saver_mode output(txLed, txLedOn) # if (txc): From 8f324fe68d19c5fca6c811dcdd16163725ac8f3a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 19:37:24 -0400 Subject: [PATCH 291/402] Update rpitx.py add extra packet --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 25af87bf..a7d13c80 100644 --- a/rpitx.py +++ b/rpitx.py @@ -480,7 +480,8 @@ if __name__ == "__main__": sleep(0.2) # add more time at end output (ptt, 1) # output(pd, 0) - else: + else: + system("echo '\nAMSAT-11>APCSS:010101/hi hi ' >> t.txt") if (debug_mode == 1): system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/telem.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: From 7e01e97498fb0fe562ab0df72bf80b20bf6f875b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 19:39:52 -0400 Subject: [PATCH 292/402] Update rpitx.py remove extra space --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index a7d13c80..e373e55e 100644 --- a/rpitx.py +++ b/rpitx.py @@ -481,7 +481,7 @@ if __name__ == "__main__": output (ptt, 1) # output(pd, 0) else: - system("echo '\nAMSAT-11>APCSS:010101/hi hi ' >> t.txt") + system("echo 'AMSAT-11>APCSS:010101/hi hi ' >> t.txt") if (debug_mode == 1): system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/telem.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: From db55a3f17ed62f401cfddc6c2238c5d761e98b51 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 19:42:51 -0400 Subject: [PATCH 293/402] Update config add loopback --- config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config b/config index 376272ed..24109412 100755 --- a/config +++ b/config @@ -216,6 +216,8 @@ echo # echo $2 # echo +sudo modprobe snd-aloop + # if [ "$2" = "n" ] ; then if [ -z "$2" ] ; then noreboot=0 From d0c397a0dace7c901c0ff744343b4acd18548c43 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 15 Jul 2024 19:43:27 -0400 Subject: [PATCH 294/402] Update direwolf-transmit-dtmf-aprs.conf add Loopback --- direwolf/direwolf-transmit-dtmf-aprs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-aprs.conf b/direwolf/direwolf-transmit-dtmf-aprs.conf index 65cd5712..786102cd 100644 --- a/direwolf/direwolf-transmit-dtmf-aprs.conf +++ b/direwolf/direwolf-transmit-dtmf-aprs.conf @@ -1,4 +1,4 @@ -ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 From 65225e518567f972fbca13281f17534b8dbb0fb3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:04:03 -0400 Subject: [PATCH 295/402] Update direwolf-transmit-dtmf-beacon --- direwolf/direwolf-transmit-dtmf-beacon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-beacon b/direwolf/direwolf-transmit-dtmf-beacon index ec3e6d8c..305000a7 100644 --- a/direwolf/direwolf-transmit-dtmf-beacon +++ b/direwolf/direwolf-transmit-dtmf-beacon @@ -1,4 +1,4 @@ -ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 From 3dc5e6afd3f89674bf604605dd10a6f7155241ef Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:04:24 -0400 Subject: [PATCH 296/402] Rename direwolf-transmit-dtmf-beacon to direwolf-transmit-dtmf-beacon.conf --- ...lf-transmit-dtmf-beacon => direwolf-transmit-dtmf-beacon.conf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename direwolf/{direwolf-transmit-dtmf-beacon => direwolf-transmit-dtmf-beacon.conf} (100%) diff --git a/direwolf/direwolf-transmit-dtmf-beacon b/direwolf/direwolf-transmit-dtmf-beacon.conf similarity index 100% rename from direwolf/direwolf-transmit-dtmf-beacon rename to direwolf/direwolf-transmit-dtmf-beacon.conf From 154aa3c3f75c5d09c8c7bd103037eea0f977043d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:04:39 -0400 Subject: [PATCH 297/402] Update direwolf-transmit-dtmf-bpsk.conf --- direwolf/direwolf-transmit-dtmf-bpsk.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-bpsk.conf b/direwolf/direwolf-transmit-dtmf-bpsk.conf index 2ddc75b3..a0ae9b54 100644 --- a/direwolf/direwolf-transmit-dtmf-bpsk.conf +++ b/direwolf/direwolf-transmit-dtmf-bpsk.conf @@ -1,4 +1,4 @@ -ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 From b30d61eb4993879e11d46c0f75750bd13bb012e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:04:54 -0400 Subject: [PATCH 298/402] Update direwolf-transmit-dtmf-cw.conf --- direwolf/direwolf-transmit-dtmf-cw.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-cw.conf b/direwolf/direwolf-transmit-dtmf-cw.conf index 20f6f536..8629754f 100644 --- a/direwolf/direwolf-transmit-dtmf-cw.conf +++ b/direwolf/direwolf-transmit-dtmf-cw.conf @@ -1,4 +1,4 @@ -ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 From 6ce3a59293e97345a55e1dcdee36f3906e7e36a2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:05:15 -0400 Subject: [PATCH 299/402] Update direwolf-transmit-dtmf-fsk.conf --- direwolf/direwolf-transmit-dtmf-fsk.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-fsk.conf b/direwolf/direwolf-transmit-dtmf-fsk.conf index 780798f8..f197e583 100644 --- a/direwolf/direwolf-transmit-dtmf-fsk.conf +++ b/direwolf/direwolf-transmit-dtmf-fsk.conf @@ -1,4 +1,4 @@ -ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 From c051dbf4d9c96f14234a5865699f7ad683ea638b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:05:30 -0400 Subject: [PATCH 300/402] Update direwolf-transmit-dtmf-sstv.conf --- direwolf/direwolf-transmit-dtmf-sstv.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-sstv.conf b/direwolf/direwolf-transmit-dtmf-sstv.conf index 79a601b1..c58cb77f 100644 --- a/direwolf/direwolf-transmit-dtmf-sstv.conf +++ b/direwolf/direwolf-transmit-dtmf-sstv.conf @@ -1,4 +1,4 @@ -ADEVICE hw:CARD=Device,DEV=0 hw:CARD=Headphones,DEV=0 +ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 From e37594ebfd419321ff7e1b19af6b17d822c6f1ab Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:11:24 -0400 Subject: [PATCH 301/402] Update config add transmit command beacon --- config | 66 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/config b/config index 24109412..ccbfb306 100755 --- a/config +++ b/config @@ -1106,37 +1106,47 @@ elif [ "$1" = "-F" ]; then elif [ "$1" = "-o" ]; then - echo - echo "Change telemetry beacon transmit state" - echo - - 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 - echo + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value - 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 rpitx -# restart=1 - fi + if [ "$1" == "n" ]; then - else - echo "Transmit beacon telemetry is on" - echo - echo "Do you want to turn beacon telemetry OFF (y/n) " - read reset - echo + transmit_command_beacon - if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then - echo "Turn beacon telemetry OFF" - touch /home/pi/CubeSatSim/beacon_off - sudo systemctl restart rpitx -# restart=1 + else + echo + echo "Change telemetry beacon transmit state" + echo + + 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 + 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 rpitx + # restart=1 + fi + + else + echo "Transmit beacon telemetry is on" + echo + echo "Do you want to turn beacon telemetry OFF (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Turn beacon telemetry OFF" + touch /home/pi/CubeSatSim/beacon_off + sudo systemctl restart rpitx + # restart=1 + fi fi fi From 57ea8b9a65af87a23dfb3628fc8b4845586fe291 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:30:50 -0400 Subject: [PATCH 302/402] Update dtmf_aprs_cc.py changed from print to echo for -o --- dtmf_aprs_cc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index c42d92d1..a4cf6e53 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -50,12 +50,12 @@ if __name__ == "__main__": try: f = open("/home/pi/CubeSatSim/beacon_off", "r") f.close() - print("Beacon is on, turning it OFF") + system("echo 'Beacon is on, turning it OFF'") system("touch /home/pi/CubeSatSim/beacon_off") except: - print("Beacon is off, turning it ON") - system("sudo rm /home/pi/CubeSatSim/beacon_off") - print("Restarting rpitx") + system("echo 'Beacon is off, turning it ON'") + system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") + system("echo 'Restarting rpitx'") system("sudo systemctl restart rpitx") change_mode = False if (debug_mode == False) and (change_mode == True): From 7da07e861d4e3b2db49aeffe0c2d7483879b368f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:40:03 -0400 Subject: [PATCH 303/402] Update dtmf_aprs_cc.py swap -o on/off --- dtmf_aprs_cc.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index a4cf6e53..be927352 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -50,11 +50,12 @@ if __name__ == "__main__": try: f = open("/home/pi/CubeSatSim/beacon_off", "r") f.close() - system("echo 'Beacon is on, turning it OFF'") - system("touch /home/pi/CubeSatSim/beacon_off") - except: system("echo 'Beacon is off, turning it ON'") system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") + except: + system("echo 'Beacon is on, turning it OFF'") + system("touch /home/pi/CubeSatSim/beacon_off") + system("echo 'Restarting rpitx'") system("sudo systemctl restart rpitx") change_mode = False From 84cb3e22a7b0fec630524a8b5ab93e2f55b4b0fd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 08:52:37 -0400 Subject: [PATCH 304/402] Update dtmf_aprs_cc.py fix open --- dtmf_aprs_cc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index be927352..63c0b577 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -48,8 +48,8 @@ if __name__ == "__main__": if ((line.find("MODE=o")) > 0) or ((line.find("DTMF>APDW15:t10#")) > 0): system("echo '\nBeacon Mode toggle!!\n'") try: - f = open("/home/pi/CubeSatSim/beacon_off", "r") - f.close() + fm = open("/home/pi/CubeSatSim/beacon_off") + fm.close() system("echo 'Beacon is off, turning it ON'") system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") except: From e4f5b2b091241a980c0e7e39daab9558dd69dfba Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 12:06:29 -0400 Subject: [PATCH 305/402] Update command add RTL-SDR try if no sound card --- command | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/command b/command index 1f72333c..5b11279b 100755 --- a/command +++ b/command @@ -48,8 +48,16 @@ else if [ -f "$FILE" ]; then echo "Direwolf mode set but no USB soundcard detected!" - echo "Instead, starting Carrier (squelch) Command and Control" + echo "Trying RTL-FM for 60 seconds" + sudo modprobe snd-aloop + rtl_fm -M fm -f 435M -s 48k | aplay -D hw:2,0,0 -r 48000 -t raw -f S16_LE -c 1 & + direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0 & + sleep 60 + sudo killall -9 direwolf + sudo killall -9 rtl_fm + + echo "Starting Carrier (squelch) Command and Control" else echo "Starting Carrier (squelch) Command and Control" From 73a36349c4463d221e1986e0e8f1810f8b3e378f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 12:13:32 -0400 Subject: [PATCH 306/402] Update command search for USB Audio Device --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index 5b11279b..c05145b2 100755 --- a/command +++ b/command @@ -28,7 +28,7 @@ echo "Waiting 20 seconds for USB" sleep 20 FILE=/home/pi/CubeSatSim/command_control_direwolf -if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then +if [[ $(arecord -l | grep "USB Audio Device") ]] && [ -f "$FILE" ]; then echo "Starting Direwolf DTMF and APRS Command and Control" From 227f94fa6cfb9fc936b345cf19e4a0ca9f9945b0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 14:52:01 -0400 Subject: [PATCH 307/402] Update rpitx.py added sleep 10 for stored image modes --- rpitx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpitx.py b/rpitx.py index e373e55e..4c64b323 100644 --- a/rpitx.py +++ b/rpitx.py @@ -654,7 +654,7 @@ if __name__ == "__main__": # output(pd, 0) system("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1") - sleep(1) + sleep(10) else: try: command_control_check() @@ -745,7 +745,7 @@ if __name__ == "__main__": output(txLed, txLedOff) # output (ptt, 1) # output(pd, 0) - sleep(1) + sleep(10) elif (mode == 'b'): # command_control_check() From ae27190a97539ba745ca122b48ab3e26a9971f13 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 15:37:54 -0400 Subject: [PATCH 308/402] Update rpitx.py added skip --- rpitx.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rpitx.py b/rpitx.py index 4c64b323..80a3243a 100644 --- a/rpitx.py +++ b/rpitx.py @@ -263,7 +263,7 @@ print(txLed) debug_mode = 0 #no debugging rpitx if __name__ == "__main__": - + skip = False mode = "y" if (len(sys.argv)) > 1: # print("There are arguments!") @@ -272,6 +272,10 @@ if __name__ == "__main__": elif (('x' == sys.argv[1]) or ('-x' in sys.argv[1])): mode = "x" print("Forcing APRS mode") + elif (('s' == sys.argv[1]) or ('-s' in sys.argv[1])): + skip = True + print("Skipping delay and CW ID") + print(transmit) if ( mode == "y"): try: @@ -404,7 +408,7 @@ if __name__ == "__main__": print("Error in serial write") output(pd, 0) - if (mode != 'x'): + if (mode != 'x') and (skip == False): sleep(10) # delay so cubesatsim code catches up system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1") @@ -413,7 +417,7 @@ if __name__ == "__main__": # if (mode != ) and (command_tx == True): # if (command_tx == True): - if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's')) and (command_tx == True): + if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's')) and (command_tx == True) and (skip == False): # battery_saver_mode output(txLed, txLedOn) # if (txc): From a3ae07b221abe291ee0e32d10141c188a2e494b3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 15:41:47 -0400 Subject: [PATCH 309/402] Update dtmf_aprs_cc.py resume rpitx --- dtmf_aprs_cc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 63c0b577..c2383e2a 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -56,8 +56,10 @@ if __name__ == "__main__": system("echo 'Beacon is on, turning it OFF'") system("touch /home/pi/CubeSatSim/beacon_off") - system("echo 'Restarting rpitx'") - system("sudo systemctl restart rpitx") +# system("echo 'Restarting rpitx'") +# system("sudo systemctl restart rpitx") + system("echo 'Resuming rpitx'") + system("python3 -u /home/pi/CubeSatSim/rpitx.py s") change_mode = False if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) From a91b77f3f822fa2abe21653d635951e960f5a3a3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 15:43:51 -0400 Subject: [PATCH 310/402] Update config -o resume --- config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config b/config index ccbfb306..440d28e0 100755 --- a/config +++ b/config @@ -1130,7 +1130,9 @@ elif [ "$1" = "-o" ]; then 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 rpitx + sudo systemctl stop rpitx + sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1 + # restart=1 fi From 4f65e60711243303c51107bcc799b085ec55f5f2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 16 Jul 2024 15:44:53 -0400 Subject: [PATCH 311/402] Update dtmf_aprs_cc.py background --- dtmf_aprs_cc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index c2383e2a..ef5c589c 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -57,9 +57,9 @@ if __name__ == "__main__": system("touch /home/pi/CubeSatSim/beacon_off") # system("echo 'Restarting rpitx'") -# system("sudo systemctl restart rpitx") + system("sudo systemctl stop rpitx") system("echo 'Resuming rpitx'") - system("python3 -u /home/pi/CubeSatSim/rpitx.py s") + system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") change_mode = False if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) From 0629681b88f5469cd35ed1f32791188a5bac640d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 18 Jul 2024 09:43:42 -0400 Subject: [PATCH 312/402] no reboot on mode change --- config | 29 ++++++++++++++++++++++------- rpitx.py | 28 +++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/config b/config index 440d28e0..76706eae 100755 --- a/config +++ b/config @@ -365,7 +365,11 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode - reboot=1 + if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + reboot=1 + else + restart=1 + fi fi elif [ "$1" = "-m" ]; then @@ -382,7 +386,11 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode - reboot=1 + if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + reboot=1 + else + restart=1 + fi fi elif [ "$1" = "-f" ]; then @@ -399,7 +407,7 @@ elif [ "$1" = "-f" ]; then echo "changing CubeSatSim to FSK mode" sudo echo "f" > /home/pi/CubeSatSim/.mode - reboot=1 + restart=1 fi elif [ "$1" = "-b" ]; then @@ -416,7 +424,7 @@ elif [ "$1" = "-b" ]; then echo "changing CubeSatSim to BPSK mode" sudo echo "b" > /home/pi/CubeSatSim/.mode - reboot=1 + restart=1 fi elif [ "$1" = "-s" ]; then @@ -433,7 +441,11 @@ elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" sudo echo "s" > /home/pi/CubeSatSim/.mode - reboot=1 + if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + reboot=1 + else + restart=1 + fi fi elif [ "$1" = "-t" ]; then @@ -1130,8 +1142,8 @@ elif [ "$1" = "-o" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Turn beacon telemetry ON" sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1 - sudo systemctl stop rpitx - sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1 + sudo systemctl restart rpitx + # sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1 # restart=1 fi @@ -1365,6 +1377,8 @@ fi # echo $noreboot +#reboot=0 +#restart=1 if [ "$reboot" = "1" ] ; then if [ "$noreboot" = "0" ] ; then @@ -1380,6 +1394,7 @@ fi if [ "$restart" = "1" ] ; then if [ "$reboot" = "0" ] ; then echo "Restarting" + sudo systemctl stop rpitx sudo systemctl restart cubesatsim else echo "Restart needed for changes to take effect" diff --git a/rpitx.py b/rpitx.py index 80a3243a..a85f92bc 100644 --- a/rpitx.py +++ b/rpitx.py @@ -262,8 +262,9 @@ print(txLed) debug_mode = 0 #no debugging rpitx +skip = False + if __name__ == "__main__": - skip = False mode = "y" if (len(sys.argv)) > 1: # print("There are arguments!") @@ -277,6 +278,24 @@ if __name__ == "__main__": print("Skipping delay and CW ID") print(transmit) + + + try: + system("cat /proc/uptime > /home/pi/CubeSatSim/uptime") + file = open("/home/pi/CubeSatSim/uptime") + up = file.read().split(" ")[0] +# print(up) + uptime = float(up) +# print(uptime) + if (uptime < 30): + print("Uptime < 30 seconds") + else: + print("Uptime > 30 seconds") + skip = True + file.close() + except: + print("Can't open /proc/uptime") + if ( mode == "y"): try: file = open("/home/pi/CubeSatSim/.mode") @@ -408,8 +427,8 @@ if __name__ == "__main__": print("Error in serial write") output(pd, 0) - if (mode != 'x') and (skip == False): - sleep(10) # delay so cubesatsim code catches up +# if (mode != 'x') and (skip == False): +# sleep(10) # delay so cubesatsim code catches up system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1") @@ -460,6 +479,8 @@ if __name__ == "__main__": print("Transmit APRS Commands") # while True: # sleep(0.1) + system("touch /home/pi/CubeSatSim/ready") + while True: try: f = open("/home/pi/CubeSatSim/ready") @@ -506,6 +527,7 @@ if __name__ == "__main__": command_control_check() sleep(1) elif (mode == 'm'): + system("touch /home/pi/CubeSatSim/cwready") print("CW") while True: command_control_check() From 02f70d80d5dc26cfae0b70095dae1df5363fb3eb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 18 Jul 2024 09:53:59 -0400 Subject: [PATCH 313/402] Update main.c add uptime_sec check for 5 or 10 sec sleep at start --- main.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index d1e63bf7..a47a73fa 100644 --- a/main.c +++ b/main.c @@ -31,6 +31,11 @@ int main(int argc, char * argv[]) { fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); fclose(file_test); + + FILE * uptime_file = fopen("/proc/uptime", "r"); + fscanf(uptime_file, "%f", & uptime_sec); + printf("Uptime sec: %f \n", uptime_sec); + fclose(uptime_file); fprintf(stderr, " %x ", resbuffer[0]); fprintf(stderr, " %x \n", resbuffer[1]); @@ -38,8 +43,11 @@ int main(int argc, char * argv[]) { { // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - pi_zero_2_offset = 500; - sleep(5); // try sleep at start to help boot + pi_zero_2_offset = 500; + if (uptime_sec > 30) { + printf("Sleep 5 sec"); + sleep(5); // try sleep at start to help boot + } } else { printf("Pi Zero detected\n"); @@ -54,7 +62,10 @@ int main(int argc, char * argv[]) { printf("Command and control Carrier (squelch) is ON\n"); } } - sleep(10); + if (uptime_sec > 30) { + printf("Sleep 10 sec"); + sleep(10); + } } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); From 4244d2a3d7d8ddb73693fbd37de57ce2b5c2e0ba Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 18 Jul 2024 09:59:15 -0400 Subject: [PATCH 314/402] Update main.c fix > to < --- main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index a47a73fa..9e6f1cb9 100644 --- a/main.c +++ b/main.c @@ -42,28 +42,28 @@ int main(int argc, char * argv[]) { if ((resbuffer[0] == '9') && (resbuffer[1] == '0')) { // voltageThreshold = 3.7; - printf("Pi Zero 2 detected\n"); + fprintf(stderr, "Pi Zero 2 detected\n"); pi_zero_2_offset = 500; - if (uptime_sec > 30) { - printf("Sleep 5 sec"); + if (uptime_sec < 30.0) { + fprintf(stderr, "Sleep 5 sec"); sleep(5); // try sleep at start to help boot } } else { - printf("Pi Zero detected\n"); + fprintf(stderr,"Pi Zero detected\n"); FILE * command_file = fopen("/home/pi/CubeSatSim/command_control", "r"); if (command_file == NULL) { pi_zero_2_offset = 500; - printf("Command and control is OFF\n"); + fprintf(stderr,"Command and control is OFF\n"); } else { command_file = fopen("/home/pi/CubeSatSim/command_control_direwolf", "r"); if (command_file == NULL) { pi_zero_2_offset = 500; - printf("Command and control Carrier (squelch) is ON\n"); + fprintf(stderr,"Command and control Carrier (squelch) is ON\n"); } } - if (uptime_sec > 30) { - printf("Sleep 10 sec"); + if (uptime_sec < 30.0) { + fprintf(stderr,"Sleep 10 sec"); sleep(10); } } From fb42fdd0c016a723df8b586f00ec35a27f72b29d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 20 Jul 2024 16:35:43 -0400 Subject: [PATCH 315/402] Update command add rtl-test and debug direwolf --- command | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/command b/command index c05145b2..f58fc66a 100755 --- a/command +++ b/command @@ -49,15 +49,30 @@ else echo "Direwolf mode set but no USB soundcard detected!" - echo "Trying RTL-FM for 60 seconds" + echo "Trying RTL-FM" + + timeout 5 rtl-test + sudo modprobe snd-aloop rtl_fm -M fm -f 435M -s 48k | aplay -D hw:2,0,0 -r 48000 -t raw -f S16_LE -c 1 & - direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0 & - sleep 60 - sudo killall -9 direwolf - sudo killall -9 rtl_fm - echo "Starting Carrier (squelch) Command and Control" + if [ "$1" = "d" ]; then + + echo "debug mode" + + direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + + else + + direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + + fi + + sleep 5 +# sudo killall -9 direwolf +# sudo killall -9 rtl_fm + +# echo "Starting Carrier (squelch) Command and Control" else echo "Starting Carrier (squelch) Command and Control" From c4e0330b2a59db220b6b2d9430b7f6ac425630ce Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 20 Jul 2024 16:40:47 -0400 Subject: [PATCH 316/402] Update command add Loopback check --- command | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/command b/command index f58fc66a..b4f8e037 100755 --- a/command +++ b/command @@ -23,6 +23,18 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" # exit 1 fi +if [ "$1" = "d" ]; then + + echo "debug mode" + + debug=1 + +else + + debug=0 + +fi + echo "Waiting 20 seconds for USB" sleep 20 @@ -32,7 +44,7 @@ if [[ $(arecord -l | grep "USB Audio Device") ]] && [ -f "$FILE" ]; then echo "Starting Direwolf DTMF and APRS Command and Control" - if [ "$1" = "d" ]; then + if [ "$debug" = "1" ]; then echo "debug mode" @@ -54,9 +66,14 @@ else timeout 5 rtl-test sudo modprobe snd-aloop - rtl_fm -M fm -f 435M -s 48k | aplay -D hw:2,0,0 -r 48000 -t raw -f S16_LE -c 1 & - if [ "$1" = "d" ]; then + value=`aplay -l | grep "Loopback"` + echo "$value" > /dev/null + set -- $value + + 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 & + + if [ "$debug" = "1" ]; then echo "debug mode" From 151b4e6121ad675e38e24550eb76ddbafa4560e9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 20 Jul 2024 17:52:41 -0400 Subject: [PATCH 317/402] config don't prompt -o --- config | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/config b/config index 76706eae..b610cf0a 100755 --- a/config +++ b/config @@ -1134,9 +1134,11 @@ 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 +# echo +# echo "Do you want to turn beacon telemetry ON (y/n) " +# read reset + + reset="y" echo if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then @@ -1150,9 +1152,10 @@ elif [ "$1" = "-o" ]; then else echo "Transmit beacon telemetry is on" - echo - echo "Do you want to turn beacon telemetry OFF (y/n) " - read reset +# echo +# echo "Do you want to turn beacon telemetry OFF (y/n) " +# read reset + reset="y" echo if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then From fd0de3843a8f035ab66bd1069dd43091b31d6ad4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 20 Jul 2024 18:07:01 -0400 Subject: [PATCH 318/402] Update command no timeout on rtl_test --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index b4f8e037..6597b58e 100755 --- a/command +++ b/command @@ -63,7 +63,7 @@ else echo "Trying RTL-FM" - timeout 5 rtl-test + rtl-test sudo modprobe snd-aloop From a42e0dae9a58396cadbc9f4a74fc250dbca1c445 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 20 Jul 2024 18:23:14 -0400 Subject: [PATCH 319/402] Update update disable rpitx --- update | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/update b/update index c92b1450..2dede7ad 100755 --- a/update +++ b/update @@ -74,6 +74,8 @@ else echo "no changes to rpitx.service." fi +sudo systemctl disable rpitx + FILE=/etc/systemd/system/command.service if [ -f "$FILE" ]; then if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then @@ -304,13 +306,13 @@ if [ "$noreboot" = "0" ] ; then echo "systemctl daemon-reload and reboot" sudo systemctl daemon-reload sudo reboot -h now -# sudo systemctl restart cubesatsim +# sudo cubesatsim else grep 'changed' /home/pi/CubeSatSim/.updated if [[ $(grep 'changed' /home/pi/CubeSatSim/.updated) ]]; then echo "reboot due to code changes " | wall sudo reboot -h now -# sudo systemctl restart cubesatsim +# sudo cubesatsim else echo "nothing to do." fi From 2edcfb80583e7cbef60149296b137536afaf8349 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 20 Jul 2024 18:29:50 -0400 Subject: [PATCH 320/402] Update config don't reboot for any mode changes --- config | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config b/config index b610cf0a..318739be 100755 --- a/config +++ b/config @@ -366,6 +366,7 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode if [ "$1" == "f" ] || [ "$1" == "b" ] ; then +# restart=1 reboot=1 else restart=1 @@ -387,7 +388,8 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode if [ "$1" == "f" ] || [ "$1" == "b" ] ; then - reboot=1 +# reboot=1 + restart=1 else restart=1 fi @@ -442,7 +444,8 @@ elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" sudo echo "s" > /home/pi/CubeSatSim/.mode if [ "$1" == "f" ] || [ "$1" == "b" ] ; then - reboot=1 +# reboot=1 + restart=1 else restart=1 fi From f8b0b91ec8012a9c6f43bf5be950fe2f56024fac Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 21 Jul 2024 10:24:11 -0400 Subject: [PATCH 321/402] Update config only reboot on F->a or m --- config | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config b/config index 318739be..be65667f 100755 --- a/config +++ b/config @@ -365,7 +365,8 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] ; then +# if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + if [ "$1" == "f" ] ; then # restart=1 reboot=1 else @@ -387,9 +388,10 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] ; then -# reboot=1 - restart=1 +# if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + if [ "$1" == "f" ] ; then + reboot=1 +# restart=1 else restart=1 fi From 98dc0ad3b00687cc4bff2f667b6842affb5a094b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 21 Jul 2024 10:33:18 -0400 Subject: [PATCH 322/402] Update config reverting - only restart on all mode changes --- config | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/config b/config index be65667f..dbbc2658 100755 --- a/config +++ b/config @@ -365,8 +365,7 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode -# if [ "$1" == "f" ] || [ "$1" == "b" ] ; then - if [ "$1" == "f" ] ; then + if [ "$1" == "f" ] || [ "$1" == "b" ] ; then # restart=1 reboot=1 else @@ -388,10 +387,9 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode -# if [ "$1" == "f" ] || [ "$1" == "b" ] ; then - if [ "$1" == "f" ] ; then - reboot=1 -# restart=1 + if [ "$1" == "f" ] || [ "$1" == "b" ] ; then +# reboot=1 + restart=1 else restart=1 fi @@ -1408,5 +1406,3 @@ if [ "$restart" = "1" ] ; then echo "Restart needed for changes to take effect" fi fi - - From fe43a2e4b91c499173394baba9bbdceab9254cce Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 21 Jul 2024 15:17:21 -0400 Subject: [PATCH 323/402] Update config fix -m and -a for no reboot if mode b --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index dbbc2658..1af687af 100755 --- a/config +++ b/config @@ -365,7 +365,7 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + if [ "$1" == "f" ] ; then # restart=1 reboot=1 else @@ -387,7 +387,7 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + if [ "$1" == "f" ] ; then # reboot=1 restart=1 else From 24aca1430fbf0c2601245fb4070dc6f12e4bf485 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 21 Jul 2024 15:18:08 -0400 Subject: [PATCH 324/402] Update update add rpitx check and update --- update | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/update b/update index 2dede7ad..5e3098b6 100755 --- a/update +++ b/update @@ -159,6 +159,13 @@ if [ ! -d "/home/pi/PiSSTVpp" ]; then fi +if [[ $(grep 'SYNCWITHPWM' /home/pi/rpitx/src/librpitx/src/fskburst.h) ]]; then + echo "rpitx already updated" + else + echo "updating rpitx" + /home/pi/rpitx/update.sh + fi + cd /home/pi/pi-power-button git checkout reboot-mode-change-beta > .updated_b From 1d494238e335f5f385366a7f0d4f148157829b7b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 21 Jul 2024 15:23:09 -0400 Subject: [PATCH 325/402] Update update added git pull to rpitx update --- update | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/update b/update index 5e3098b6..304bd83a 100755 --- a/update +++ b/update @@ -161,10 +161,13 @@ fi if [[ $(grep 'SYNCWITHPWM' /home/pi/rpitx/src/librpitx/src/fskburst.h) ]]; then echo "rpitx already updated" - else +else echo "updating rpitx" - /home/pi/rpitx/update.sh - fi + cd /home/pi/rpitx + git pull + ./update.sh + cd +fi cd /home/pi/pi-power-button From 46d14d3e36dddc26153f106028ad6c45a4f0901e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 21 Jul 2024 15:38:42 -0400 Subject: [PATCH 326/402] Update config adding -L to change mic level --- config | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/config b/config index 1af687af..2d4ebbdd 100755 --- a/config +++ b/config @@ -1332,6 +1332,23 @@ elif [ "$1" = "-A" ]; then reboot=1 fi +elif [ "$1" = "-L" ]; then + + echo + echo "Setting microphone level for command and control" + echo + + echo -e "Enter microphone level in percentage (integer 0 - 100): " + + read mic + + if ! [ -z $mic ] && [[ $mic =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then + echo "Updating mic level" + value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c ${2:0:1} set Mic $mic % + else + echo "Not updating mic level" + fi + elif [ "$1" = "-h" ]; then echo "config OPTION" @@ -1366,7 +1383,7 @@ elif [ "$1" = "-h" ]; then echo " -A Transmit APRS control packets to control another CubeSatSim" echo " -D Change Transmit command state APRS or DTMF" echo " -o Change telemetry beacon transmit state" - + echo " -L Change microphone level for command and control" echo exit From 6f82fa9775b6f672205cf8a58769a10de92cc5c5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 21 Jul 2024 16:22:33 -0400 Subject: [PATCH 327/402] Update config fixed amixer % --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 2d4ebbdd..50333294 100755 --- a/config +++ b/config @@ -1344,7 +1344,7 @@ elif [ "$1" = "-L" ]; then if ! [ -z $mic ] && [[ $mic =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then echo "Updating mic level" - value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c ${2:0:1} set Mic $mic % + value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c ${2:0:1} set Mic $mic% else echo "Not updating mic level" fi From f72649907bef1416faee03412c591699b7516750 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 12:03:22 -0400 Subject: [PATCH 328/402] Update config back to reboot on mode changes from b or f --- config | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/config b/config index 50333294..3c6f1faf 100755 --- a/config +++ b/config @@ -250,7 +250,7 @@ if [ "$1" = "" ]; then elif [ "$1" = "e" ]; then echo "Mode is Repeater" elif [ "$1" = "n" ]; then - echo -n "Mode is Transmit Command and Control with " + echo -n "Mode is Transmit Commands with " FILE=/home/pi/CubeSatSim/transmit_dtmf if [ -f "$FILE" ]; then echo -n "DTMF" @@ -365,7 +365,7 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] ; then + if [ "$1" == "f" ] || [ "$1" == "b" ] ; then # restart=1 reboot=1 else @@ -387,9 +387,9 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] ; then -# reboot=1 - restart=1 + if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + reboot=1 +# restart=1 else restart=1 fi @@ -444,8 +444,8 @@ elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" sudo echo "s" > /home/pi/CubeSatSim/.mode if [ "$1" == "f" ] || [ "$1" == "b" ] ; then -# reboot=1 - restart=1 + reboot=1 +# restart=1 else restart=1 fi @@ -826,31 +826,31 @@ elif [ "$1" = "-d" ]; then elif [ "$1" = "-D" ]; then echo - echo "Change Transmit command state" + echo "Change Transmit Commands state" echo FILE=/home/pi/CubeSatSim/transmit_dtmf if [ -f "$FILE" ]; then - echo "Transmit commands in DTMF is set" + echo "Transmit Commands in DTMF is set" echo - echo "Do you want to transmit commands in APRS (y/n) " + echo "Do you want to Transmit Commands in APRS (y/n) " read reset echo if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then - echo "Transmit commands in APRS" + echo "Transmit Commands in APRS" sudo rm /home/pi/CubeSatSim/transmit_dtmf > /dev/null 2>&1 fi else - echo "Transmit commands in APRS is set" + echo "Transmit Commands in APRS is set" echo - echo "Do you want to transmit commands in DTMF (y/n) " + echo "Do you want to Transmit Commands in DTMF (y/n) " read reset echo if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then - echo "Transmit commands in DTMF" + echo "Transmit Commands in DTMF" touch /home/pi/CubeSatSim/transmit_dtmf fi fi @@ -1240,22 +1240,11 @@ elif [ "$1" = "-e" ]; then elif [ "$1" = "-n" ]; then - echo "changing CubeSatSim to Transmit Command and Control mode" + echo "changing CubeSatSim to Transmit Commands mode" - value=`cat /home/pi/CubeSatSim/.mode` - echo "$value" > /dev/null - set -- $value + sudo echo "n" > /home/pi/CubeSatSim/.mode + restart=1 - if [ "$1" = "n" ]; then - echo "Turning Transmit Command and Control mode OFF" - echo "Switching to FSK mode" - sudo echo "f" > /home/pi/CubeSatSim/.mode - reboot=1 - else - echo "Turning Transmit Command and Control mode ON" - sudo echo "n" > /home/pi/CubeSatSim/.mode - restart=1 - fi elif [ "$1" = "-A" ]; then @@ -1361,7 +1350,7 @@ elif [ "$1" = "-h" ]; then echo " -f Change to FSK/DUV mode" echo " -b Change to BPSK mode" echo " -s Change to SSTV mode" - echo " -n Change to Transmit Command and Control mode" + echo " -n Change to Transmit Commands mode" echo " -e Change to Repeater mode" echo " -i Restart CubeSatsim software" echo " -c Change the CALLSIGN in the configuration file sim.cfg" @@ -1381,7 +1370,7 @@ elif [ "$1" = "-h" ]; then echo " -v Display voltage and current data" echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX" echo " -A Transmit APRS control packets to control another CubeSatSim" - echo " -D Change Transmit command state APRS or DTMF" + echo " -D Change Transmit Commands state APRS or DTMF" echo " -o Change telemetry beacon transmit state" echo " -L Change microphone level for command and control" echo From fec9e4613f527c3940cfe5ba9a652e2989b4d7de Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 12:04:45 -0400 Subject: [PATCH 329/402] Update main.h changed repeater and commands to 11 and 12 --- main.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.h b/main.h index b3627a21..eb82e27b 100644 --- a/main.h +++ b/main.h @@ -105,8 +105,8 @@ FILE *telem_file; #define BPSK 3 #define SSTV 4 #define CW 5 -#define REPEATER 6 -#define TXCOMMAND 7 +#define REPEATER 11 +#define TXCOMMAND 12 int rpitxStatus = -1; From ec5578ca8b8c421e713d415f9e30ecff33a80350 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 12:27:55 -0400 Subject: [PATCH 330/402] Update config don't reboot if in safe mode (battery saver) --- config | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/config b/config index 3c6f1faf..8eca1066 100755 --- a/config +++ b/config @@ -366,8 +366,12 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode if [ "$1" == "f" ] || [ "$1" == "b" ] ; then -# restart=1 - reboot=1 + FILE=/home/pi/CubeSatSim/battery_saver + if [ -f "$FILE" ]; then + restart=1 + else + reboot=1 + fi else restart=1 fi @@ -388,8 +392,12 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode if [ "$1" == "f" ] || [ "$1" == "b" ] ; then - reboot=1 -# restart=1 + FILE=/home/pi/CubeSatSim/battery_saver + if [ -f "$FILE" ]; then + restart=1 + else + reboot=1 + fi else restart=1 fi @@ -444,8 +452,13 @@ elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" sudo echo "s" > /home/pi/CubeSatSim/.mode if [ "$1" == "f" ] || [ "$1" == "b" ] ; then - reboot=1 -# restart=1 + + FILE=/home/pi/CubeSatSim/battery_saver + if [ -f "$FILE" ]; then + restart=1 + else + reboot=1 + fi else restart=1 fi From 980d93f05a4a3fa3e46bfc7c4425c70540e83f5c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 15:58:09 -0400 Subject: [PATCH 331/402] Update config put back -n prompt --- config | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/config b/config index 8eca1066..4a454d1e 100755 --- a/config +++ b/config @@ -1255,9 +1255,16 @@ elif [ "$1" = "-n" ]; then echo "changing CubeSatSim to Transmit Commands mode" - sudo echo "n" > /home/pi/CubeSatSim/.mode - restart=1 - + if [ "$1" = "n" ]; then + echo "Turning Transmit Command and Control mode OFF" + echo "Switching to FSK mode" + sudo echo "f" > /home/pi/CubeSatSim/.mode + reboot=1 + else + echo "Turning Transmit Command and Control mode ON" + sudo echo "n" > /home/pi/CubeSatSim/.mode + restart=1 + fi elif [ "$1" = "-A" ]; then From 765b838b5cde95bb2c7d77564333f28aad10fd65 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 16:25:15 -0400 Subject: [PATCH 332/402] Update config prompt in -n mode again --- config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config b/config index 4a454d1e..36852ffb 100755 --- a/config +++ b/config @@ -1255,6 +1255,10 @@ elif [ "$1" = "-n" ]; then echo "changing CubeSatSim to Transmit Commands mode" + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + if [ "$1" = "n" ]; then echo "Turning Transmit Command and Control mode OFF" echo "Switching to FSK mode" From 94abd01256b7d4b0b022eb6390827adab35d6a48 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 16:25:48 -0400 Subject: [PATCH 333/402] Update config add spaces --- config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config b/config index 36852ffb..b90679c2 100755 --- a/config +++ b/config @@ -284,7 +284,7 @@ if [ "$1" = "" ]; then echo -n "Current command count is: " cat /home/pi/CubeSatSim/command_count.txt echo - echo +# echo # echo "Current beacon transmit mode is:" # cat /home/pi/CubeSatSim/command_tx # echo @@ -326,6 +326,7 @@ if [ "$1" = "" ]; then echo "Battery saver mode is OFF" fi + echo FILE=/home/pi/CubeSatSim/beacon_off if [ -f "$FILE" ]; then echo "Transmit beacon telemetry is OFF" From 1982bb5a2976c074275e7aeec53464292b0ff951 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 16:34:47 -0400 Subject: [PATCH 334/402] Update command use rtl_test to run direwolf --- command | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/command b/command index 6597b58e..c9d2bffb 100755 --- a/command +++ b/command @@ -61,35 +61,39 @@ else echo "Direwolf mode set but no USB soundcard detected!" - echo "Trying RTL-FM" +# echo "Trying RTL-FM" - rtl-test + if [[ $(rtl-test | grep "No supported devices found.") ]] ; then - sudo modprobe snd-aloop + echo "No RTL-SDR detected. Command and control is OFF" +# sleep 60 - value=`aplay -l | grep "Loopback"` - echo "$value" > /dev/null - set -- $value - - 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 & - - if [ "$debug" = "1" ]; then - - echo "debug mode" - - direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d - else - - direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py - - fi - - sleep 5 -# sudo killall -9 direwolf -# sudo killall -9 rtl_fm -# echo "Starting Carrier (squelch) Command and Control" + sudo modprobe snd-aloop + + value=`aplay -l | grep "Loopback"` + echo "$value" > /dev/null + set -- $value + + 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 & + + if [ "$debug" = "1" ]; then + + echo "debug mode" + + direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + + else + + direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + + fi + + sleep 5 + # sudo killall -9 direwolf + # sudo killall -9 rtl_fm + fi else echo "Starting Carrier (squelch) Command and Control" From ce16d20bd6bbf290a65d97cf815b6803e0f0effc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 16:38:14 -0400 Subject: [PATCH 335/402] Update command fixed rtl_test --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index c9d2bffb..ebc5661f 100755 --- a/command +++ b/command @@ -63,7 +63,7 @@ else # echo "Trying RTL-FM" - if [[ $(rtl-test | grep "No supported devices found.") ]] ; then + if [[ $(rtl_test | grep "No supported devices found.") ]] ; then echo "No RTL-SDR detected. Command and control is OFF" # sleep 60 From 9808849c0fd9b33ff50433801280becfd02a5216 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 16:42:17 -0400 Subject: [PATCH 336/402] Update command RTL-SDR detection updated --- command | 1 + 1 file changed, 1 insertion(+) diff --git a/command b/command index ebc5661f..ee4da5ba 100755 --- a/command +++ b/command @@ -70,6 +70,7 @@ else else + echo "RTL-SDR detected." sudo modprobe snd-aloop value=`aplay -l | grep "Loopback"` From eca4809fc43dfc9eaa357be25d0dadca648becc7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 16:43:58 -0400 Subject: [PATCH 337/402] Update command try test --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index ee4da5ba..e83ca7a5 100755 --- a/command +++ b/command @@ -63,7 +63,7 @@ else # echo "Trying RTL-FM" - if [[ $(rtl_test | grep "No supported devices found.") ]] ; then + if [ $(rtl_test | grep "No supported devices found.") ] ; then echo "No RTL-SDR detected. Command and control is OFF" # sleep 60 From 088c7058d0b3c40eb304c4ccf4450a4187849170 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 17:02:19 -0400 Subject: [PATCH 338/402] Update command fix rtl_test --- command | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/command b/command index e83ca7a5..b3d296f2 100755 --- a/command +++ b/command @@ -63,7 +63,8 @@ else # echo "Trying RTL-FM" - if [ $(rtl_test | grep "No supported devices found.") ] ; then + timeout 1 rtl_test &> out.txt + if [ $(grep "No supported" out.txt && rm out.txt) ] ; then echo "No RTL-SDR detected. Command and control is OFF" # sleep 60 @@ -95,6 +96,7 @@ else # sudo killall -9 direwolf # sudo killall -9 rtl_fm fi + rm out.txt else echo "Starting Carrier (squelch) Command and Control" From aee9dec0d765200e93fefae2840c159edb6a38e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 17:07:00 -0400 Subject: [PATCH 339/402] Update command fix grep --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index b3d296f2..06662c4f 100755 --- a/command +++ b/command @@ -64,7 +64,7 @@ else # echo "Trying RTL-FM" timeout 1 rtl_test &> out.txt - if [ $(grep "No supported" out.txt && rm out.txt) ] ; then + if [ $(grep "No supported" out.txt) ] ; then echo "No RTL-SDR detected. Command and control is OFF" # sleep 60 From b306a9b68a41a9e74867c247546b4685dbd6f430 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 17:13:13 -0400 Subject: [PATCH 340/402] Update command fix grep --- command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command b/command index 06662c4f..599d800f 100755 --- a/command +++ b/command @@ -64,7 +64,7 @@ else # echo "Trying RTL-FM" timeout 1 rtl_test &> out.txt - if [ $(grep "No supported" out.txt) ] ; then + if [[ $(grep "No supported" out.txt) ]] ; then echo "No RTL-SDR detected. Command and control is OFF" # sleep 60 From d8edfb808c52915aa301491c02620c17016fec5b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 22 Jul 2024 17:31:09 -0400 Subject: [PATCH 341/402] Update .gitignore added additional files --- .gitignore | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitignore b/.gitignore index 220663f2..57339550 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,20 @@ telem.wav cw.txt cwready logr.txt +command_control +command_control_direwolf +command_count.txt +command_tx +cw0.txt +cw1.txt +cw2.txt +cw3.txt +cw4.txt +cw5.txt +cw6.txt +logc.txt +telem.txt +telem_string.txt +test +transmit_dtmf +uptime From 80e87185932f947ba85d81149d7be4d56cd6396a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 13:17:27 -0400 Subject: [PATCH 342/402] Update dtmf_aprs_cc.py fix beacon on/off --- dtmf_aprs_cc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index ef5c589c..a77a65b0 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -56,10 +56,10 @@ if __name__ == "__main__": system("echo 'Beacon is on, turning it OFF'") system("touch /home/pi/CubeSatSim/beacon_off") -# system("echo 'Restarting rpitx'") - system("sudo systemctl stop rpitx") - system("echo 'Resuming rpitx'") - system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") + system("echo 'Restarting rpitx'") + system("sudo systemctl restart rpitx") +# system("echo 'Resuming rpitx'") +# system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") change_mode = False if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) From 27d51a615f6fffb125f90e07d2a6dfe3871a6a3b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 13:22:07 -0400 Subject: [PATCH 343/402] Update rpitx.py fix green LED --- rpitx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rpitx.py b/rpitx.py index a85f92bc..275807ed 100644 --- a/rpitx.py +++ b/rpitx.py @@ -201,6 +201,7 @@ GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(txc_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(green, GPIO.OUT) +GPIO.output(powerPin, 1) transmit = False if GPIO.input(12) == False: From 7bd5e53f7f6d953df4fba17482c9f813443dcc9d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 13:43:06 -0400 Subject: [PATCH 344/402] Update rpitx.py test txLed --- rpitx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rpitx.py b/rpitx.py index 275807ed..21854578 100644 --- a/rpitx.py +++ b/rpitx.py @@ -408,6 +408,7 @@ if __name__ == "__main__": print(callsign) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 + print(txLed) GPIO.setup(txLed, GPIO.OUT) print("Programming FM module!\n"); From 771c9d6aafb0442beedaa2cee9ceb02171587e70 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:04:05 -0400 Subject: [PATCH 345/402] Update rpitx.py print Led info --- rpitx.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rpitx.py b/rpitx.py index 21854578..e8fcf468 100644 --- a/rpitx.py +++ b/rpitx.py @@ -409,6 +409,7 @@ if __name__ == "__main__": print(callsign) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 print(txLed) + print(txLedOn) GPIO.setup(txLed, GPIO.OUT) print("Programming FM module!\n"); @@ -796,6 +797,8 @@ if __name__ == "__main__": if (command_tx == True): output(txLed, txLedOn) + print(txLed) + print(txLedOn) sleep(4.2) elif (mode == 'e'): print("Repeater") @@ -839,6 +842,8 @@ if __name__ == "__main__": # command_control_check() if (command_tx == True): output(txLed, txLedOn) + print(txLed) + print(txLedOn) 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 BPF.") From a53d701e620bda17d85af74119f7c8211512e01f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:09:33 -0400 Subject: [PATCH 346/402] Update rpitx.py set tx mode --- rpitx.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rpitx.py b/rpitx.py index e8fcf468..b20daee6 100644 --- a/rpitx.py +++ b/rpitx.py @@ -782,6 +782,10 @@ 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 + GPIO.setup(txLed, GPIO.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 &") 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 " + tx + "e6 -t float &") @@ -829,6 +833,10 @@ 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 + GPIO.setup(txLed, GPIO.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") From bc6a7fa2e4ec959475377740b5dab39db50054e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:17:30 -0400 Subject: [PATCH 347/402] Update main.c no LED control --- main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 9e6f1cb9..a985195d 100644 --- a/main.c +++ b/main.c @@ -340,15 +340,15 @@ int main(int argc, char * argv[]) { } } } - pinMode(txLed, OUTPUT); - digitalWrite(txLed, txLedOff); +// pinMode(txLed, OUTPUT); +// digitalWrite(txLed, txLedOff); #ifdef DEBUG_LOGGING - printf("Tx LED Off\n"); +// printf("Tx LED Off\n"); #endif - pinMode(onLed, OUTPUT); - digitalWrite(onLed, onLedOn); +// pinMode(onLed, OUTPUT); +// digitalWrite(onLed, onLedOn); #ifdef DEBUG_LOGGING - printf("Power LED On\n"); +// printf("Power LED On\n"); #endif /* if (mode == SSTV) { From 15ce3cf700ebbf7ec98a2e718c7744e5bfc60971 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:25:56 -0400 Subject: [PATCH 348/402] Update update add disable rpitx --- update | 2 ++ 1 file changed, 2 insertions(+) diff --git a/update b/update index 304bd83a..cc357886 100755 --- a/update +++ b/update @@ -66,6 +66,8 @@ else echo "no changes to cubesatsim.service." fi +sudo systemctl disable rpitx + if [[ $(diff systemd/rpitx.service /etc/systemd/system/rpitx.service) ]]; then echo "changed rpitx.service." sudo cp /home/pi/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service From 5cbfbfc5fd26565090c4f955d4ca9179f8f86524 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:29:55 -0400 Subject: [PATCH 349/402] Update config restart CubeSatSim then rpitx --- config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config b/config index b90679c2..c069e397 100755 --- a/config +++ b/config @@ -1431,8 +1431,9 @@ fi if [ "$restart" = "1" ] ; then if [ "$reboot" = "0" ] ; then echo "Restarting" - sudo systemctl stop rpitx +# sudo systemctl stop rpitx sudo systemctl restart cubesatsim + sudo systemctl restart rpitx else echo "Restart needed for changes to take effect" fi From 6507729e2a7158fc89513f22c8e4b91fdb2953f4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:33:49 -0400 Subject: [PATCH 350/402] Update config back to stop rpitx restart cubesatsim --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index c069e397..e8124b5f 100755 --- a/config +++ b/config @@ -1431,9 +1431,9 @@ fi if [ "$restart" = "1" ] ; then if [ "$reboot" = "0" ] ; then echo "Restarting" -# sudo systemctl stop rpitx + sudo systemctl stop rpitx sudo systemctl restart cubesatsim - sudo systemctl restart rpitx +# sudo systemctl restart rpitx else echo "Restart needed for changes to take effect" fi From 345dfd6c05f8b2c351b47c6659ed5525f4e086d0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:34:25 -0400 Subject: [PATCH 351/402] Update main.c start rpitx --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index a985195d..5f3c8062 100644 --- a/main.c +++ b/main.c @@ -124,7 +124,8 @@ int main(int argc, char * argv[]) { } // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); - FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); +// FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); + FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r"); pclose(rpitx_stop); // FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r"); From f8cd4c4c5c9487ca0c2ade1af42f5c53c0a4c435 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:41:01 -0400 Subject: [PATCH 352/402] Update main.c only start rpitx at start --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 5f3c8062..8544fb86 100644 --- a/main.c +++ b/main.c @@ -45,6 +45,8 @@ int main(int argc, char * argv[]) { fprintf(stderr, "Pi Zero 2 detected\n"); pi_zero_2_offset = 500; if (uptime_sec < 30.0) { + FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r"); + pclose(rpitx_stop); fprintf(stderr, "Sleep 5 sec"); sleep(5); // try sleep at start to help boot } @@ -63,6 +65,8 @@ int main(int argc, char * argv[]) { } } if (uptime_sec < 30.0) { + FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r"); + pclose(rpitx_stop); fprintf(stderr,"Sleep 10 sec"); sleep(10); } @@ -125,8 +129,7 @@ int main(int argc, char * argv[]) { // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); // FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); - FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r"); - pclose(rpitx_stop); + // FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r"); // pclose(cc_start); From 4b0ba7d66421bf2317fd15f6f2cf279c6c63238a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 14:41:53 -0400 Subject: [PATCH 353/402] Update config restart cubesatsim and rpitx --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index e8124b5f..c069e397 100755 --- a/config +++ b/config @@ -1431,9 +1431,9 @@ fi if [ "$restart" = "1" ] ; then if [ "$reboot" = "0" ] ; then echo "Restarting" - sudo systemctl stop rpitx +# sudo systemctl stop rpitx sudo systemctl restart cubesatsim -# sudo systemctl restart rpitx + sudo systemctl restart rpitx else echo "Restart needed for changes to take effect" fi From 530cb43d24e719f6d80851cca8cea8cb8f0f0404 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 16:38:46 -0400 Subject: [PATCH 354/402] Update command included killalls at the end --- command | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/command b/command index 599d800f..b8b53321 100755 --- a/command +++ b/command @@ -93,8 +93,6 @@ else fi sleep 5 - # sudo killall -9 direwolf - # sudo killall -9 rtl_fm fi rm out.txt else @@ -115,3 +113,7 @@ else fi fi + +sudo killall -9 direwolf &>/dev/null +sudo killall -9 rtl_fm &>/dev/null + From 700654fd8a0e94e62e84c885bb1ecd430dbb3000 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 23 Jul 2024 16:42:06 -0400 Subject: [PATCH 355/402] Update .gitignore added beacon_off --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 57339550..9065fc9a 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ telem_string.txt test transmit_dtmf uptime +beacon_off From e579f76f8c3e9b8e00d6450880a7035d1b2ffce1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 25 Jul 2024 10:40:52 -0400 Subject: [PATCH 356/402] Update rpitx.py adde extra GPIO for -b and -f --- rpitx.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rpitx.py b/rpitx.py index b20daee6..06ec932d 100644 --- a/rpitx.py +++ b/rpitx.py @@ -800,6 +800,8 @@ if __name__ == "__main__": # command_control_check() if (command_tx == True): + GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) print(txLed) print(txLedOn) @@ -849,6 +851,8 @@ if __name__ == "__main__": # output(txLed, txLedOff) # command_control_check() if (command_tx == True): + GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) print(txLed) print(txLedOn) From ac84af869e573e41a7a96c9c8ee9c4185a9856b4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 25 Jul 2024 10:54:22 -0400 Subject: [PATCH 357/402] Update rpitx.py add extra GPIO everywhere, remove command_control_check --- rpitx.py | 103 ++++++++++++++++++++----------------------------------- 1 file changed, 38 insertions(+), 65 deletions(-) diff --git a/rpitx.py b/rpitx.py index 06ec932d..39659d6b 100644 --- a/rpitx.py +++ b/rpitx.py @@ -9,54 +9,7 @@ from time import sleep import sys from os import system from PIL import Image, ImageDraw, ImageFont, ImageColor -import serial - -def command_control_check(): - - global command_control - global no_command - global debug_mode - global command_count - - return - - output(pd, 1) - output(ptt, 1) - sleep(1) - if (no_command == False and GPIO.input(squelch) == False): - print("carrier received!") - # command_tx = not command_tx -# print(command_tx) - - try: - 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: - if (debug_mode == 1): - print("Can't write command_count file!") - print("Command_count: ") - print(command_count) - - increment_mode() - -# if (command_tx == True): -# print("Turning on transmit") -# system("echo > command_tx True") -# output(txLed, txLedOn) -# sleep(0.5) -# output(txLed, txLedff) -# else: -# print("Turning off transmit") -# system("echo > command_tx False") - else: - print("No carrier received!") -# output(pd, 0) -# sleep(1) - +import serial def battery_saver_check(): try: @@ -435,12 +388,14 @@ if __name__ == "__main__": system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1") - command_control_check() +# command_control_check() # if (mode != ) and (command_tx == True): # if (command_tx == True): if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's')) and (command_tx == True) and (skip == False): # battery_saver_mode + GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) # if (txc): # output(pd, 1) @@ -472,7 +427,7 @@ if __name__ == "__main__": # if (len(sys.argv)) > 1: # print("There are arguments!") if (mode == 'a') or (mode == 'x') or (mode == 'n'): - command_control_check() +# command_control_check() output(pd, 1) output(ptt, 1) if (mode == 'a'): @@ -493,6 +448,8 @@ 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 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) # output(pd, 1) # output (ptt, 0) @@ -527,13 +484,13 @@ if __name__ == "__main__": sleep(0.5) except: - command_control_check() +# command_control_check() sleep(1) elif (mode == 'm'): system("touch /home/pi/CubeSatSim/cwready") print("CW") while True: - command_control_check() +# command_control_check() output (pd, 1) output (ptt, 1) try: @@ -547,6 +504,8 @@ 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 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) if (txc): @@ -564,7 +523,7 @@ if __name__ == "__main__": 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, txLedOff) - command_control_check() +# command_control_check() sleep(2) f.close() sleep(10) @@ -573,7 +532,7 @@ if __name__ == "__main__": sleep(1) elif (mode == 's'): print("SSTV") - command_control_check() +# command_control_check() output (ptt, 1) output(pd, 1) try: @@ -601,10 +560,12 @@ if __name__ == "__main__": file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") print("First SSTV stored image detected") system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") - command_control_check() +# command_control_check() 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 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) # battery_saver_check() @@ -626,7 +587,7 @@ if __name__ == "__main__": except: print("image 2 did not load - copy from CubeSatSim/sstv directory") while 1: - command_control_check() +# command_control_check() system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") @@ -654,16 +615,18 @@ if __name__ == "__main__": draw.text((120, 10), telem_string, font=font2, fill='white') img.save(file) - command_control_check() +# command_control_check() system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/camera_out.jpg") system("sudo rm /home/pi/CubeSatSim/camera_out.jpg > /dev/null 2>&1") - command_control_check() +# command_control_check() if (command_tx == True): print ("Sending SSTV image") output(txLed, txLedOn) + GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 + GPIO.setup(txLed, GPIO.OUT) # battery_saver_check() if (txc): @@ -686,17 +649,19 @@ if __name__ == "__main__": sleep(10) else: try: - command_control_check() + # command_control_check() file = open("/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg") print("First SSTV stored image detected") system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg") - command_control_check() +# command_control_check() 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 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) # battery_saver_check() @@ -720,7 +685,7 @@ if __name__ == "__main__": except: print("image 1 did not load - copy from CubeSatSim/sstv directory") try: - command_control_check() +# command_control_check() file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") print("Second SSTV stored image detected") @@ -728,10 +693,12 @@ if __name__ == "__main__": while 1: - command_control_check() +# command_control_check() 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 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) # battery_saver_check() @@ -758,8 +725,12 @@ if __name__ == "__main__": system("(while true; do (sleep 10 && cat /home/pi/CubeSatSim/wav/sstv.wav); done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") while 1: if (command_tx == True): - command_control_check() +# command_control_check() + output(txLed, txLedOn) + GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 + GPIO.setup(txLed, GPIO.OUT) + # battery_saver_check() if (txc): @@ -800,7 +771,7 @@ if __name__ == "__main__": # command_control_check() if (command_tx == True): - GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 + GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) print(txLed) @@ -818,6 +789,8 @@ if __name__ == "__main__": sleep(0.5) if (GPIO.input(squelch) == False): print("Carrier detected, starting repeater") + GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 + GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) # system("arecord -D hw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") system("arecord -D hw:CARD=Device,DEV=0 -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 " + tx + "e3 &") @@ -851,7 +824,7 @@ if __name__ == "__main__": # output(txLed, txLedOff) # command_control_check() if (command_tx == True): - GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 + GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) print(txLed) From 038cf1abfc6417d6350f6881b8414be6339aa8ce Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 25 Jul 2024 10:59:53 -0400 Subject: [PATCH 358/402] Update config reboot after mode -e --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index c069e397..062cc0b8 100755 --- a/config +++ b/config @@ -366,7 +366,7 @@ elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" sudo echo "a" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then restart=1 @@ -392,7 +392,7 @@ elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then restart=1 @@ -452,7 +452,7 @@ elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" sudo echo "s" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] ; then + if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then From cc5ff2541c012f657143448c7a81c12e69920ebc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 25 Jul 2024 11:17:48 -0400 Subject: [PATCH 359/402] Update rpitx.py fix sstv GPIO --- rpitx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpitx.py b/rpitx.py index 39659d6b..27c8e617 100644 --- a/rpitx.py +++ b/rpitx.py @@ -624,9 +624,9 @@ if __name__ == "__main__": if (command_tx == True): print ("Sending SSTV image") - output(txLed, txLedOn) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) + output(txLed, txLedOn) # battery_saver_check() if (txc): @@ -727,9 +727,9 @@ if __name__ == "__main__": if (command_tx == True): # command_control_check() - output(txLed, txLedOn) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) + output(txLed, txLedOn) # battery_saver_check() From 704a8e840ab5d76419d157ffcf99e031cebf3c65 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 25 Jul 2024 11:30:50 -0400 Subject: [PATCH 360/402] Update rpitx.py don't immediately transmit APRS in -n --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 27c8e617..39300e4d 100644 --- a/rpitx.py +++ b/rpitx.py @@ -437,7 +437,8 @@ if __name__ == "__main__": print("Transmit APRS Commands") # while True: # sleep(0.1) - system("touch /home/pi/CubeSatSim/ready") + if (mode != 'n'): + system("touch /home/pi/CubeSatSim/ready") while True: try: From fe7f69710d6bc85945b04b529692b7b92e1c5271 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 26 Jul 2024 09:42:59 -0400 Subject: [PATCH 361/402] Update main.h remove tx_freq_hz --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index eb82e27b..22435e83 100644 --- a/main.h +++ b/main.h @@ -61,7 +61,7 @@ #define ON 1 #define CHECK 0 -uint32_t tx_freq_hz = 434900000 + FREQUENCY_OFFSET; +//uint32_t tx_freq_hz = 434900000 + FREQUENCY_OFFSET; uint8_t data[1024]; uint32_t tx_channel = 0; From 491c12c3583b8933991172756530b6e2e624fa0e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 26 Jul 2024 09:43:35 -0400 Subject: [PATCH 362/402] Update main.c remove tx_freq_hz --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 8544fb86..3d40f63e 100644 --- a/main.c +++ b/main.c @@ -474,7 +474,7 @@ int main(int argc, char * argv[]) { eclipse_time -= period / 2; // if starting in eclipse, shorten interval } - tx_freq_hz -= tx_channel * 50000; + // tx_freq_hz -= tx_channel * 50000; if (transmit == FALSE) { From f0a5fe45c49fb1a4b7e5dd8e0a49d6611d4b4d79 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 26 Jul 2024 09:45:15 -0400 Subject: [PATCH 363/402] Update main.h add tx_freq_hz back --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index 22435e83..eb82e27b 100644 --- a/main.h +++ b/main.h @@ -61,7 +61,7 @@ #define ON 1 #define CHECK 0 -//uint32_t tx_freq_hz = 434900000 + FREQUENCY_OFFSET; +uint32_t tx_freq_hz = 434900000 + FREQUENCY_OFFSET; uint8_t data[1024]; uint32_t tx_channel = 0; From 97fa157b054b71168fef97eca6a5e433d69eae2e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 26 Jul 2024 09:54:47 -0400 Subject: [PATCH 364/402] Update update add WiringPi install --- update | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/update b/update index cc357886..45d7837a 100755 --- a/update +++ b/update @@ -18,7 +18,7 @@ if [ "$1" = "u" ]; then sudo apt-get update && sudo apt-get dist-upgrade -y - sudo apt-get install -y wiringpi git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev python3-pip minicom + sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev python3-pip minicom fi @@ -171,6 +171,27 @@ else cd fi +if [ ! -d "/home/pi/WiringPi" ]; then + + cd + + git clone https://github.com/PinkFreud/WiringPi + cd WiringPi + ./build debian + + sudo dpkg -i debian-template/wiringpi-2.61-1.deb + + cd + + cd CubeSatSim + make debug + + FLAG=1 + + cd + +fi + cd /home/pi/pi-power-button git checkout reboot-mode-change-beta > .updated_b From 004ab8ece48b39e02f0406b4d6e6823144591b89 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 27 Jul 2024 09:50:19 -0400 Subject: [PATCH 365/402] Update .gitignore added battery_saver --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9065fc9a..c904aa40 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ test transmit_dtmf uptime beacon_off +battery_saver + From 1191973ab63790e383cc74cf53a9b1045a981147 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 27 Jul 2024 09:56:21 -0400 Subject: [PATCH 366/402] Update config fixed typo in CubeSatSim --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 062cc0b8..96f6ef3e 100755 --- a/config +++ b/config @@ -807,7 +807,7 @@ elif [ "$1" = "-d" ]; then # reboot=1 sudo systemctl restart command if [[ $(arecord -l | grep card) ]]; then - echo "restarting cubesaatsim software" + echo "restarting cubesatsim software" sudo systemctl restart cubesatsim fi ## sudo reboot now From 9b0e6aac9e74a02d59268034655696e00b557191 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 27 Jul 2024 10:27:20 -0400 Subject: [PATCH 367/402] Update rpitx.py changed from 30 to 45 --- rpitx.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpitx.py b/rpitx.py index 39300e4d..061093bc 100644 --- a/rpitx.py +++ b/rpitx.py @@ -238,13 +238,13 @@ if __name__ == "__main__": system("cat /proc/uptime > /home/pi/CubeSatSim/uptime") file = open("/home/pi/CubeSatSim/uptime") up = file.read().split(" ")[0] -# print(up) + print(up) uptime = float(up) -# print(uptime) - if (uptime < 30): - print("Uptime < 30 seconds") + print(uptime) + if (uptime < 45): + print("Uptime < 45 seconds") else: - print("Uptime > 30 seconds") + print("Uptime > 45 seconds") skip = True file.close() except: From 637acd326260ebb4bf348066974e0b958514753c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 27 Jul 2024 12:32:37 -0400 Subject: [PATCH 368/402] Update install changed WiringPi to latest --- install | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/install b/install index 07b5516a..137b2fed 100755 --- a/install +++ b/install @@ -39,10 +39,17 @@ sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev l cd /tmp -wget https://project-downloads.drogon.net/wiringpi-latest.deb +# wget https://project-downloads.drogon.net/wiringpi-latest.deb -sudo dpkg -i wiringpi-latest.deb +# sudo dpkg -i wiringpi-latest.deb +cd + +git clone https://github.com/alanbjohnston/WiringPi +cd WiringPi +./build debian + +sudo dpkg -i debian-template/wiringpi-2.61-1.deb cd From 73e15d85b59dc4749688b5ec778ebc02884b279e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 27 Jul 2024 14:21:01 -0400 Subject: [PATCH 369/402] Update rpitx.py remove pin prints --- rpitx.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpitx.py b/rpitx.py index 061093bc..9f6acaf6 100644 --- a/rpitx.py +++ b/rpitx.py @@ -775,8 +775,8 @@ if __name__ == "__main__": GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) - print(txLed) - print(txLedOn) +# print(txLed) +# print(txLedOn) sleep(4.2) elif (mode == 'e'): print("Repeater") @@ -828,8 +828,8 @@ if __name__ == "__main__": GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4 GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) - print(txLed) - print(txLedOn) +# print(txLed) +# print(txLedOn) 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 BPF.") From ca847e8aaa8971b041921201cbd30917428635bf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 29 Jul 2024 11:41:35 -0400 Subject: [PATCH 370/402] Update update install rpitx if not present --- update | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/update b/update index 45d7837a..4b56ea4b 100755 --- a/update +++ b/update @@ -161,14 +161,23 @@ if [ ! -d "/home/pi/PiSSTVpp" ]; then fi -if [[ $(grep 'SYNCWITHPWM' /home/pi/rpitx/src/librpitx/src/fskburst.h) ]]; then - echo "rpitx already updated" +if [ ! -d "/home/pi/rpitx" ]; then + if [[ $(grep 'SYNCWITHPWM' /home/pi/rpitx/src/librpitx/src/fskburst.h) ]]; then + echo "rpitx already updated" + else + echo "updating rpitx" + cd /home/pi/rpitx + git pull + ./update.sh + cd + fi else - echo "updating rpitx" - cd /home/pi/rpitx - git pull - ./update.sh - cd + + cd + git clone https://github.com/alanbjohnston/rpitx.git + cd rpitx + ./install.sh + cd fi if [ ! -d "/home/pi/WiringPi" ]; then From 46b51ef16069d3424723b706e11190b347b3a59e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 29 Jul 2024 11:43:53 -0400 Subject: [PATCH 371/402] Update update fix reinstall rpitx --- update | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/update b/update index 4b56ea4b..2f74c9d8 100755 --- a/update +++ b/update @@ -162,6 +162,14 @@ if [ ! -d "/home/pi/PiSSTVpp" ]; then fi if [ ! -d "/home/pi/rpitx" ]; then + + cd + git clone https://github.com/alanbjohnston/rpitx.git + cd rpitx + ./install.sh + cd +else + if [[ $(grep 'SYNCWITHPWM' /home/pi/rpitx/src/librpitx/src/fskburst.h) ]]; then echo "rpitx already updated" else @@ -171,13 +179,6 @@ if [ ! -d "/home/pi/rpitx" ]; then ./update.sh cd fi -else - - cd - git clone https://github.com/alanbjohnston/rpitx.git - cd rpitx - ./install.sh - cd fi if [ ! -d "/home/pi/WiringPi" ]; then From e9cfe9339245c15e7a06be2ba0e489337d2e1f3a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 29 Jul 2024 11:50:21 -0400 Subject: [PATCH 372/402] Update update don't do full update for pi-power-button --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index 2f74c9d8..9c394257 100755 --- a/update +++ b/update @@ -277,7 +277,7 @@ git checkout reboot-mode-change-beta > .updated_b git checkout reboot-mode-change script/install - sudo apt-get update && sudo apt-get dist-upgrade -y +# sudo apt-get update && sudo apt-get dist-upgrade -y sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow From cfe1bddf62d80ca6544c375b698886b477351c3b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 29 Jul 2024 20:20:24 -0400 Subject: [PATCH 373/402] Update update remove dist-upgrades from updates --- update | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/update b/update index 9c394257..e8ef35af 100755 --- a/update +++ b/update @@ -16,7 +16,8 @@ sudo rm /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/id.txt /home/pi/CubeSa if [ "$1" = "u" ]; then - sudo apt-get update && sudo apt-get dist-upgrade -y +# sudo apt-get update && sudo apt-get dist-upgrade -y + sudo apt-get update -y sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev python3-pip minicom @@ -114,7 +115,8 @@ fi if [ ! -d "/home/pi/PiSSTVpp" ]; then - sudo apt-get update && sudo apt-get dist-upgrade -y +# sudo apt-get update && sudo apt-get dist-upgrade -y + sudo apt-get update -y sudo apt-get install -y python-picamera python3-picamera build-essential libgd-dev libmagic-dev @@ -278,6 +280,7 @@ git checkout reboot-mode-change-beta > .updated_b script/install # sudo apt-get update && sudo apt-get dist-upgrade -y + sudo apt-get update -y sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow From 57e4cb3fc3c2a2c4f70a38a18dff87508a830265 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 10:42:36 -0400 Subject: [PATCH 374/402] Update command add exit --- command | 1 + 1 file changed, 1 insertion(+) diff --git a/command b/command index b8b53321..9c3b6ad8 100755 --- a/command +++ b/command @@ -68,6 +68,7 @@ else echo "No RTL-SDR detected. Command and control is OFF" # sleep 60 + exit else From a090f88db65f4188e807434d419d48e8c1bbc7b6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 10:57:00 -0400 Subject: [PATCH 375/402] Update main.c remove checks --- main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 3d40f63e..52317bd2 100644 --- a/main.c +++ b/main.c @@ -278,9 +278,15 @@ int main(int argc, char * argv[]) { pclose(file); } - txLed = 0; // defaults for vB3 board without TFB - txLedOn = LOW; - txLedOff = HIGH; + txLed = 2; + txLedOn = HIGH; + txLedOff = LOW; + vB5 = TRUE; + onLed = 27; + onLedOn = HIGH; + onLedOff = LOW; + transmit = TRUE; +/* if (!ax5043) { pinMode(2, INPUT); pullUpDnControl(2, PUD_UP); @@ -344,6 +350,7 @@ int main(int argc, char * argv[]) { } } } + */ // pinMode(txLed, OUTPUT); // digitalWrite(txLed, txLedOff); #ifdef DEBUG_LOGGING From 8a0f9041a4ca7492ded06cec57cf52ef58deb808 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:01:06 -0400 Subject: [PATCH 376/402] Update main.c add back LPF check --- main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 52317bd2..9b55bd0c 100644 --- a/main.c +++ b/main.c @@ -285,7 +285,15 @@ int main(int argc, char * argv[]) { onLed = 27; onLedOn = HIGH; onLedOff = LOW; - transmit = TRUE; + + + pinMode(26, INPUT); + pullUpDnControl(26, PUD_UP); + + if (digitalRead(26) != HIGH) { + printf("v1 Present with UHF BPF\n"); + transmit = TRUE; + } /* if (!ax5043) { pinMode(2, INPUT); From 592dcd5a753036759d3de29c4cfa1aacc7cda5a4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:04:32 -0400 Subject: [PATCH 377/402] Update main.c changed band to low --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 9b55bd0c..1320ee83 100644 --- a/main.c +++ b/main.c @@ -493,7 +493,7 @@ int main(int argc, char * argv[]) { if (transmit == FALSE) { - fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); + fprintf(stderr, "\nNo CubeSatSim Low 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"); } From ab3d7815dbb69d457c20fbddf0bfa53c1cdf6aec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:06:36 -0400 Subject: [PATCH 378/402] Update rpitx.py change check and BPF to LPF --- rpitx.py | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/rpitx.py b/rpitx.py index 9f6acaf6..a0bc5d6e 100644 --- a/rpitx.py +++ b/rpitx.py @@ -157,30 +157,15 @@ GPIO.setup(green, GPIO.OUT) GPIO.output(powerPin, 1) transmit = False +txLed = 27 +txLedOn = 1 +txLedOff = 0 if GPIO.input(12) == False: - print("Version is v1 with UHF BPF") + print("Version is v1 with UHF LPF") transmit = True - txLed = 27 - txLedOn = 1 - txLedOff = 0 -elif GPIO.input(27) == False: - print("Version is TFB") - transmit = True - txLed = 22 - txLedOn = 0 - txLedOff = 1 -elif GPIO.input(13) == False: - print("Version is v1 with VHF BPF") - print("VHF transmit not imemented yet") -# transmit = True - txLed = 27 - txLedOn = 1 - txLedOff = 0 else: - print("No BPF") - txLed = 27 - txLedOn = 1 - txLedOff = 0 + print("No LPF") + # GPIO.setup(txLed, GPIO.OUT) # output(txLed, txLedOff) From 49e0b2cad991d344f9ad791c3e356cbed92a7c67 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:08:11 -0400 Subject: [PATCH 379/402] Update rpitx.py last BPF --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index a0bc5d6e..704d6eb9 100644 --- a/rpitx.py +++ b/rpitx.py @@ -817,6 +817,6 @@ if __name__ == "__main__": # print(txLedOn) 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 BPF.") + print("No Low Pass Filter so no telemetry transmit. See http://cubesatsim.org/wiki for instructions on how to build the LPF.") while 1: sleep(5) From 372e1af22ddb64d7a4855a414d2bffd13bca850b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:22:56 -0400 Subject: [PATCH 380/402] Update main.c change to detecting Pi Zero or not --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 1320ee83..09bb45fd 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,7 @@ int main(int argc, char * argv[]) { char resbuffer[1000]; - const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902120'"; + const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000c1'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); @@ -39,10 +39,10 @@ int main(int argc, char * argv[]) { fprintf(stderr, " %x ", resbuffer[0]); fprintf(stderr, " %x \n", resbuffer[1]); - if ((resbuffer[0] == '9') && (resbuffer[1] == '0')) + if ((resbuffer[0] != '9') || (resbuffer[1] != '0')) { // voltageThreshold = 3.7; - fprintf(stderr, "Pi Zero 2 detected\n"); + fprintf(stderr, "Pi Zero not detected (could be Pi Zero 2)\n"); pi_zero_2_offset = 500; if (uptime_sec < 30.0) { FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r"); From b6a480d4d22806611afd820105e577a0b3887c17 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:42:21 -0400 Subject: [PATCH 381/402] Update main.c detect Pi Zero or Pi Zero W --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 09bb45fd..8b343a7b 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,7 @@ int main(int argc, char * argv[]) { char resbuffer[1000]; - const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000c1'"; + const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); From 960c763df284a06ea1ec7c5255c870e7b24c9163 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:50:32 -0400 Subject: [PATCH 382/402] Update main.c fix camera test --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 8b343a7b..bc3e5ca6 100644 --- a/main.c +++ b/main.c @@ -414,7 +414,7 @@ int main(int argc, char * argv[]) { char camera_present[] = "supported=1 detected=1"; // printf("strstr: %s \n", strstr( & cmdbuffer1, camera_present)); camera = (strstr( (const char *)& cmdbuffer, camera_present) != NULL) ? ON : OFF; - // printf("Camera result:%s camera: %d \n", & cmdbuffer1, camera); + printf("Camera result:%s camera: %d \n", & cmdbuffer1, camera); pclose(file4); #ifdef DEBUG_LOGGING @@ -422,7 +422,7 @@ int main(int argc, char * argv[]) { #endif FILE * file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg > /dev/null 2>&1", "r"); - file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1", "r"); + //file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1", "r"); pclose(file5); if (!ax5043) // don't test for payload if AX5043 is present From 4d7cc5041056473aa73ae6e0760272ba41454e12 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:51:49 -0400 Subject: [PATCH 383/402] Update main.c camera fix --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index bc3e5ca6..68ad9833 100644 --- a/main.c +++ b/main.c @@ -414,7 +414,7 @@ int main(int argc, char * argv[]) { char camera_present[] = "supported=1 detected=1"; // printf("strstr: %s \n", strstr( & cmdbuffer1, camera_present)); camera = (strstr( (const char *)& cmdbuffer, camera_present) != NULL) ? ON : OFF; - printf("Camera result:%s camera: %d \n", & cmdbuffer1, camera); + printf("Camera result:%s camera: %d \n", & cmdbuffer, camera); pclose(file4); #ifdef DEBUG_LOGGING From bf3f114582c6c001ca67e0e2212fc7e607b96f25 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 12:04:25 -0400 Subject: [PATCH 384/402] Update main.c change to 9000 for Pi Zero test --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 68ad9833..15a31e6d 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,8 @@ int main(int argc, char * argv[]) { char resbuffer[1000]; - const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'"; +// const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'"; + const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); @@ -39,7 +40,7 @@ int main(int argc, char * argv[]) { fprintf(stderr, " %x ", resbuffer[0]); fprintf(stderr, " %x \n", resbuffer[1]); - if ((resbuffer[0] != '9') || (resbuffer[1] != '0')) + if ((resbuffer[0] != '9') || (resbuffer[1] != '0') || (resbuffer[2] != '0') || (resbuffer[3] != '0')) { // voltageThreshold = 3.7; fprintf(stderr, "Pi Zero not detected (could be Pi Zero 2)\n"); From 387d878b774dfc4f644f2b5f442ff7bf1ba6b8c0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 17:43:01 -0400 Subject: [PATCH 385/402] Update dtmf_aprs_cc.py change -o to use config --- dtmf_aprs_cc.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index a77a65b0..063c26bd 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -47,20 +47,22 @@ if __name__ == "__main__": change_mode = True if ((line.find("MODE=o")) > 0) or ((line.find("DTMF>APDW15:t10#")) > 0): system("echo '\nBeacon Mode toggle!!\n'") - try: - fm = open("/home/pi/CubeSatSim/beacon_off") - fm.close() - system("echo 'Beacon is off, turning it ON'") - system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") - except: - system("echo 'Beacon is on, turning it OFF'") - system("touch /home/pi/CubeSatSim/beacon_off") - - system("echo 'Restarting rpitx'") - system("sudo systemctl restart rpitx") -# system("echo 'Resuming rpitx'") -# system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") - change_mode = False + mode = 'o' + change_mode = True +# try: +# fm = open("/home/pi/CubeSatSim/beacon_off") +# fm.close() +# system("echo 'Beacon is off, turning it ON'") +# system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") +# except: +# system("echo 'Beacon is on, turning it OFF'") +# system("touch /home/pi/CubeSatSim/beacon_off") +# +# system("echo 'Restarting rpitx'") +# system("sudo systemctl restart rpitx") +## system("echo 'Resuming rpitx'") +## system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") +# change_mode = False if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) From 1a8d40965db28bce3e7b0cf09e6b58d9f1861af6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 17:48:06 -0400 Subject: [PATCH 386/402] Update dtmf_aprs_cc.py fix APRS force --- dtmf_aprs_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 063c26bd..8abe7c49 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -132,7 +132,7 @@ if __name__ == "__main__": sleep(0.1) GPIO.output(powerPin, 1) sleep(1) - else: + elseif: mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) From cdf25da3557ecd89cc432456d2529d6c1cdfccb8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 17:49:02 -0400 Subject: [PATCH 387/402] Update dtmf_aprs_cc.py else if typo --- dtmf_aprs_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 8abe7c49..cbf65aad 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -132,7 +132,7 @@ if __name__ == "__main__": sleep(0.1) GPIO.output(powerPin, 1) sleep(1) - elseif: + elif: mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) From 082d396171858726dd353efb841ec02b76c47bd9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 17:51:08 -0400 Subject: [PATCH 388/402] Update dtmf_aprs_cc.py fix else --- dtmf_aprs_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index cbf65aad..6a2a23f8 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -132,7 +132,7 @@ if __name__ == "__main__": sleep(0.1) GPIO.output(powerPin, 1) sleep(1) - elif: + elif (mode == 'a'): mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) From 665602b6075dffaf5a05c0c8164a5ddba5a0d5ec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 19:19:38 -0400 Subject: [PATCH 389/402] Update dtmf_aprs_cc.py skip every other command --- dtmf_aprs_cc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 6a2a23f8..c402eed8 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -12,6 +12,7 @@ if __name__ == "__main__": txLed = 27 change_mode = False debug_mode = False + counter = 0 if (len(sys.argv)) > 1: # print("There are arguments!") if ('d' == sys.argv[1]): @@ -63,7 +64,8 @@ if __name__ == "__main__": ## system("echo 'Resuming rpitx'") ## system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") # change_mode = False - if (debug_mode == False) and (change_mode == True): + counter = (counter + 1) % 2 + if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other command since Direwolf prints them twice GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(powerPin, GPIO.OUT) From 0a2915ea799896f1a9f33f589f753c0e0b8637cb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 00:05:28 -0400 Subject: [PATCH 390/402] Update dtmf_aprs_cc.py add counter to ignore duplicate APRS message --- dtmf_aprs_cc.py | 58 +++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index c402eed8..8bd638ee 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -12,7 +12,7 @@ if __name__ == "__main__": txLed = 27 change_mode = False debug_mode = False - counter = 0 + counter = 1 if (len(sys.argv)) > 1: # print("There are arguments!") if ('d' == sys.argv[1]): @@ -26,46 +26,58 @@ if __name__ == "__main__": # if '^c' == line.rstrip(): # break - if ((line.find("MODE=a")) > 0) or ((line.find("DTMF>APDW15:t1#")) > 0): + if ((line.find("MODE=a")) > 0): system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True - if ((line.find("MODE=f")) > 0) or ((line.find("DTMF>APDW15:t2#")) > 0): + counter = (counter + 1) % 2 + 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 + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t2#")) > 0): system("echo '\nFSK Mode!!\n'") mode = 'f' change_mode = True - if ((line.find("MODE=b")) > 0) or ((line.find("DTMF>APDW15:t3#")) > 0): + if ((line.find("MODE=b")) > 0): + system("echo '\nBPSK Mode!!\n'") + mode = 'b' + change_mode = True + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t3#")) > 0): system("echo '\nBPSK Mode!!\n'") mode = 'b' change_mode = True - if ((line.find("MODE=s")) > 0) or ((line.find("DTMF>APDW15:t4#")) > 0): + if ((line.find("MODE=s")) > 0): + system("echo '\nSSTV Mode!!\n'") + mode = 's' + change_mode = True + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t4#")) > 0): system("echo '\nSSTV Mode!!\n'") mode = 's' change_mode = True - if ((line.find("MODE=m")) > 0) or ((line.find("DTMF>APDW15:t5#")) > 0): + if ((line.find("MODE=m")) > 0): system("echo '\nCW Mode!!\n'") mode = 'm' change_mode = True - if ((line.find("MODE=o")) > 0) or ((line.find("DTMF>APDW15:t10#")) > 0): + counter = (counter + 1) % 2 + if ((line.find("MODE=o")) > 0): system("echo '\nBeacon Mode toggle!!\n'") mode = 'o' change_mode = True -# try: -# fm = open("/home/pi/CubeSatSim/beacon_off") -# fm.close() -# system("echo 'Beacon is off, turning it ON'") -# system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") -# except: -# system("echo 'Beacon is on, turning it OFF'") -# system("touch /home/pi/CubeSatSim/beacon_off") -# -# system("echo 'Restarting rpitx'") -# system("sudo systemctl restart rpitx") -## system("echo 'Resuming rpitx'") -## system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") -# change_mode = False - counter = (counter + 1) % 2 - if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other command since Direwolf prints them twice + counter = (counter + 1) % 2 + 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 GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(powerPin, GPIO.OUT) From 749747b00d2c61e83a58e89012de9f8bbb66c9e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 08:42:34 -0400 Subject: [PATCH 391/402] Update dtmf_aprs_cc.py don't stop CubeSatSim --- dtmf_aprs_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 8bd638ee..c1b67831 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -172,7 +172,7 @@ if __name__ == "__main__": GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") - system("sudo systemctl stop cubesatsim") +# system("sudo systemctl stop cubesatsim") print("\n/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode) From 0ef63453d6bcf7a4fd612c1edac79eef769eb3b1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 09:13:03 -0400 Subject: [PATCH 392/402] Update config -F restart rpitx only --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index 96f6ef3e..200e61c3 100755 --- a/config +++ b/config @@ -1126,11 +1126,11 @@ elif [ "$1" = "-F" ]; then # echo # else echo -## echo "Restarting CubeSatSim with new configuration file" + echo "Restarting CubeSatSim with new configuration file" ## echo - reboot=1 +# reboot=1 ## sudo reboot now -# sudo systemctl restart rpitx + sudo systemctl restart rpitx # fi elif [ "$1" = "-o" ]; then From d7ee8b9daaa162f521979ad0784e875dad6c4434 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 09:18:58 -0400 Subject: [PATCH 393/402] Update config -q restart rpitx only --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index 200e61c3..cc3a27a9 100755 --- a/config +++ b/config @@ -987,12 +987,12 @@ elif [ "$1" = "-q" ]; then echo $1 $2 $3 $4 $5 $sq $7 $8 $9 ${10} ${11} echo $1 $2 $3 $4 $4 $sq $7 $8 $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg echo -## echo "Rebooting CubeSatSim with new configuration file" + echo "Restarting CubeSatSim with new configuration file" ## echo - reboot=1 +# reboot=1 ## sudo reboot now -# sudo systemctl restart cubesatsim + sudo systemctl restart rpitx elif [ "$1" = "-Q" ]; then From 4c7a302a384a822c740c877cf790a01d38117090 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 09:21:12 -0400 Subject: [PATCH 394/402] Update config added space --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index cc3a27a9..2f5bdeb7 100755 --- a/config +++ b/config @@ -25,7 +25,7 @@ function transmit_command_aprs { sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 echo $STRING > /home/pi/CubeSatSim/t.txt echo - echo -n "Sending APRS packet to change mode to APRS" + echo -n "Sending APRS packet to change mode to APRS " echo $STRING sudo touch /home/pi/CubeSatSim/ready sleep 3 From 1fcb0b23cceb5a17976485b52a6b5e562247675f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 09:35:17 -0400 Subject: [PATCH 395/402] Update direwolf-transmit-dtmf-beacon.conf fix 10 # --- direwolf/direwolf-transmit-dtmf-beacon.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf/direwolf-transmit-dtmf-beacon.conf b/direwolf/direwolf-transmit-dtmf-beacon.conf index 305000a7..6c022dea 100644 --- a/direwolf/direwolf-transmit-dtmf-beacon.conf +++ b/direwolf/direwolf-transmit-dtmf-beacon.conf @@ -2,4 +2,4 @@ ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0 MYCALL AMSAT CHANNEL 0 MODEM 1200 -CBEACON dest="DTMF-3" info="1 0 #" delay=0 +CBEACON dest="DTMF-3" info="10 #" delay=0 From 50dd29d265e3c11ff2d0f346a28bf102cefacb5a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 09:45:17 -0400 Subject: [PATCH 396/402] Update dtmf_aprs_cc.py add 5# mode --- dtmf_aprs_cc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index c1b67831..824a6258 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -67,6 +67,10 @@ if __name__ == "__main__": mode = 'm' change_mode = True counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t5#")) > 0): + system("echo '\nCW Mode!!\n'") + mode = 'm' + change_mode = True if ((line.find("MODE=o")) > 0): system("echo '\nBeacon Mode toggle!!\n'") mode = 'o' From af48b5c71459360ce1b8b7887c28097fb2fd1252 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 16:59:35 -0400 Subject: [PATCH 397/402] Update rpitx.py changed -e mode --- rpitx.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpitx.py b/rpitx.py index 704d6eb9..991052f6 100644 --- a/rpitx.py +++ b/rpitx.py @@ -779,7 +779,9 @@ if __name__ == "__main__": GPIO.setup(txLed, GPIO.OUT) output(txLed, txLedOn) # system("arecord -D hw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") - system("arecord -D hw:CARD=Device,DEV=0 -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 " + tx + "e3 &") +## system("arecord -D hw:CARD=Device,DEV=0 -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 " + tx + "e3 &") + 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 &") + system("arecord -D hw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") GPIO.output(powerPin, 1) sleep(1) GPIO.output(powerPin, 0) @@ -787,7 +789,8 @@ if __name__ == "__main__": sleep(1) print("No carrier detected, stopping repeater") output(txLed, txLedOff) - system("sudo killall -9 arecord") + system("sudo killall -9 arecord") + system("sudo killall -9 nc") else: print("FSK") From b681ec37246c028bb78ba8de5d5ce8db0baea184 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 17:08:00 -0400 Subject: [PATCH 398/402] Update rpitx.py kill rpitx --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 991052f6..cf7994a9 100644 --- a/rpitx.py +++ b/rpitx.py @@ -763,7 +763,7 @@ if __name__ == "__main__": # print(txLed) # print(txLedOn) sleep(4.2) - elif (mode == 'e'): + elif (mode == 'e'): # code based on https://zr6aic.blogspot.com/2016/11/creating-2m-fm-repeater-with-raspberry.html print("Repeater") print("Stopping command and control") system("sudo systemctl stop command") @@ -791,6 +791,7 @@ if __name__ == "__main__": output(txLed, txLedOff) system("sudo killall -9 arecord") system("sudo killall -9 nc") + system("sudo killall -9 rpitx") else: print("FSK") From ac056a55a4638390fff53a27181f9917bf4ade49 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 17:10:01 -0400 Subject: [PATCH 399/402] Update rpitx.py plghw:1 --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index cf7994a9..f34f94d8 100644 --- a/rpitx.py +++ b/rpitx.py @@ -781,7 +781,7 @@ if __name__ == "__main__": # system("arecord -D hw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") ## system("arecord -D hw:CARD=Device,DEV=0 -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 " + tx + "e3 &") 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 &") - system("arecord -D hw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") + system("arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") GPIO.output(powerPin, 1) sleep(1) GPIO.output(powerPin, 0) From bd8fda70cd381ebbc1bb0616c32804232a39361a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 17:11:31 -0400 Subject: [PATCH 400/402] Update rpitx.py sudo arecord --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index f34f94d8..a7f89091 100644 --- a/rpitx.py +++ b/rpitx.py @@ -781,7 +781,7 @@ if __name__ == "__main__": # system("arecord -D hw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") ## system("arecord -D hw:CARD=Device,DEV=0 -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 " + tx + "e3 &") 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 &") - system("arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") + system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") GPIO.output(powerPin, 1) sleep(1) GPIO.output(powerPin, 0) From b78a7406015b96354f48cf2b38bfa7b7bbf37fb5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 17:13:56 -0400 Subject: [PATCH 401/402] Update rpitx.py add 1 sec sleep after nc --- rpitx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rpitx.py b/rpitx.py index a7f89091..72742ddb 100644 --- a/rpitx.py +++ b/rpitx.py @@ -781,6 +781,7 @@ if __name__ == "__main__": # system("arecord -D hw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") ## system("arecord -D hw:CARD=Device,DEV=0 -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 " + tx + "e3 &") 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 &") + sleep(1) system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") GPIO.output(powerPin, 1) sleep(1) From a3276fd667fb241f7af909399498acbb3e2b77dd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 20:27:54 -0400 Subject: [PATCH 402/402] Update rpitx.py sleep 0.5 in mode e --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 72742ddb..92db4929 100644 --- a/rpitx.py +++ b/rpitx.py @@ -784,7 +784,7 @@ if __name__ == "__main__": sleep(1) system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") GPIO.output(powerPin, 1) - sleep(1) + sleep(0.5) GPIO.output(powerPin, 0) while (GPIO.input(squelch) == False): sleep(1)