Merge pull request #367 from alanbjohnston/fc-mic

Cross Band Repeater improvements with C2C
pull/368/head
Alan Johnston 7 months ago committed by GitHub
commit 6b1c6f3a82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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
}
}

@ -2,6 +2,8 @@
echo -e "\nCommand and Control script for CubeSatSim v2.1\n" echo -e "\nCommand and Control script for CubeSatSim v2.1\n"
sudo modprobe snd-aloop
FILE=/home/pi/CubeSatSim/command_control FILE=/home/pi/CubeSatSim/command_control
if [ -f "$FILE" ]; then if [ -f "$FILE" ]; then
echo "Radio command and control is ON" echo "Radio command and control is ON"

@ -1,2 +1,2 @@
ADEVICE hw:CARD=Device,DEV=0 default ADEVICE shared_mic hw:CARD=Loopback,DEV=1
DTMF DTMF

@ -825,10 +825,6 @@ if __name__ == "__main__":
while True: while True:
if (GPIO.input(squelch) == False) and (command_tx == True): if (GPIO.input(squelch) == False) and (command_tx == True):
print("Carrier detected, starting repeater") 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.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT) GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn) 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 &") 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) sleep(0.5)
# system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &") # 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) # GPIO.output(powerPin, 1)
# sleep(0.5) # sleep(0.5)
# GPIO.output(powerPin, 0) # GPIO.output(powerPin, 0)
@ -852,11 +848,6 @@ if __name__ == "__main__":
system("sudo /etc/init.d/alsa-utils stop") system("sudo /etc/init.d/alsa-utils stop")
system("sudo /etc/init.d/alsa-utils start") system("sudo /etc/init.d/alsa-utils start")
print("Finished resetting audio") 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: else:

@ -35,7 +35,7 @@ if [ "$1" = "u" ]; then
fi 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 sudo sed -i 's/update.sh/update /g' /etc/motd
@ -119,6 +119,21 @@ else
FLAG=1 FLAG=1
fi 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 FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
if [ ! -f "$FILE" ]; then if [ ! -f "$FILE" ]; then
echo "Copying SSTV image 1." echo "Copying SSTV image 1."
@ -260,8 +275,12 @@ elif [ ! -f "/home/pi/fctelem/v0.2" ]; then
FLAG=1 FLAG=1
fi fi
if [ ! -d "/home/pi/fcdctl" ]; then if [ ! -f "/home/pi/fcdctl/fcdctl" ]; then
echo "Installing fcdctl to set FunCubeDongle Pro gain" 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 git clone https://github.com/csete/fcdctl.git
cd fcdctl cd fcdctl
make fcdpp make fcdpp
@ -269,7 +288,7 @@ fi
cd /home/pi/pi-power-button cd /home/pi/pi-power-button
git checkout master # git checkout master
git pull --no-rebase > .updated_p git pull --no-rebase > .updated_p
@ -278,11 +297,12 @@ git checkout master
echo "updating pi-power-button." echo "updating pi-power-button."
git checkout 7-modes
script/install script/install
FLAG=1 FLAG=1
else else
echo "nothing to do for pi-power-button." echo "nothing to do for pi-power-button."
fi fi

Loading…
Cancel
Save

Powered by TurnKey Linux.