annotate scripts/fc-rfcal-tri900 @ 101:b0618796d28d

fc-rfcal-txband: added safety checks for NaN power measurements and out-of-tolerance final Tx power levels
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 11 Aug 2017 03:20:43 +0000
parents 713749548df6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
90
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #!/bin/sh
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 case $# in
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 1)
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 ;;
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 2)
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 if [ ! -d "$2" ]
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 then
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 echo "error: specified report dir $2 is bad" 1>&2
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 exit 1
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 fi
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 ;;
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 *)
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 echo "usage: $0 txlevels-profile [report-dir]" 1>&2
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 exit 1
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 ;;
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 esac
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 profile_dir=/opt/freecalypso/rfcal/txlevels
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 if [ ! -f "$profile_dir/$1-900" ]
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 then
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 echo "error: $profile_dir/$1-900 profile missing" 1>&2
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 exit 1
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 fi
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if [ ! -f "$profile_dir/$1-1800" ]
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 then
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 echo "error: $profile_dir/$1-1800 profile missing" 1>&2
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 exit 1
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 fi
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 if [ ! -f "$profile_dir/$1-1900" ]
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 then
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 echo "error: $profile_dir/$1-1900 profile missing" 1>&2
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 exit 1
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 fi
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 report_dir="$2"
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 run_cmd() {
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 if [ -n "$report_dir" ]
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 then
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 fc-rfcal-tee "$1" "$report_dir/$2"
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 else
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 eval "$1"
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 fi
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 rc=$?
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 if [ $rc != 0 ]
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 then
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 echo "error: $1 returned $rc" 1>&2
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 exit $rc
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 fi
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 }
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 run_cmd fc-rfcal-vcxo vcxo
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 run_cmd "fc-rfcal-rxband 900" rx-900
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 run_cmd "fc-rfcal-rxband 1800" rx-1800
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 run_cmd "fc-rfcal-rxband 1900" rx-1900
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 run_cmd "fc-rfcal-txband 900 $1" tx-900
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 run_cmd "fc-rfcal-txband 1800 $1" tx-1800
713749548df6 fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 run_cmd "fc-rfcal-txband 1900 $1" tx-1900