From 697031155b52bb52b000235bcc40fc5983a4e1d1 Mon Sep 17 00:00:00 2001 From: Guenael Date: Fri, 23 Jun 2017 12:34:23 -0400 Subject: [PATCH] format --- fano.c | 3 ++- nhash.c | 5 +++-- nhash.h | 12 +----------- wsprd.c | 26 ++++++++++---------------- wsprd.h | 6 ++++-- wsprd_utils.c | 10 +++++++--- wsprd_utils.h | 18 +----------------- wsprsim_utils.c | 14 +++++++------- wsprsim_utils.h | 21 +-------------------- 9 files changed, 36 insertions(+), 79 deletions(-) diff --git a/fano.c b/fano.c index cce9fb8..c1cc80b 100644 --- a/fano.c +++ b/fano.c @@ -11,9 +11,10 @@ */ #define LL 1 // Select Layland-Lushbaugh code + #include #include -#include + #include "fano.h" struct node { diff --git a/nhash.c b/nhash.c index 41bec0f..39fdb68 100644 --- a/nhash.c +++ b/nhash.c @@ -70,8 +70,9 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #define SELF_TEST 1 -#include /* defines printf for tests */ -#include /* defines time_t for timings in the test */ +#include +#include + #include "nhash.h" //#include /* attempt to define endianness */ //#ifdef linux diff --git a/nhash.h b/nhash.h index d13268d..ce75db9 100644 --- a/nhash.h +++ b/nhash.h @@ -1,14 +1,4 @@ -#ifndef NHASH_H_ -#define NHASH_H_ - -#ifdef Win32 -#include "win_stdint.h" /* defines uint32_t etc */ -#else -#include -#include /* defines uint32_t etc */ -#endif +#pragma once uint32_t nhash( const void * key, size_t length, uint32_t initval); uint32_t nhash_( void const * key, size_t const * length, uint32_t const * initval); - -#endif diff --git a/wsprd.c b/wsprd.c index 2e7026d..56b45f2 100644 --- a/wsprd.c +++ b/wsprd.c @@ -31,13 +31,10 @@ along with this program. If not, see . */ -#include -#include -#include #include -#include #include -#include +#include +#include #include #include "wsprd.h" @@ -59,8 +56,7 @@ #define NSIG NSYM * NSPERSYM /* Possible PATIENCE options: FFTW_ESTIMATE, FFTW_ESTIMATE_PATIENT, FFTW_MEASURE, FFTW_PATIENT, FFTW_EXHAUSTIVE */ -//#define PATIENCE FFTW_ESTIMATE -#define PATIENCE FFTW_MEASURE // FIXME check !!! +#define PATIENCE FFTW_ESTIMATE uint8_t pr3[NSYM]= { 1,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0, @@ -80,17 +76,17 @@ fftwf_plan PLAN1, int32_t printdata=0; -//*************************************************************************** +/*********************************************************************** + * mode = 0: no frequency or drift search. find best time lag. * + * 1: no time lag or drift search. find best frequency. * + * 2: no frequency or time lag search. calculate soft-decision * + * symbols using passed frequency and shift. * + ************************************************************************/ void sync_and_demodulate(float *id, float *qd, long np, uint8_t *symbols, float *f1, float fstep, int32_t *shift1, int32_t lagmin, int32_t lagmax, int32_t lagstep, float *drift1, int32_t symfac, float *sync, int32_t mode) { - /*********************************************************************** - * mode = 0: no frequency or drift search. find best time lag. * - * 1: no time lag or drift search. find best frequency. * - * 2: no frequency or time lag search. calculate soft-decision * - * symbols using passed frequency and shift. * - ************************************************************************/ + float fbest=0.0; float f0=0.0,fp,ss; @@ -408,8 +404,6 @@ void subtract_signal2(float *id, float *qd, long np, } - -//*************************************************************************** int32_t wspr_decode(float *idat, float *qdat, uint32_t npoints, struct decoder_options options, struct decoder_results *decodes, int32_t *n_results) { diff --git a/wsprd.h b/wsprd.h index bde7f19..cee3ea4 100644 --- a/wsprd.h +++ b/wsprd.h @@ -11,6 +11,10 @@ Copyright 2014-2015, Steven Franke, K9AN + Minor modifications + + Copyright 2016, Guenael Jouchet, VA2GKA + License: GNU GPL v3 This program is free software: you can redistribute it and/or modify @@ -27,10 +31,8 @@ along with this program. If not, see . */ - #pragma once - /* Option & config of decoder (Shared with the wsprd code) */ struct decoder_options { uint32_t freq; // Dial frequency diff --git a/wsprd_utils.c b/wsprd_utils.c index 26161e8..b436630 100644 --- a/wsprd_utils.c +++ b/wsprd_utils.c @@ -26,11 +26,15 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + +#include +#include +#include +#include + +#include "nhash.h" #include "wsprd_utils.h" -#ifndef int32_t -#define int32_t int -#endif void unpack50( signed char *dat, int32_t *n1, int32_t *n2 ) { int32_t i,i4; diff --git a/wsprd_utils.h b/wsprd_utils.h index d2aa3c1..1cab6c9 100644 --- a/wsprd_utils.h +++ b/wsprd_utils.h @@ -1,23 +1,9 @@ -#ifndef WSPRD_UTILS_H -#define WSPRD_UTILS_H - -#include -#include -#include -#include -#include -#include -#include -#include "nhash.h" +#pragma once void unpack50( signed char *dat, int32_t *n1, int32_t *n2 ); - int unpackcall( int32_t ncall, char *call ); - int unpackgrid( int32_t ngrid, char *grid); - int unpackpfx( int32_t nprefix, char *call); - void deinterleave(unsigned char *sym); // used by qsort @@ -25,5 +11,3 @@ int doublecomp(const void* elem1, const void* elem2); int floatcomp(const void* elem1, const void* elem2); int unpk_( signed char *message, char *hashtab, char *call_loc_pow, char *call, char *loc, char *pwr, char *callsign); - -#endif diff --git a/wsprsim_utils.c b/wsprsim_utils.c index 3fed039..914d49a 100644 --- a/wsprsim_utils.c +++ b/wsprsim_utils.c @@ -1,11 +1,18 @@ /* Functions used by wsprsim */ + +#include +#include +#include +#include + #include "wsprsim_utils.h" #include "wsprd_utils.h" #include "nhash.h" #include "fano.h" + char get_locator_character_code(char ch) { if( ch >=48 && ch <=57 ) { //0-9 return ch-48; @@ -274,13 +281,6 @@ int get_wspr_channel_symbols(char* rawmessage, char* hashtab, unsigned char* sym data[9]=0; data[10]=0; - if( printdata ) { - printf("Data is :"); - for (i=0; i<11; i++) { - printf("%02X ",data[i]); - } - printf("\n"); - } // make sure that the 11-byte data vector is unpackable // unpack it with the routine that the decoder will use and display diff --git a/wsprsim_utils.h b/wsprsim_utils.h index 2f4151a..45cef18 100644 --- a/wsprsim_utils.h +++ b/wsprsim_utils.h @@ -1,28 +1,9 @@ -#ifndef WSPRSIM_UTILS_H -#define WSPRSIM_UTILS_H - -#include -#include -#include -#include -#include -#include -#include - -extern int printdata; +#pragma once char get_locator_character_code(char ch); - char get_callsign_character_code(char ch); - long unsigned int pack_grid4_power(char *grid4, int power); - long unsigned int pack_call(char *callsign); - void pack_prefix(char *callsign, int32_t *n, int32_t *m, int32_t *nadd ); - void interleave(unsigned char *sym); - int get_wspr_channel_symbols(char* message, char* hashtab, unsigned char* symbols); - -#endif