altos/test: Adjust CRC error rate after FEC fix
[fw/altos] / ao-bringup / turnon_telebt_v3
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=3.0
18 REPO=~/altusmetrumllc/Binaries
19
20 echo "TeleBT v$VERSION Turn-On and Calibration Program"
21 echo "Copyright 2015 by Bdale Garbee.  Released under GPL v2"
22 echo
23 echo "Expectations:"
24 echo "\tTeleBT 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 "TeleBT-$VERSION serial number: "
29 read SERIAL
30
31 echo $FLASH_STM
32
33 $FLASH_STM $REPO/loaders/telebt-v$VERSION*.elf || exit 1
34
35 sleep 5
36
37 $USBLOAD --serial=$SERIAL $REPO/telebt-v$VERSION*.elf || exit 1
38
39 sleep 5
40
41 dev=`ao-list | awk '/TeleBT-v'"$VERSION"'/ { print $3; exit(0); }'`
42
43 case "$dev" in
44 /dev/tty*)
45         echo "TeleBT found on $dev"
46         ;;
47 *)
48         echo 'No TeleBT-v'"$VERSION"' found'
49         exit 1
50         ;;
51 esac
52
53 echo 'E 0' > $dev
54
55 SERIAL=$SERIAL ./cal-freq $dev
56
57 echo 'E 1' > $dev
58
59 echo -n "checking BlueTooth functionality... "
60 btdev=`hcitool scan | awk -F \- '/TeleBT/ { print $2 }'`
61 if [ "$btdev" = "$SERIAL" ]; then
62         echo "working!"
63 else
64         echo "device not found"
65         exit 1
66 fi
67
68 echo "TeleBT-v$VERSION $SERIAL is ready to ship"
69
70 exit $?