altosdroid: Add map types and map preloading UIs
[fw/altos] / ao-bringup / turnon_telemega
1 #!/bin/sh
2
3 if [ -x /usr/bin/ao-flash-stm ]; then
4         FLASH_STM=/usr/bin/ao-flash-stm
5 else
6         echo "Can't find ao-flash-stm!  Aborting."
7         exit 1
8 fi
9
10 if [ -x /usr/bin/ao-usbload ]; then
11         USBLOAD=/usr/bin/ao-usbload
12 else
13         echo "Can't find ao-usbload!  Aborting."
14         exit 1
15 fi
16
17 VERSION=1.0
18 REPO=~/altusmetrumllc/Binaries
19
20 echo "TeleMega v$VERSION Turn-On and Calibration Program"
21 echo "Copyright 2014 by Bdale Garbee.  Released under GPL v2"
22 echo
23 echo "Expectations:"
24 echo "\tTeleMega v$VERSION powered from USB"
25 echo "\t\twith ST-Link-V2 cabled to debug header"
26 echo "\t\twith coax from UHF to frequency counter"
27 echo
28 echo -n "TeleMega-$VERSION serial number: "
29 read SERIAL
30
31 echo $FLASH_STM
32
33 $FLASH_STM $REPO/loaders/telemega-v$VERSION*.elf || exit 1
34
35 sleep 5
36
37 $USBLOAD --serial=$SERIAL $REPO/telemega-v$VERSION*.elf || exit 1
38
39 sleep 5
40
41 dev=`ao-list | awk '/TeleMega-v'"$VERSION"'/ { print $3; exit(0); }'`
42
43 case "$dev" in
44 /dev/tty*)
45         echo "TeleMega found on $dev"
46         ;;
47 *)
48         echo 'No TeleMega-v'"$VERSION"' found'
49         exit 1
50         ;;
51 esac
52
53 echo 'E 0' > $dev
54
55 SERIAL=$SERIAL ./cal-freq $dev
56
57 ../ao-tools/ao-cal-accel/ao-cal-accel $dev
58
59 echo 'E 1' > $dev
60
61 ./test-telemega
62
63 exit $?