From f1c607340a2367436c06e5364b19ea101bd7066f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:19:29 -0400 Subject: [PATCH 01/16] Update direwolf-cc.conf added shared_mic --- direwolf-cc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direwolf-cc.conf b/direwolf-cc.conf index 8419355f..26f8805b 100644 --- a/direwolf-cc.conf +++ b/direwolf-cc.conf @@ -1,2 +1,2 @@ -ADEVICE hw:CARD=Device,DEV=0 default +ADEVICE shared_mic hw:CARD=Loopback,DEV=1 DTMF From b064d0bcade47d6dbfa547d484a1c0f0a6e750fd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:21:38 -0400 Subject: [PATCH 02/16] Create asoundrc with dsnoop --- asoundrc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 asoundrc diff --git a/asoundrc b/asoundrc new file mode 100644 index 00000000..70e18d2c --- /dev/null +++ b/asoundrc @@ -0,0 +1,46 @@ +pcm.!default { + type asym + playback.pcm "softvol" + capture.pcm "shared_mic" +} + +ctl.!default { + type hw + card 1 +} + +# Playback with software volume and mixing +pcm.softvol { + type softvol + slave.pcm "shared_speaker" + control { + name "Master" + card 1 + } +} + +pcm.shared_speaker { + type dmix + ipc_key 1024 + slave { + pcm "hw:1,0" + rate 48000 + period_time 0 + period_size 1024 + buffer_size 4096 + } +} + +# Recording with input mixing +pcm.shared_mic { + type dsnoop + ipc_key 2048 + slave { + pcm "hw:1,0" +# channels 1 + rate 48000 + period_time 0 + period_size 1024 + buffer_size 4096 + } +} From 33e1a3fdc9b7db1efbfd7d0e1f50b62f84e5de18 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:25:12 -0400 Subject: [PATCH 03/16] Update transmit.py repeater mode shared_mic dsnoop --- transmit.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/transmit.py b/transmit.py index b079cc52..5923afc4 100644 --- a/transmit.py +++ b/transmit.py @@ -825,10 +825,6 @@ if __name__ == "__main__": while True: if (GPIO.input(squelch) == False) and (command_tx == True): print("Carrier detected, starting repeater") - if (no_command == False): - sleep(3) # wait 3 seconds before repeater mode in case it is C2C command - print("stopping C2C") - system("sudo systemctl stop command") 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) @@ -837,7 +833,7 @@ if __name__ == "__main__": system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1 &") sleep(0.5) # system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") - system("sudo arecord -D plughw:CARD=Device,DEV=0 -r48000 -fS16_LE -c1 | nc localhost 8011 &") + system("sudo arecord -D shared_mic -r48000 -fS16_LE -c1 | nc localhost 8011 &") # GPIO.output(powerPin, 1) # sleep(0.5) # GPIO.output(powerPin, 0) @@ -852,12 +848,7 @@ if __name__ == "__main__": system("sudo /etc/init.d/alsa-utils stop") system("sudo /etc/init.d/alsa-utils start") print("Finished resetting audio") - if (no_command == False): - system("sudo systemctl restart command") - print("restarting C2C") -# print("Waiting for C2C") -# sleep(4) # wait 4 seconds for a C2C command - print("Ready to detect carrier") + print("Ready to detect carrier") else: print("FSK") From 692a3421acdbcc24bd146fdb1ab5a65458d3e48c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:27:59 -0400 Subject: [PATCH 04/16] Update command added snd-aloop --- command | 2 ++ 1 file changed, 2 insertions(+) diff --git a/command b/command index 0527403a..f4c96b1d 100755 --- a/command +++ b/command @@ -2,6 +2,8 @@ echo -e "\nCommand and Control script for CubeSatSim v2.1\n" +sudo modprobe snd-aloop + FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then echo "Radio command and control is ON" From 80492c6c2669ce6af41f4b3a9b3a20bcc940e9aa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 10:55:25 -0400 Subject: [PATCH 05/16] Update update with .asoundrc check and update --- update | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/update b/update index f350f979..6c8b2646 100755 --- a/update +++ b/update @@ -119,6 +119,21 @@ else FLAG=1 fi +FILE=/root/.asoundrc +if [ -f "$FILE" ]; then + if [[ $(diff /home/pi/CubeSatSim/asoundrc /root/.asoundrc) ]]; then + echo "changed .asoundrc for root user." + sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc + FLAG=1 + else + echo "no change to .asoundrc for root user." + fi +else + echo "creating .asoundrc for root user." + sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc + FLAG=1 +fi + FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then echo "Copying SSTV image 1." From 74e8d6da30b83087ef4b36bb617e13ba3a11808d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:01:21 -0400 Subject: [PATCH 06/16] Update update add sudo su for root .asoundrc --- update | 2 ++ 1 file changed, 2 insertions(+) diff --git a/update b/update index 6c8b2646..a7273cf1 100755 --- a/update +++ b/update @@ -119,6 +119,7 @@ else FLAG=1 fi +sudo su FILE=/root/.asoundrc if [ -f "$FILE" ]; then if [[ $(diff /home/pi/CubeSatSim/asoundrc /root/.asoundrc) ]]; then @@ -133,6 +134,7 @@ else sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc FLAG=1 fi +su pi FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then From c9570bac116489159995fbd3280a41450b64cbb9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:12:50 -0400 Subject: [PATCH 07/16] Update update changed to /etc/asound.conf --- update | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/update b/update index a7273cf1..73223bdb 100755 --- a/update +++ b/update @@ -119,22 +119,20 @@ else FLAG=1 fi -sudo su -FILE=/root/.asoundrc +FILE=/etc/asound.conf if [ -f "$FILE" ]; then - if [[ $(diff /home/pi/CubeSatSim/asoundrc /root/.asoundrc) ]]; then - echo "changed .asoundrc for root user." - sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc + if [[ $(diff /home/pi/CubeSatSim/asoundrc /etc/asound.conf) ]]; then + echo "changed /etc/asound.conf." + sudo cp /home/pi/CubeSatSim/asoundrc /etc/asound.conf FLAG=1 else - echo "no change to .asoundrc for root user." + echo "no change to /etc/asound.conf." fi else - echo "creating .asoundrc for root user." - sudo cp /home/pi/CubeSatSim/asoundrc /root/.asoundrc + echo "creating /etc/asound.conf." + sudo cp /home/pi/CubeSatSim/asoundrc /etc/asound.conf FLAG=1 fi -su pi FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then From bd3ff8fe724c7621b5a2129e1546cc45f5999db2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:13:45 -0400 Subject: [PATCH 08/16] Update update more asound.conf --- update | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/update b/update index 73223bdb..fb7f8c44 100755 --- a/update +++ b/update @@ -121,16 +121,16 @@ fi FILE=/etc/asound.conf if [ -f "$FILE" ]; then - if [[ $(diff /home/pi/CubeSatSim/asoundrc /etc/asound.conf) ]]; then + if [[ $(diff /home/pi/CubeSatSim/asound.conf /etc/asound.conf) ]]; then echo "changed /etc/asound.conf." - sudo cp /home/pi/CubeSatSim/asoundrc /etc/asound.conf + sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf FLAG=1 else echo "no change to /etc/asound.conf." fi else echo "creating /etc/asound.conf." - sudo cp /home/pi/CubeSatSim/asoundrc /etc/asound.conf + sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf FLAG=1 fi From df451a81cb4a778fe5c5e3cd08204f2802c8adb5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:14:27 -0400 Subject: [PATCH 09/16] Rename asoundrc to asound.conf --- asoundrc => asound.conf | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename asoundrc => asound.conf (100%) diff --git a/asoundrc b/asound.conf similarity index 100% rename from asoundrc rename to asound.conf From f9c2ced703e280c7f5d5c50199fadedb106ec4da Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 May 2025 11:18:54 -0400 Subject: [PATCH 10/16] Update asound.conf changed to card 2 --- asound.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/asound.conf b/asound.conf index 70e18d2c..783b59f7 100644 --- a/asound.conf +++ b/asound.conf @@ -6,7 +6,7 @@ pcm.!default { ctl.!default { type hw - card 1 + card 2 } # Playback with software volume and mixing @@ -15,7 +15,7 @@ pcm.softvol { slave.pcm "shared_speaker" control { name "Master" - card 1 + card 2 } } @@ -23,7 +23,7 @@ pcm.shared_speaker { type dmix ipc_key 1024 slave { - pcm "hw:1,0" + pcm "hw:2,0" rate 48000 period_time 0 period_size 1024 @@ -36,7 +36,7 @@ pcm.shared_mic { type dsnoop ipc_key 2048 slave { - pcm "hw:1,0" + pcm "hw:2,0" # channels 1 rate 48000 period_time 0 From 3a810d0df97f54a6de24285472f0a59945ec5160 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 09:12:02 -0400 Subject: [PATCH 11/16] Update update fix libusb install --- update | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update b/update index fb7f8c44..6dd73073 100755 --- a/update +++ b/update @@ -35,7 +35,8 @@ if [ "$1" = "u" ]; then fi -sudo apt-get install -y python3-smbus libusb-1.0 +#sudo apt-get install -y python3-smbus libusb-1.0 +sudo apt-get install -y python3-smbus libusb* sudo sed -i 's/update.sh/update /g' /etc/motd From 9c37b47f929eddaf557503c264ee0557ae5a058b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 09:23:38 -0400 Subject: [PATCH 12/16] Update update back to libusb-1.0 --- update | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/update b/update index 6dd73073..fb7f8c44 100755 --- a/update +++ b/update @@ -35,8 +35,7 @@ if [ "$1" = "u" ]; then fi -#sudo apt-get install -y python3-smbus libusb-1.0 -sudo apt-get install -y python3-smbus libusb* +sudo apt-get install -y python3-smbus libusb-1.0 sudo sed -i 's/update.sh/update /g' /etc/motd From fb2bcd804df30c57a7b13de3064053b60b216baa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 09:27:18 -0400 Subject: [PATCH 13/16] Update update cd before fcdctl --- update | 1 + 1 file changed, 1 insertion(+) diff --git a/update b/update index fb7f8c44..73019e76 100755 --- a/update +++ b/update @@ -277,6 +277,7 @@ fi if [ ! -d "/home/pi/fcdctl" ]; then echo "Installing fcdctl to set FunCubeDongle Pro gain" + cd git clone https://github.com/csete/fcdctl.git cd fcdctl make fcdpp From 9a98ea5742f2dbc394dab65ea2a8ca293bfca8df Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 13:07:49 -0400 Subject: [PATCH 14/16] Update update fixed libusb and 7-modes --- update | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/update b/update index 73019e76..ef87ec0d 100755 --- a/update +++ b/update @@ -35,7 +35,7 @@ if [ "$1" = "u" ]; then fi -sudo apt-get install -y python3-smbus libusb-1.0 +# sudo apt-get install -y python3-smbus libusb-1.0 sudo sed -i 's/update.sh/update /g' /etc/motd @@ -277,6 +277,9 @@ fi if [ ! -d "/home/pi/fcdctl" ]; then echo "Installing fcdctl to set FunCubeDongle Pro gain" + sudo rm /var/lib/dpkg/info/python3-pip.list + sudo apt install python3-pip --reinstall + sudo apt-get install -y python3-smbus libusb-1.0 cd git clone https://github.com/csete/fcdctl.git cd fcdctl @@ -285,7 +288,7 @@ fi cd /home/pi/pi-power-button -git checkout master +# git checkout master git pull --no-rebase > .updated_p @@ -293,12 +296,13 @@ git checkout master if [[ $(grep 'changed' /home/pi/pi-power-button/.updated_p) ]]; then echo "updating pi-power-button." + + git checkout 7-modes script/install FLAG=1 - else echo "nothing to do for pi-power-button." fi From c67c759d324a40eb465aebd6be7e07d9b296d612 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 13:10:17 -0400 Subject: [PATCH 15/16] Update update fixed fcdctl install --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index ef87ec0d..b12c73c9 100755 --- a/update +++ b/update @@ -275,7 +275,7 @@ elif [ ! -f "/home/pi/fctelem/v0.2" ]; then FLAG=1 fi -if [ ! -d "/home/pi/fcdctl" ]; then +if [ ! -d "/home/pi/fcdctl/fcdctl" ]; then echo "Installing fcdctl to set FunCubeDongle Pro gain" sudo rm /var/lib/dpkg/info/python3-pip.list sudo apt install python3-pip --reinstall From e063ac688d4e7bf0b1d67fdf2ce20c26616128de Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 May 2025 13:16:45 -0400 Subject: [PATCH 16/16] Update update fix fcdctl update --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index b12c73c9..e4d95acb 100755 --- a/update +++ b/update @@ -275,7 +275,7 @@ elif [ ! -f "/home/pi/fctelem/v0.2" ]; then FLAG=1 fi -if [ ! -d "/home/pi/fcdctl/fcdctl" ]; then +if [ ! -f "/home/pi/fcdctl/fcdctl" ]; then echo "Installing fcdctl to set FunCubeDongle Pro gain" sudo rm /var/lib/dpkg/info/python3-pip.list sudo apt install python3-pip --reinstall