altos: Clean up -Wextra warnings
[fw/altos] / ao-bringup / turnon_telebt
1 #!/bin/sh
2
3 # serial number of the TeleDongle being used as the flash programmer
4 DONGLE=612
5
6 if [ -x ../ao-tools/ao-load/ao-load ]; then
7         AOLOAD=../ao-tools/ao-load/ao-load
8 elif [ -x /usr/bin/ao-load ]; then
9         AOLOAD=/usr/bin/ao-load
10 else
11         echo "Can't find ao-load!  Aborting."
12         exit 1
13 fi
14
15 if [ -x ../ao-tools/ao-rawload/ao-rawload ]; then
16         RAWLOAD=../ao-tools/ao-rawload/ao-rawload
17 elif [ -x /usr/bin/ao-rawload ]; then
18         RAWLOAD=/usr/bin/ao-rawload
19 else
20         echo "Can't find ao-rawload!  Aborting."
21         exit 1
22 fi
23
24 echo "TeleBT v1.1 Turn-On and Calibration Program"
25 echo "Copyright 2013 by Bdale Garbee.  Released under GPL v2"
26 echo
27 echo "Expectations:"
28 echo "\tTeleBT v1.1 powered from USB"
29 echo "\t\twith TeleDonlge (on /dev/ttyACM0) cabled to debug header"
30 echo "\t\twith coax from SMA to frequency counter"
31 echo
32 echo -n "TeleBT serial number: "
33 read SERIAL
34
35 echo $RAWLOAD
36
37 $RAWLOAD -D $DONGLE -r ao_led_blink.ihx
38 echo "LEDs should be blinking"
39 sleep 5
40
41 $RAWLOAD -D $DONGLE -r ao_radio_xmit.ihx
42 echo -n "Generating RF carrier.  Please enter measured frequency: "
43 read FREQ
44
45 CAL_VALUE=`nickle -e "floor(434.55 / $FREQ * 1186611 + 0.5)"`
46
47 echo "Programming flash with cal value " $CAL_VALUE
48 $AOLOAD -D $DONGLE --cal $CAL_VALUE /usr/share/altos/stable/telebt-v1.0*.ihx $SERIAL
49
50 echo "Serial number "$SERIAL" programmed with RF cal value "$CAL_VALUE
51 echo "Unplug debug cable, power cycle, cu to the board, confirm freq and record power"