Merge pull request #448 from alanbjohnston/master-bu

MicVolume fixes
master-b4
Alan Johnston 3 weeks ago committed by GitHub
commit 7d08ae6622
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

1
.gitignore vendored

@ -51,6 +51,7 @@ direwolf-pacsatsim-tmp.conf
groundstation/direwolf-pacsat-tmp.conf
tlm.bin
frequency.txt
freq.txt
logb.txt
logo.txt
logp.txt

@ -1,6 +1,6 @@
#!/bin/bash
echo -e "\nCommand and Control script for CubeSatSim v2.2\n"
echo -e "\nCommand and Control script for CubeSatSim v2.3\n"
sudo modprobe snd-aloop
@ -61,6 +61,7 @@ FILE=/home/pi/CubeSatSim/command_control_direwolf
if [[ $(arecord -l | grep "USB Audio Device") ]] && [ -f "$FILE" ]; then
echo "Starting Direwolf DTMF and APRS Command and Control"
/home/pi/CubeSatSim/config -L 200
if [ "$debug" = "1" ]; then

@ -1579,6 +1579,26 @@ elif [ "$1" = "-L" ]; then
echo "Set microphone level for command and control"
echo
CARDUSB=$(aplay -l | grep "Device" | grep -oP '(?<=card )\d{1,2}')
USBCARD=${CARDUSB:0:1}
CARD=$(grep -oP '(?<=card )\d{1,2}' /etc/asound.conf)
if [ -z $USBCARD ] ; then
echo "No USB sound card detected"
else
echo "USB sound card is card" $USBCARD
echo "asound.conf is card" $CARD
if [ ! "$USBCARD" == "$CARD" ] ; then
echo "Change card number in /etc/asound.conf"
sudo sed -i "s/card $CARD/card $USBCARD/g" /etc/asound.conf
echo "/etc/asound.conf has been updated to:"
cat /etc/asound.conf
echo "reinitializing alsa"
sudo alsactl init
fi
fi
if [ -z "$param2" ] ; then
echo -e "Enter microphone level (integer 0 - 255): "
read mic
@ -1587,10 +1607,12 @@ elif [ "$1" = "-L" ]; then
fi
if ! [ -z $mic ] && [[ $mic =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
systemctl --user stop wireplumber
# systemctl --user stop wireplumber
echo "Updating mic level to" $mic "%"
value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c ${2:0:1} set MicVolume $mic
systemctl --user start wireplumber
# value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c ${2:0:1} set MicVolume $mic
value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c $USBCARD sset 'MicVolume' $mic
# systemctl --user start wireplumber
else
echo "Not updating mic level"
fi

@ -46,9 +46,7 @@ fi
if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
echo "USB Sound Card detected"
soundcard=1
systemctl --user stop wireplumber
amixer -c 2 set MicVolume 200
systemctl --user start wireplumber
/home/pi/CubeSatSim/config -L 200
else
echo "No USB Sound Card detected"
soundcard=0

@ -354,20 +354,20 @@ fi
/home/pi/CubeSatSim/config -V 2 # set maxcpus to 2
FILE=/etc/modprobe.d/alsa-base.conf
if [ -f "$FILE" ]; then
echo "$FILE exists."
if [[ $(grep "options snd-usb-audio index=2" $FILE) ]]; then
echo "options snd-usb-audio index=2 already in $FILE";
else
echo "adding options snd-usb-audio index=2 to $FILE";
sudo sed -i '$a options snd-usb-audio index=2' $FILE
echo "options snd-usb-audio index=2" | sudo tee -a $FILE # > /dev/null
fi
else
echo "creating $FILE"
echo "options snd-usb-audio index=2" | sudo tee $FILE # > /dev/null
fi
# FILE=/etc/modprobe.d/alsa-base.conf
# if [ -f "$FILE" ]; then
# echo "$FILE exists."
# if [[ $(grep "options snd-usb-audio index=2" $FILE) ]]; then
# echo "options snd-usb-audio index=2 already in $FILE";
# else
# echo "adding options snd-usb-audio index=2 to $FILE";
# sudo sed -i '$a options snd-usb-audio index=2' $FILE
# echo "options snd-usb-audio index=2" | sudo tee -a $FILE # > /dev/null
# fi
# else
# echo "creating $FILE"
# echo "options snd-usb-audio index=2" | sudo tee $FILE # > /dev/null
# fi
FILE=/home/pi/CubeSatSim/sim.cfg
if [ -f "$FILE" ]; then

@ -41,9 +41,8 @@ fi
if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
echo "USB Sound Card detected"
soundcard=1
systemctl --user stop wireplumber
amixer -c 2 set MicVolume 200
systemctl --user start wireplumber
/home/pi/CubeSatSim/config -L 200
else
echo "No USB Sound Card detected"
soundcard=0

Loading…
Cancel
Save

Powered by TurnKey Linux.