3c24aa215e7ee502bc04253ec60fbbacc8a9721a
[fw/altos] / ao-bringup / turnon_easymini
1 #!/bin/sh
2
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
7 else
8         echo "Can't find ao-flash-lpc!  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=1.0
22 PRODUCT=EasyMini
23 #VERSION=0.1
24
25 echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
26 echo "Copyright 2010 by Bdale Garbee.  Released under GPL v2"
27 echo
28 echo "Expectations:"
29 echo "\t$PRODUCT v$VERSION powered from USB"
30 echo "\t\twith ST-Link-V2 cabled to debug header"
31 echo
32 echo -n "$PRODUCT-$VERSION serial number: "
33 read SERIAL
34
35 echo $FLASH_LPC
36
37 $FLASH_LPC ../src/easymini-v$VERSION/flash-loader/*.elf || exit 1
38
39 sleep 2
40
41 $USBLOAD --serial=$SERIAL ../src/easymini-v$VERSION/*.ihx || exit 1
42 #$USBLOAD --serial=$SERIAL /usr/share/altos/telemega-v$VERSION*.ihx || exit 1
43
44 sleep 2
45
46 dev=`ao-list | awk '/$PRODUCT-v'"$VERSION"'/ { print $3; exit(0); }'`
47
48 case "$dev" in
49 /dev/tty*)
50         echo "$PRODUCT found on $dev"
51         ;;
52 *)
53         echo 'No $PRODUCT-v'"$VERSION"' found'
54         exit 1
55         ;;
56 esac
57
58 echo "Testing igniters. Both should flash"
59 ./test-igniter "$dev" drogue main
60
61 case $? in
62 0)
63         ;;
64 *)
65         echo "failed"
66         exit 1
67 esac
68
69 echo "Testing baro sensor"
70 ./test-baro "$dev"
71
72 case $? in
73 0)
74         ;;
75 *)
76         echo "failed"
77         exit 1
78 esac