1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-23 12:16:26 +02:00

atrf-path.c: do cw test setup only once if sweeping a single offset

atrf-path -T +0.5 -g ... 10 10 time:

before:	0.32-0.33 s
after:	0.27-0.29 s	(88%)

- atrf-path.c (sample): force cw test setup if never done before
- atrf-path.c (do_half_sweep): only request cw test setup if sweeping
  both offsets
This commit is contained in:
Werner Almesberger 2011-04-13 14:17:01 -03:00
parent e2a9c9d068
commit a7d9dfd258

View File

@ -68,6 +68,7 @@ static double rssi_to_dBm(double rssi)
static void sample(const struct sweep *sweep, int cont_tx,
struct sample *res, int first)
{
static int need_init = 1;
int i, rssi;
int sum = 0, min = -1, max = -1;
double offset = tx_power_step2dBm(sweep->tx, sweep->power);
@ -80,10 +81,12 @@ static void sample(const struct sweep *sweep, int cont_tx,
* set_channel(sweep->tx, chan);
* usleep(155); / * table 7-2, tTR19 * /
*/
if (first)
if (first || need_init) {
cw_test_begin(sweep->tx, cont_tx);
else
need_init = 0;
} else {
cw_test_resume(sweep->tx);
}
/* table 7-1, tTR10, doubling since it's a "typical" value */
usleep(2*16);
@ -119,7 +122,7 @@ static void do_half_sweep(const struct sweep *sweep, int cont_tx,
set_channel(sweep->tx, chan);
usleep(155); /* table 7-2, tTR19 */
sample(sweep, cont_tx, res, chan == 11);
sample(sweep, cont_tx, res, chan == 11 && !sweep->cont_tx);
res += 2;
}
}