altosuilib: Don't match product_altusmetrum for product_basestation or product_altimeter
[fw/altos] / ao-bringup / turnon_teleminiv2
1 #!/bin/sh
2
3 if [ -x ../ao-tools/ao-load/ao-load ]; then
4         AOLOAD=../ao-tools/ao-load/ao-load
5 elif [ -x /usr/bin/ao-load ]; then
6         AOLOAD=/usr/bin/ao-load
7 else
8         echo "Can't find ao-load!  Aborting."
9         exit 1
10 fi
11
12 if [ -x ../ao-tools/ao-rawload/ao-rawload ]; then
13         RAWLOAD=../ao-tools/ao-rawload/ao-rawload
14 elif [ -x /usr/bin/ao-rawload ]; then
15         RAWLOAD=/usr/bin/ao-rawload
16 else
17         echo "Can't find ao-rawload!  Aborting."
18         exit 1
19 fi
20
21 echo "TeleMini v2.0 Turn-On and Calibration Program"
22 echo "Copyright 2011 by Bdale Garbee.  Released under GPL v2"
23 echo "Copyright 2013 by Keith Packard.  Released under GPL v2"
24 echo
25 echo "Expectations:"
26 echo "\tTeleMini v2.0 powered from LiPo"
27 echo "\t\twith TeleDongle (on /dev/ttyACM0) cabled to debug header"
28 echo "\t\twith frequency counter able to sample RF output"
29 echo
30 echo -n "TeleMini serial number: "
31 read SERIAL
32
33 echo $RAWLOAD
34
35 #TTY=/dev/ttyACM0
36 PROGRAMMER="-D 186"
37 BIN=../src/telemini-v2.0*.ihx
38
39 $RAWLOAD $PROGRAMMER -r ao_led_blink.ihx
40 echo "LEDs should be blinking"
41 sleep 5
42
43 $RAWLOAD $PROGRAMMER -r ao_radio_xmit.ihx
44 echo -n "Generating RF carrier.  Please enter measured frequency: "
45 read FREQ
46
47 CAL_VALUE=`nickle -e "floor(434.55 / $FREQ * 1186611 + 0.5)"`
48
49 echo "Programming flash with cal value " $CAL_VALUE
50 $AOLOAD $PROGRAMMER --cal=$CAL_VALUE $BIN $SERIAL
51
52 echo "Serial number "$SERIAL" programmed with RF cal value "$CAL_VALUE
53 echo "Unplug and replug USB, cu to the board, confirm freq and record power"