Date:2011-04-13 18:47:41 (12 years 11 months ago)
Author:Werner Almesberger
Commit:598582c26a877b5135f9b6dbc47a185e3ed9b151
Message:atrf-path.c (do_half_sweep, do_sweep): don't duplicate the loop - use a function

Files: tools/atrf-path/atrf-path.c (1 diff)

Change Details

tools/atrf-path/atrf-path.c
106106}
107107
108108
109void do_sweep(const struct sweep *sweep, struct sample *res)
109static void do_half_sweep(const struct sweep *sweep, int cont_tx,
110    struct sample *res)
110111{
111    struct sample *r;
112112    int chan;
113113
114    r = res;
115114    for (chan = 11; chan <= 26; chan++) {
116115        set_channel(sweep->rx, chan);
117116        set_channel(sweep->tx, chan);
118117        usleep(155); /* table 7-2, tTR19 */
119118
120        sample(sweep, CONT_TX_M500K, r, chan == 11);
121        r += 2;
119        sample(sweep, cont_tx, res, chan == 11);
120        res += 2;
122121    }
123    r = res+1;
124    for (chan = 11; chan <= 26; chan++) {
125        set_channel(sweep->rx, chan);
126        set_channel(sweep->tx, chan);
127        usleep(155); /* table 7-2, tTR19 */
122}
128123
129        sample(sweep, CONT_TX_P500K, r, chan == 11);
130        r += 2;
131    }
124
125void do_sweep(const struct sweep *sweep, struct sample *res)
126{
127    do_half_sweep(sweep, CONT_TX_M500K, res);
128    do_half_sweep(sweep, CONT_TX_P500K, res+1);
132129}
133130
134131

Archive Download the corresponding diff file



interactive