1
0
mirror of https://github.com/km4ack/patmenu2.git synced 2025-05-19 08:10:12 -07:00

clean up code

This commit is contained in:
KM4ACK 2022-11-16 11:40:40 -06:00
parent 1e55185698
commit 3f839a11d1

View File

@ -14,9 +14,7 @@ MAIN=$MYPATH/patmenu
source $MYPATH/config
#verify we have rig control
if [ $RIGCONTROL == 'no' ]
then
if [ $RIGCONTROL == 'no' ]; then
yad --title="NO RIG CONTROL" --width=400 --height=100 \
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
--center --form --text="\r\r\r\rRig Control is needed for auto pat.\rPlease configure rig control and try again." \
@ -55,8 +53,7 @@ STARTRIG () {
#start rigctld & restart pat
PIDCTL=$(pidof rigctld)
WHO=$(whoami)
if [ -z "$PIDCTL" ]
then
if [ -z "$PIDCTL" ]; then
CONTROL=$(echo $RIG | sed 's/rigctl/rigctld/')
$CONTROL &
sudo -A systemctl restart pat@$WHO
@ -65,8 +62,7 @@ WHO=$(whoami)
STARTRIG
if [ -z "$PIDCTL" ]
then
if [ -z "$PIDCTL" ]; then
STARTRIG
fi
@ -90,45 +86,37 @@ exit 0
}
#check if distance is empty and give direction
if [ -z "$1" ]
then
if [ -z "$1" ]; then
directions
fi
#check if band is empty and give direction
if [ -z "$2" ]
then
if [ -z "$2" ]; then
directions
fi
#Check for min distance
if [ -z "$3" ]
then
if [ -z "$3" ]; then
MIN=0
else
MIN=$3
fi
#take $2 as band to use
if [ $2 = "20" ]
then
if [ $2 = "20" ]; then
FILE=$VARALIST"20mvaralist.txt"
elif [ $2 = "30" ]
then
elif [ $2 = "30" ]; then
FILE=$VARALIST"30mvaralist.txt"
elif [ $2 = "40" ]
then
elif [ $2 = "40" ]; then
FILE=$VARALIST"40mvaralist.txt"
elif [ $2 = "80" ]
then
elif [ $2 = "80" ]; then
FILE=$VARALIST"80mvaralist.txt"
fi
#Verify we have a list to work with
test -f $FILE
FILERESULT=$(echo $?)
if [ $FILERESULT = "1" ]
then
if [ $FILERESULT = "1" ]; then
echo "FILE DOESN'T EXIST."
yad --title="NO LIST" --width=400 --height=100 \
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
@ -146,11 +134,15 @@ BUT=$?
fi
fi
if [ $AMRRON = "no" ]
then
if [ $AMRRON = "no" ]; then
#start varaHF modem
echo "Starting VARA-HF modem"
/usr/local/bin/wine $HOME/.wine/drive_c/VARA/VARA.exe > /dev/null 2>&1 &
/usr/bin/wine $HOME/.wine/drive_c/VARA/VARA.exe > /dev/null 2>&1 &
echo "standby while the modem starts....."
sleep 10 #give vara time to start
else
echo "Starting VARA-HF modem"
/usr/bin/wine $HOME/.wine/drive_c/VARA/VARA.exe > /dev/null 2>&1 &
echo "standby while the modem starts....."
sleep 10 #give vara time to start
fi
@ -160,8 +152,7 @@ connect () {
pat connect $CALL
#Check if connection was successful
RESULTS=$(echo $?)
if [ $RESULTS = "0" ]
then
if [ $RESULTS = "0" ]; then
echo "A connection was made"
echo $DATE" "$CALL" Success with autopat" >> $LOG
CALL=$(echo "$CALL" | sed 's/&/ /')
@ -171,8 +162,7 @@ yad --title="SUCCESS" --width=300 --height=100 \
--center --form --text="<b>Successfully connected!</b>\r$CALL\r\rSee mylog in documents\rdirectory for more details." \
--button=gtk-ok
if [ $AMRRON = "no" ]
then
if [ $AMRRON = "no" ]; then
sudo -A killall direwolf piardopc kissattach piARDOP_GUI rigctld > /dev/null 2>&1
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')
kill -9 $VARA > /dev/null 2>&1
@ -215,8 +205,7 @@ echo "Will Attempt to Connect to This Station"
while read LINE
do DISTANCE=$(echo $LINE | awk '{ print $1 }')
CALL=$(echo $LINE | awk '{ print $2 }')
if [ $DISTANCE -lt "$1" ] && [ $DISTANCE -gt "$MIN" ]
then
if [ $DISTANCE -lt "$1" ] && [ $DISTANCE -gt "$MIN" ]; then
echo "Distance="$DISTANCE " Call="$CALL
#call the connect funtion
connect
@ -227,8 +216,7 @@ done < $HOME/tempardop/sorted.txt
#remove temp directory & files
rm -rf $HOME/tempardop
if [ $AMRRON = "no" ]
then
if [ $AMRRON = "no" ]; then
sudo -A killall direwolf piardopc kissattach piARDOP_GUI rigctld > /dev/null 2>&1
sudo -A rfcomm release /dev/rfcomm0 > /dev/null 2>&1
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')