#!/bin/bash # 00 00 * * * /home/nathan/tools/setmode.sh 30 40 80 >> /tmp/setmode.log # 00 03 * * * /home/nathan/tools/setmode.sh 160 80 40 >> /tmp/setmode.log # 00 06 * * * /home/nathan/tools/setmode.sh 30 40 80 >> /tmp/setmode.log # 00 09 * * * /home/nathan/tools/setmode.sh 40 17 15 >> /tmp/setmode.log # 00 12 * * * /home/nathan/tools/setmode.sh 30 40 12 >> /tmp/setmode.log # 00 15 * * * /home/nathan/tools/setmode.sh 10 17 40 >> /tmp/setmode.log # 00 18 * * * /home/nathan/tools/setmode.sh 15 10 40 >> /tmp/setmode.log # 00 21 * * * /home/nathan/tools/setmode.sh 40 30 17 >> /tmp/setmode.log echo -e "\n\nStarting setmode" date BANDS=$@ if [ "$#" -gt 3 ]; then echo "Must specify only up to 3 bands as we always set the first reciever group to whatever band aux is currently" echo "Running with no specified bands means the first group will be set to whatever aux is" exit 1 fi # AUX is the extra reciever added to hook into WSJT-X using DIGIU and a VAC etc AUXRECV="51114" IP="192.168.9.52" AUXFREQ=$(echo 'f' | nc -w 1 $IP $AUXRECV) if [[ $AUXFREQ =~ ^-?[0-9]+$ ]] ; then echo "AUX frequency $AUXFREQ" else echo "Failed to fetch aux frequency" exit 1 fi if [[ $AUXFREQ =~ ^1......$ ]] ; then AUXBAND=160 elif [[ $AUXFREQ =~ ^3......$ ]] ; then AUXBAND=80 elif [[ $AUXFREQ =~ ^7......$ ]] ; then AUXBAND=40 elif [[ $AUXFREQ =~ ^10......$ ]] ; then AUXBAND=30 elif [[ $AUXFREQ =~ ^14......$ ]] ; then AUXBAND=20 elif [[ $AUXFREQ =~ ^18......$ ]] ; then AUXBAND=17 elif [[ $AUXFREQ =~ ^21......$ ]] ; then AUXBAND=15 elif [[ $AUXFREQ =~ ^24......$ ]] ; then AUXBAND=12 elif [[ $AUXFREQ =~ ^28......$ ]] ; then AUXBAND=10 else echo "Could not identify aux frequency" exit 1 fi echo "AUX band: $AUXBAND" for BAND in $BANDS ; do if [ $BAND -eq $AUXBAND ] ; then FOUND=1 echo "Found one specified band which is the same as the aux reciever" break fi done BANDS="$AUXBAND $BANDS" echo "Band list is now: $BANDS" # this is for if we want to specify all 4 bands as paramters but check one of them matches aux #if [ "x$FOUND" == "x1" ] ; then # echo "Found a specified band ($BAND) which matches aux band ($AUXBAND)" #else # echo "ERROR: None of the specified bands match the AUX band ($AUXBAND)" # exit 1 #fi RECV1FT8="51111" RECV2FT8="51112" RECV3FT8="51113" RECV4FT8="51115" RECV1FT4="51116" RECV2FT4="51117" RECV3FT4="51118" RECV4FT4="51119" RECV1WSPR="51120" RECV2WSPR="51121" RECV3WSPR="51122" RECV4WSPR="51123" FT8160="1840000" FT880="3573000" FT840="7074000" FT830="10136000" FT820="14074000" FT817="18100000" FT815="21074000" FT812="24915000" FT810="28074000" FT4160="1840000" # not real FT480="3568000" FT440="7047500" FT430="10140000" FT420="14080000" FT417="18104000" FT415="21140000" FT412="24919000" FT410="28180000" WSPR160="1836600" WSPR80="3568600" WSPR40="7038600" WSPR30="10138700" WSPR20="14095600" WSPR17="18104600" WSPR15="21094600" WSPR12="24924600" WSPR10="28124600" let GROUP=0 for BAND in $BANDS ; do echo ((GROUP++)) echo "Band: $BAND" echo "Group: $GROUP" for MODE in FT8 FT4 WSPR ; do echo "Mode: $MODE" FREQ=$MODE$BAND PORT=RECV$GROUP$MODE echo "Frequency ${!FREQ}" echo "Port: ${!PORT}" echo F ${!FREQ} | nc -w 1 $IP ${!PORT} >/dev/null echo M $MODE | nc -w 1 $IP ${!PORT} >/dev/null done done # this fixes a weird issue where the aux reciever fails to tune after changing the others so we change it and then set back again echo F $(($AUXFREQ + 1)) | nc -w 1 $IP $AUXRECV >/dev/null echo F $AUXFREQ | nc -w 1 $IP $AUXRECV >/dev/null echo -e "\nEnded setmode" exit 0