3 if [ -x ../ao-tools/ao-flash/ao-flash-lpc ]; then
4 FLASH_LPC=../ao-tools/ao-flash/ao-flash-lpc
5 elif [ -x /usr/bin/ao-flash-lpc ]; then
6 FLASH_LPC=/usr/bin/ao-flash-lpc
8 echo "Can't find ao-flash-lpc! Aborting."
12 if [ -x /usr/bin/ao-usbload ]; then
13 USBLOAD=/usr/bin/ao-usbload
15 echo "Can't find ao-usbload! Aborting."
20 PRODUCT_NAME=TeleDongle
23 echo "$PRODUCT_NAME v$VERSION Turn-On and Calibration Program"
24 echo "Copyright © 2015 by Bdale Garbee. Released under GPL v2"
27 echo "\t$PRODUCT_NAME v$VERSION powered from USB"
28 echo "\t\twith ST-Link-V2 cabled to debug header"
29 echo "\t\twith coax from UHF to frequency counter"
35 echo "$PRODUCT-$VERSION serial number: $SERIAL"
38 echo -n "$PRODUCT-$VERSION serial number: "
42 echo "Usage: $0 <serial-number>" 1>&2
47 BINARIES=$HOME/altusmetrumllc/Binaries
49 LOADER="$BINARIES/loaders/$PRODUCT-v$VERSION-"*.elf
50 ALTOS="$BINARIES/$PRODUCT-v$VERSION"*.elf
52 $FLASH_LPC $LOADER || exit 1
56 $USBLOAD --serial=$SERIAL $ALTOS || exit 1
60 dev=`ao-list | awk '/TeleDongle-v'"$VERSION"'/ { print $3; exit(0); }'`
64 echo "TeleDongle found on $dev"
67 echo 'No TeleDongle-v'"$VERSION"' found'
74 SERIAL=$SERIAL ./cal-freq $dev
80 echo "Frequency calibration failed"
85 CAL_VALUE=`grep "^$SERIAL," cal_values | tail -1 | sed 's/^[^,]*,//'`
91 echo "Invalid calibration value: $CAL_VALUE"
96 echo "Reflashing with calibration: $CAL_VALUE"
98 $USBLOAD --cal=$CAL_VALUE --tty=$dev $ALTOS || exit 1
100 echo "$PRODUCT_NAME-v$VERSION $SERIAL is ready to ship"