turn echo back on after accel cal in turnon_telemetrum so rest is easier
[fw/altos] / ao-bringup / turnon_telemetrum
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=2.0
18
19 echo "TeleMetrum v$VERSION Turn-On and Calibration Program"
20 echo "Copyright 2014 by Bdale Garbee.  Released under GPL v2"
21 echo
22 echo "Expectations:"
23 echo "\tTeleMetrum v$VERSIOn powered from USB"
24 echo "\t\twith ST-Link-V2 cabled to debug header"
25 echo "\t\twith coax from UHF to frequency counter"
26 echo
27 echo -n "TeleMetrum-$VERSION serial number: "
28 read SERIAL
29
30 echo $FLASH_STM
31
32 $FLASH_STM ~/altusmetrumllc/Binaries/loaders/telemetrum-v$VERSION-*.elf || exit 1
33
34 sleep 2
35
36 $USBLOAD --serial=$SERIAL /usr/share/altos/telemetrum-v$VERSION*.ihx || exit 1
37
38 sleep 5
39
40 dev=`ao-list | awk '/TeleMetrum-v'"$VERSION"'/ { print $3; exit(0); }'`
41
42 case "$dev" in
43 /dev/tty*)
44         echo "TeleMetrum found on $dev"
45         ;;
46 *)
47         echo 'No TeleMetrum-v'"$VERSION"' found'
48         exit 1
49         ;;
50 esac
51
52 echo 'E 0' > $dev
53
54 SERIAL=$SERIAL ./cal-freq $dev
55
56 ./cal-accel $dev
57
58 echo 'E 1' > $dev