mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-26 13:07:37 +02:00
atrf-path: new option -T to sweep only one offset
atrf-path -T +0.5 -g ... 10 10 time: before (both offsets) 0.65 s after (one offset) 0.32-0.33 s (50%) - atrf-path.c (usage, main): new option -T to specify which offset to sweep (default: sweep both) - atrf-path.c (do_half_sweep): only sample points with the desired offset - atrf-path.c (print_sweep): only prints points we've sweeped - gui.c (segment, draw): inverted flag logic from "have_last" to "first" - gui.c (draw): only plot points we've sweeped - gui.c (gui): pass the offset selection to "draw"
This commit is contained in:
parent
598582c26a
commit
e2a9c9d068
@ -14,6 +14,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "at86rf230.h"
|
#include "at86rf230.h"
|
||||||
|
|
||||||
@ -111,6 +112,8 @@ static void do_half_sweep(const struct sweep *sweep, int cont_tx,
|
|||||||
{
|
{
|
||||||
int chan;
|
int chan;
|
||||||
|
|
||||||
|
if (sweep->cont_tx && sweep->cont_tx != cont_tx)
|
||||||
|
return;
|
||||||
for (chan = 11; chan <= 26; chan++) {
|
for (chan = 11; chan <= 26; chan++) {
|
||||||
set_channel(sweep->rx, chan);
|
set_channel(sweep->rx, chan);
|
||||||
set_channel(sweep->tx, chan);
|
set_channel(sweep->tx, chan);
|
||||||
@ -134,9 +137,11 @@ static void print_sweep(const struct sweep *sweep, const struct sample *res)
|
|||||||
int chan;
|
int chan;
|
||||||
|
|
||||||
for (chan = 11; chan <= 26; chan++) {
|
for (chan = 11; chan <= 26; chan++) {
|
||||||
|
if (sweep->cont_tx != CONT_TX_P500K)
|
||||||
printf("%.1f %.2f %.0f %.0f\n",
|
printf("%.1f %.2f %.0f %.0f\n",
|
||||||
2350+5*chan-0.5, res->avg, res->min, res->max);
|
2350+5*chan-0.5, res->avg, res->min, res->max);
|
||||||
res++;
|
res++;
|
||||||
|
if (sweep->cont_tx != CONT_TX_M500K)
|
||||||
printf("%.1f %.2f %.0f %.0f\n",
|
printf("%.1f %.2f %.0f %.0f\n",
|
||||||
2350+5*chan+0.5, res->avg, res->min, res->max);
|
2350+5*chan+0.5, res->avg, res->min, res->max);
|
||||||
res++;
|
res++;
|
||||||
@ -167,14 +172,15 @@ static void usage(const char *name)
|
|||||||
"%6s %s -g common_args [[sweeps] samples]\n"
|
"%6s %s -g common_args [[sweeps] samples]\n"
|
||||||
#endif
|
#endif
|
||||||
"\n"
|
"\n"
|
||||||
" common args: [-p power] [-t trim_tx [-t trim_rx]] driver_tx[:arg]\n"
|
" common args: [-p power] [-t trim_tx [-t trim_rx]] [-T offset]\n"
|
||||||
" driver_rx[:arg]\n\n"
|
" driver_tx[:arg] driver_rx[:arg]\n\n"
|
||||||
|
|
||||||
#ifdef HAVE_GFX
|
#ifdef HAVE_GFX
|
||||||
" -g display results graphically\n"
|
" -g display results graphically\n"
|
||||||
#endif
|
#endif
|
||||||
" -p power transmit power, 0 to 15 (default %d)\n"
|
" -p power transmit power, 0 to 15 (default %d)\n"
|
||||||
" -t trim trim capacitor, 0 to 15 (default %d)\n"
|
" -t trim trim capacitor, 0 to 15 (default %d)\n"
|
||||||
|
" -T offset constant wave offset in MHz, -0.5 or +0.5 (default: scan both)\n"
|
||||||
|
|
||||||
, name,
|
, name,
|
||||||
#ifdef HAVE_GFX
|
#ifdef HAVE_GFX
|
||||||
@ -192,6 +198,7 @@ int main(int argc, char **argv)
|
|||||||
struct sweep sweep = {
|
struct sweep sweep = {
|
||||||
.trim_tx = -1,
|
.trim_tx = -1,
|
||||||
.trim_rx = DEFAULT_TRIM,
|
.trim_rx = DEFAULT_TRIM,
|
||||||
|
.cont_tx = 0,
|
||||||
.samples = 1,
|
.samples = 1,
|
||||||
};
|
};
|
||||||
int graphical = 0;
|
int graphical = 0;
|
||||||
@ -201,7 +208,7 @@ int main(int argc, char **argv)
|
|||||||
char *end;
|
char *end;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "gp:t:")) != EOF)
|
while ((c = getopt(argc, argv, "gp:t:T:")) != EOF)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case'g':
|
case'g':
|
||||||
graphical = 1;
|
graphical = 1;
|
||||||
@ -222,6 +229,14 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
sweep.trim_rx = tmp;
|
sweep.trim_rx = tmp;
|
||||||
break;
|
break;
|
||||||
|
case 'T':
|
||||||
|
if (!strcmp(optarg, "-0.5"))
|
||||||
|
sweep.cont_tx = CONT_TX_M500K;
|
||||||
|
else if (!strcmp(optarg, "+0.5"))
|
||||||
|
sweep.cont_tx = CONT_TX_P500K;
|
||||||
|
else
|
||||||
|
usage(*argv);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage(*argv);
|
usage(*argv);
|
||||||
}
|
}
|
||||||
|
@ -47,11 +47,11 @@
|
|||||||
|
|
||||||
|
|
||||||
static void segment(SDL_Surface *s, int *last_x, int *last_y, int x,
|
static void segment(SDL_Surface *s, int *last_x, int *last_y, int x,
|
||||||
const struct sample *res, int have_last)
|
const struct sample *res, int first)
|
||||||
{
|
{
|
||||||
int y = YRES-(res->avg-Y_MIN)/(Y_MAX-Y_MIN)*YRES-1;
|
int y = YRES-(res->avg-Y_MIN)/(Y_MAX-Y_MIN)*YRES-1;
|
||||||
|
|
||||||
if (have_last) {
|
if (!first) {
|
||||||
aalineColor(s, *last_x, *last_y, x, y, FG_RGBA);
|
aalineColor(s, *last_x, *last_y, x, y, FG_RGBA);
|
||||||
}
|
}
|
||||||
*last_x = x;
|
*last_x = x;
|
||||||
@ -59,16 +59,26 @@ static void segment(SDL_Surface *s, int *last_x, int *last_y, int x,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void draw(SDL_Surface *s, const struct sample *res)
|
static void draw(SDL_Surface *s, const struct sample *res, int cont_tx)
|
||||||
{
|
{
|
||||||
int last_x, last_y;
|
int last_x, last_y;
|
||||||
int x, i;
|
int first, x, i;
|
||||||
|
|
||||||
x = CHAN_X_OFFSET;
|
x = CHAN_X_OFFSET;
|
||||||
|
first = 1;
|
||||||
for (i = 0; i != N_CHAN; i++) {
|
for (i = 0; i != N_CHAN; i++) {
|
||||||
segment(s, &last_x, &last_y, x, res++, i);
|
if (cont_tx != CONT_TX_P500K) {
|
||||||
|
segment(s, &last_x, &last_y, x, res, first);
|
||||||
|
first = 0;
|
||||||
|
}
|
||||||
|
res++;
|
||||||
x += 2*SIDE_STEP;
|
x += 2*SIDE_STEP;
|
||||||
segment(s, &last_x, &last_y, x, res++, 1);
|
|
||||||
|
if (cont_tx != CONT_TX_M500K) {
|
||||||
|
segment(s, &last_x, &last_y, x, res, first);
|
||||||
|
first = 0;
|
||||||
|
}
|
||||||
|
res++;
|
||||||
x += CHAN_STEP-2*SIDE_STEP;
|
x += CHAN_STEP-2*SIDE_STEP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +158,7 @@ void gui(const struct sweep *sweep, int sweeps)
|
|||||||
aacircleColor(surf, STATUS_X, STATUS_Y, STATUS_R,
|
aacircleColor(surf, STATUS_X, STATUS_Y, STATUS_R,
|
||||||
OK_RGBA);
|
OK_RGBA);
|
||||||
}
|
}
|
||||||
draw(surf, res);
|
draw(surf, res, sweep->cont_tx);
|
||||||
|
|
||||||
SDL_UnlockSurface(surf);
|
SDL_UnlockSurface(surf);
|
||||||
SDL_UpdateRect(surf, 0, 0, 0, 0);
|
SDL_UpdateRect(surf, 0, 0, 0, 0);
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#ifndef SWEEP_H
|
#ifndef SWEEP_H
|
||||||
#define SWEEP_H
|
#define SWEEP_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "atrf.h"
|
#include "atrf.h"
|
||||||
|
|
||||||
|
|
||||||
@ -23,6 +25,7 @@ struct sweep {
|
|||||||
int trim_tx;
|
int trim_tx;
|
||||||
int trim_rx;
|
int trim_rx;
|
||||||
int power;
|
int power;
|
||||||
|
uint8_t cont_tx;
|
||||||
int samples;
|
int samples;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user