setpower.sh

#!/bin/bash

DEV=/dev/ttyUSB0

POWER="$1"

USBMOD="$2"

test -n "$POWER" || POWER=60

test -n "$USBMOD" || USBMOD=30

# Sanity tests:

test $POWER -ge 0 -a $POWER -le 100 || POWER=100

# Scaled to 0-255:

POWER=$(($POWER * 256 / 100))

USBMOD=$(($USBMOD * 256 / 100))

test $POWER -eq 256 && POWER=255

# Extract the individual bytes:

PBYTE1=$(($POWER / 100))

PBYTE2=$(($POWER % 100))

UBYTE1=$(($USBMOD / 100))

UBYTE2=$(($USBMOD % 100))

(

stty raw 19200

echo -n -e "\xfe\xfe\x94\xe0\x14\x0a\x$PBYTE1\x$PBYTE2\xfd"

#set USB modulation level

echo -n -e "\xfe\xfe\x94\xe0\x1A\x05\x00\x65\x$UBYTE1\x$UBYTE2\xfd"

) < $DEV > $DEV

agc

#!/bin/bash

set +x

DEV=/dev/ttyUSB0

(

stty raw 19200

case $1 in

#set AGC off

OFF) echo -n -e "\xfe\xfe\x94\xe0\x16\x12\x00\xfd" ;;

FAST) echo -n -e "\xfe\xfe\x94\xe0\x16\x12\x01\xfd" ;;

MID) echo -n -e "\xfe\xfe\x94\xe0\x16\x12\x02\xfd" ;;

SLOW) echo -n -e "\xfe\xfe\x94\xe0\x16\x12\x03\xfd" ;;

esac

) < $DEV > $DEV

datamod

#!/bin/bash

set +x

DEV=/dev/ttyUSB0

#sleep 2

if [ $# = 0 ]

then

echo "Usage: datamod USB|ACC"

fi

(

stty raw 19200

case $1 in

"USB") echo -n -e "\xfe\xfe\x94\xe0\x1A\x05\x00\x67\x03\xfd" ;;

#Set Data Mode ACC

"ACC") echo -n -e "\xfe\xfe\x94\xe0\x1A\x05\x00\x67\x01\xfd" ;;

esac

) < $DEV > $DEV

 

tuner

#!/bin/bash

set +x

DEV=/dev/ttyUSB0

(

stty raw 19200

#set TUNER on

echo -n -e "\xfe\xfe\x94\xe0\x1A\x05\x00\x34\x01\xfd"

echo -n -e "\xfe\xfe\x94\xe0\x1A\x05\x00\x35\x01\xfd"

echo -n -e "\xfe\xfe\x94\xe0\x1C\x01\x01\xfd"

echo -n -e "\xfe\xfe\x94\xe0\x1C\x01\x02\xfd"

) < $DEV > $DEV

 

txcvr

#!/bin/bash

set +x

DEV=/dev/ttyUSB0

#echo '$1 is ' $1

#sleep 2

(

stty raw 19200

case $1 in

"OFF") echo -n -e "\xfe\xfe\x94\xe0\x18\x00\xfd" ;;

#Turn Txcvr OFF

"ON") echo -n -e "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\x94\xe0\x18\x01\xfd" ;;

#Turn Txcvr On

esac

) < $DEV > $DEV