use firmware in /usr/share/altos for teledongle, update telemetrum for v2.0
[fw/altos] / ao-bringup / turnon_telemetrum
1 #!/bin/sh
2
3 if [ -x ../ao-tools/ao-stmload/ao-stmload ]; then
4         STMLOAD=../ao-tools/ao-stmload/ao-stmload
5 elif [ -x /usr/bin/ao-stmload ]; then
6         STMLOAD=/usr/bin/ao-stmload
7 else
8         echo "Can't find ao-stmload!  Aborting."
9         exit 1
10 fi
11
12 if [ -x ../ao-tools/ao-usbload/ao-usbload ]; then
13         USBLOAD=../ao-tools/ao-usbload/ao-usbload
14 elif [ -x /usr/bin/ao-usbload ]; then
15         USBLOAD=/usr/bin/ao-usbload
16 else
17         echo "Can't find ao-usbload!  Aborting."
18         exit 1
19 fi
20
21 VERSION=2.0
22
23 echo "TeleMetrum v$VERSION Turn-On and Calibration Program"
24 echo "Copyright 2014 by Bdale Garbee.  Released under GPL v2"
25 echo
26 echo "Expectations:"
27 echo "\tTeleMetrum 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"
30 echo
31 echo -n "TeleMetrum-$VERSION serial number: "
32 read SERIAL
33
34 echo $STMLOAD
35
36 $STMLOAD --raw ../src/telemetrum-v$VERSION/flash-loader/*.elf || exit 1
37
38 sleep 2
39
40 $USBLOAD --serial=$SERIAL /usr/share/altos/telemetrum-v$VERSION*.ihx || exit 1
41
42 sleep 2
43
44 dev=`ao-list | awk '/TeleMetrum-v'"$VERSION"'/ { print $3; exit(0); }'`
45
46 case "$dev" in
47 /dev/tty*)
48         echo "TeleMetrum found on $dev"
49         ;;
50 *)
51         echo 'No TeleMetrum-v'"$VERSION"' found'
52         exit 1
53         ;;
54 esac
55
56 echo 'E 0' > $dev
57
58 SERIAL=$SERIAL ./cal-freq $dev
59
60 ./cal-accel $dev