Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some cleanups to allow more than 4 channels to be decoded #1

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# See README
CFLAGS= -Ofast -msse2 -funroll-loops -pthread -D WITH_RTL -D WITH_ALSA
#CFLAGS= -Ofast -mfpu=vfpv4 -funroll-loops -pthread -D WITH_RTL -I.
#CFLAGS= -Ofast -mfpu=neon-vfpv4 -funroll-loops -pthread -D WITH_RTL -I. `pkg-config --cflags libairspy`
LDLIBS= -lm -pthread -lrtlsdr -lasound
#LDLIBS= -lm -pthread `pkg-config --libs libairspy` -lusb-1.0
# See README for more information about choosing the right optimization
# flags for the target platform

OPT=-Ofast -msse2 -funroll-loops
#OPT= -Ofast -mfpu=vfpv4 -funroll-loops
#OPT= -Ofast -mfpu=neon-vfpv4 -funroll-loops
#OPT= -Ofast -mfpu=neon -ffast-math -funsafe-math-optimizations -fsingle-precision-constant

REQS="alsa libairspy librtlsdr libusb-1.0"
PCFLAGS!=pkg-config --cflags ${REQS}
PCLIBS!=pkg-config --libs ${REQS}
CFLAGS= ${OPT} -pthread -D WITH_RTL -D WITH_AIR -D WITH_ALSA ${PCFLAGS}
LDLIBS= -lm -pthread ${PCLIBS}

acarsdec: acarsdec.o acars.o msk.o rtl.o air.o output.o alsa.o
$(CC) acarsdec.o acars.o msk.o rtl.o air.o output.o alsa.o -o $@ $(LDLIBS)
Expand All @@ -17,8 +23,9 @@ acars.o: acars.c acarsdec.h syndrom.h
msk.o: msk.c acarsdec.h
output.o: output.c acarsdec.h
rtl.o: rtl.c acarsdec.h
air.o: air.c acarsdec.h
acarsserv.o: acarsserv.h
dbmgm.o: acarsserv.h

clean:
@rm *.o acarsdec acarsserv
@rm -f *.o acarsdec acarsserv
17 changes: 8 additions & 9 deletions acarsdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ int verbose = 0;
int outtype = 2;
int netout;
int airflt = 0;
#ifdef WITH_RTL
#if defined(WITH_RTL) || defined(WITH_AIR)
int gain = 1000;
int ppm = 0;
#endif
#ifdef WITH_AIR
int gain = 10;
#endif

char *Rawaddr = NULL;
char *logfilename = NULL;
Expand All @@ -56,7 +53,7 @@ static void usage(void)
#endif
#ifdef WITH_RTL
fprintf(stderr,
" [-g gain] [-p ppm] -r rtldevicenumber f1 [f2] ... [f4]");
" [-g gain] [-p ppm] -r rtldevicenumber f1 [f2] ... [fN]");
#endif
fprintf(stderr, "\n\n");
fprintf(stderr, " -v\t\t\t: verbose\n");
Expand All @@ -69,7 +66,7 @@ static void usage(void)
fprintf(stderr,
" -n ipaddr:port\t\t: send acars messages to addr:port on UDP in planeplotter compatible format\n");
fprintf(stderr,
" -N ipaddr:port\t\t: send acars messages to addr:port on UDP in acarsdev nativ format\n");
" -N ipaddr:port\t\t: send acars messages to addr:port on UDP in acarsdev native format\n");
fprintf(stderr,
" -i stationid\t\t: station id used in acarsdec network format.\n\n");
#ifdef WITH_ALSA
Expand All @@ -81,14 +78,14 @@ static void usage(void)
" -g gain\t\t: set rtl preamp gain in tenth of db (ie -g 90 for +9db). By default use AGC\n");
fprintf(stderr, " -p ppm\t\t\t: set rtl ppm frequency correction\n");
fprintf(stderr,
" -r rtldevice f1 [f2]...[f4]\t: decode from rtl dongle number or S/N rtldevice receiving at VHF frequencies f1 and optionaly f2 to f4 in Mhz (ie : -r 0 131.525 131.725 131.825 )\n");
" -r rtldevice f1 [... fN]\t: decode from rtl dongle number or S/N rtldevice receiving at VHF frequencies f1 and optionally f2 to fN in Mhz (ie : -r 0 131.525 131.725 131.825 )\n");
#endif
#ifdef WITH_AIR
fprintf(stderr,
" -s f1 [f2]...[f4]\t: decode from airspy receiving at VHF frequencies f1 and optionaly f2 to f4 in Mhz (ie : -r 0 131.525 131.725 131.825 )\n");
" -s f1 [... fN]\t: decode from airspy receiving at VHF frequencies f1 and optionally f2 to fN in Mhz (ie : -r 0 131.525 131.725 131.825 )\n");
#endif
fprintf(stderr,
"\nFor any input source , up to 4 channels could be simultanously decoded\n");
"\nFor any input source , up to %d channels may be simultanously decoded\n", MAXNBCHANNELS);
exit(1);
}

Expand Down Expand Up @@ -121,6 +118,7 @@ int main(int argc, char **argv)
#endif
#ifdef WITH_RTL
case 'r':
gain = 1000;
res = initRtl(argv, optind);
inmode = 3;
break;
Expand All @@ -130,6 +128,7 @@ int main(int argc, char **argv)
#endif
#ifdef WITH_AIR
case 's':
gain = 10;
res = initAirspy(argv, optind);
inmode = 4;
break;
Expand Down
4 changes: 2 additions & 2 deletions acarsdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ extern int initRtl(char **argv,int optind);
extern int runRtlSample(void);
#endif
#ifdef WITH_AIR
extern int initAIR(char **argv,int optind);
extern int runAIRSample(void);
extern int initAirspy(char **argv,int optind);
extern int runAirspy(void);
#endif
extern int initMsk(channel_t *);
extern void demodMSK(channel_t *ch,int len);
Expand Down
2 changes: 1 addition & 1 deletion rtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int initRtl(char **argv, int optind)
int dev_index;
char *argF;
unsigned int Fc;
unsigned int Fd[4];
unsigned int Fd[MAXNBCHANNELS];

if (argv[optind] == NULL) {
fprintf(stderr, "Need device name or index (ex: 0) after -r\n");
Expand Down