annotate autocal/txpwrmeas.c @ 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 b313884c79fd
children 94e8a410d6bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
54
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module contains the Tx power measurement function.
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdio.h>
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdlib.h>
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 extern char tsid_response[];
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
55
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
10 do_txpwr_cal_setup(band, arfcn)
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
11 char *band;
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
12 unsigned arfcn;
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
13 {
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
14 char cmd[80];
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
15
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
16 sprintf(cmd, "txpwr-cal-setup %s %u\n", band, arfcn);
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
17 tsid_command(cmd);
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
18 return(0);
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
19 }
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
20
54
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 double
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 tx_power_meas()
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 double meas;
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 tsid_command("power-meas\n");
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 meas = atof(tsid_response + 1);
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 return(meas);
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }