diff --git a/asound.conf b/asound.conf new file mode 100644 index 00000000..783b59f7 --- /dev/null +++ b/asound.conf @@ -0,0 +1,46 @@ +pcm.!default { + type asym + playback.pcm "softvol" + capture.pcm "shared_mic" +} + +ctl.!default { + type hw + card 2 +} + +# Playback with software volume and mixing +pcm.softvol { + type softvol + slave.pcm "shared_speaker" + control { + name "Master" + card 2 + } +} + +pcm.shared_speaker { + type dmix + ipc_key 1024 + slave { + pcm "hw:2,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:2,0" +# channels 1 + rate 48000 + period_time 0 + period_size 1024 + buffer_size 4096 + } +} 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" 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 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") diff --git a/update b/update index f350f979..e4d95acb 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 @@ -119,6 +119,21 @@ else FLAG=1 fi +FILE=/etc/asound.conf +if [ -f "$FILE" ]; then + if [[ $(diff /home/pi/CubeSatSim/asound.conf /etc/asound.conf) ]]; then + echo "changed /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/asound.conf /etc/asound.conf + FLAG=1 +fi + FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then echo "Copying SSTV image 1." @@ -260,8 +275,12 @@ elif [ ! -f "/home/pi/fctelem/v0.2" ]; then FLAG=1 fi -if [ ! -d "/home/pi/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 + sudo apt-get install -y python3-smbus libusb-1.0 + cd git clone https://github.com/csete/fcdctl.git cd fcdctl make fcdpp @@ -269,7 +288,7 @@ fi cd /home/pi/pi-power-button -git checkout master +# git checkout master git pull --no-rebase > .updated_p @@ -277,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