kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
Update demodulators from upstream repo
rodzic
255b900734
commit
87fda79c40
|
@ -12,15 +12,12 @@ echo "Removing binaries in the auto_rx directory."
|
||||||
cd ../auto_rx/
|
cd ../auto_rx/
|
||||||
rm dft_detect
|
rm dft_detect
|
||||||
rm fsk_demod
|
rm fsk_demod
|
||||||
rm imet1rs_dft
|
|
||||||
rm imet4iq
|
rm imet4iq
|
||||||
rm mk2a_lms1680
|
|
||||||
rm mk2a1680mod
|
rm mk2a1680mod
|
||||||
rm rs41mod
|
rm rs41mod
|
||||||
rm rs92mod
|
rm rs92mod
|
||||||
rm dfm09mod
|
rm dfm09mod
|
||||||
rm m10mod
|
rm m10mod
|
||||||
rm mXXmod
|
|
||||||
rm m20mod
|
rm m20mod
|
||||||
rm lms6Xmod
|
rm lms6Xmod
|
||||||
rm meisei100mod
|
rm meisei100mod
|
||||||
|
|
|
@ -125,14 +125,14 @@ static int dft_window(dft_t *dft, int w) {
|
||||||
dft->win[n] = 1.0;
|
dft->win[n] = 1.0;
|
||||||
break;
|
break;
|
||||||
case 1: // Hann
|
case 1: // Hann
|
||||||
dft->win[n] = 0.5 * ( 1.0 - cos(2*M_PI*n/(float)(dft->N2-1)) );
|
dft->win[n] = 0.5 * ( 1.0 - cos(_2PI*n/(float)(dft->N2-1)) );
|
||||||
break ;
|
break ;
|
||||||
case 2: // Hamming
|
case 2: // Hamming
|
||||||
dft->win[n] = 25/46.0 - (1.0 - 25/46.0)*cos(2*M_PI*n / (float)(dft->N2-1));
|
dft->win[n] = 25/46.0 - (1.0 - 25/46.0)*cos(_2PI*n / (float)(dft->N2-1));
|
||||||
break ;
|
break ;
|
||||||
case 3: // Blackmann
|
case 3: // Blackmann
|
||||||
dft->win[n] = 7938/18608.0
|
dft->win[n] = 7938/18608.0
|
||||||
- 9240/18608.0*cos(2*M_PI*n / (float)(dft->N2-1))
|
- 9240/18608.0*cos(_2PI*n / (float)(dft->N2-1))
|
||||||
+ 1430/18608.0*cos(4*M_PI*n / (float)(dft->N2-1));
|
+ 1430/18608.0*cos(4*M_PI*n / (float)(dft->N2-1));
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ static int lowpass_init(float f, int taps, float **pws) {
|
||||||
ws = (float*)calloc( 2*taps+1, sizeof(float)); if (ws == NULL) return -1;
|
ws = (float*)calloc( 2*taps+1, sizeof(float)); if (ws == NULL) return -1;
|
||||||
|
|
||||||
for (n = 0; n < taps; n++) {
|
for (n = 0; n < taps; n++) {
|
||||||
w[n] = 7938/18608.0 - 9240/18608.0*cos(2*M_PI*n/(taps-1)) + 1430/18608.0*cos(4*M_PI*n/(taps-1)); // Blackmann
|
w[n] = 7938/18608.0 - 9240/18608.0*cos(_2PI*n/(taps-1)) + 1430/18608.0*cos(4*M_PI*n/(taps-1)); // Blackmann
|
||||||
h[n] = 2*f*sinc(2*f*(n-(taps-1)/2));
|
h[n] = 2*f*sinc(2*f*(n-(taps-1)/2));
|
||||||
ws[n] = w[n]*h[n];
|
ws[n] = w[n]*h[n];
|
||||||
norm += ws[n]; // 1-norm
|
norm += ws[n]; // 1-norm
|
||||||
|
@ -600,7 +600,7 @@ static int lowpass_update(float f, int taps, float *ws) {
|
||||||
w = (double*)calloc( taps+1, sizeof(double)); if (w == NULL) return -1;
|
w = (double*)calloc( taps+1, sizeof(double)); if (w == NULL) return -1;
|
||||||
|
|
||||||
for (n = 0; n < taps; n++) {
|
for (n = 0; n < taps; n++) {
|
||||||
w[n] = 7938/18608.0 - 9240/18608.0*cos(2*M_PI*n/(taps-1)) + 1430/18608.0*cos(4*M_PI*n/(taps-1)); // Blackmann
|
w[n] = 7938/18608.0 - 9240/18608.0*cos(_2PI*n/(taps-1)) + 1430/18608.0*cos(4*M_PI*n/(taps-1)); // Blackmann
|
||||||
h[n] = 2*f*sinc(2*f*(n-(taps-1)/2));
|
h[n] = 2*f*sinc(2*f*(n-(taps-1)/2));
|
||||||
ws[n] = w[n]*h[n];
|
ws[n] = w[n]*h[n];
|
||||||
norm += ws[n]; // 1-norm
|
norm += ws[n]; // 1-norm
|
||||||
|
@ -625,8 +625,7 @@ static float complex lowpass0(float complex buffer[], ui32_t sample, ui32_t taps
|
||||||
}
|
}
|
||||||
return (float complex)w;
|
return (float complex)w;
|
||||||
}
|
}
|
||||||
|
static float complex lowpass1(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||||
static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
|
||||||
ui32_t n;
|
ui32_t n;
|
||||||
ui32_t s = sample % taps;
|
ui32_t s = sample % taps;
|
||||||
double complex w = 0;
|
double complex w = 0;
|
||||||
|
@ -636,6 +635,59 @@ static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t taps,
|
||||||
return (float complex)w;
|
return (float complex)w;
|
||||||
// symmetry: ws[n] == ws[taps-1-n]
|
// symmetry: ws[n] == ws[taps-1-n]
|
||||||
}
|
}
|
||||||
|
static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||||
|
float complex w = 0; // -Ofast
|
||||||
|
int n;
|
||||||
|
int s = sample % taps; // lpIQ
|
||||||
|
int S1 = s+1;
|
||||||
|
int S1N = S1-taps;
|
||||||
|
int n0 = taps-1-s;
|
||||||
|
for (n = 0; n < n0; n++) {
|
||||||
|
w += buffer[S1+n]*ws[n];
|
||||||
|
}
|
||||||
|
for (n = n0; n < taps; n++) {
|
||||||
|
w += buffer[S1N+n]*ws[n];
|
||||||
|
}
|
||||||
|
return w;
|
||||||
|
// symmetry: ws[n] == ws[taps-1-n]
|
||||||
|
}
|
||||||
|
static float complex lowpass0_sym(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||||
|
ui32_t n;
|
||||||
|
double complex w = buffer[(sample+(taps+1)/2) % taps]*ws[(taps-1)/2]; // (N+1)/2 = (N-1)/2 + 1
|
||||||
|
for (n = 0; n < (taps-1)/2; n++) {
|
||||||
|
w += (buffer[(sample+n+1)%taps]+buffer[(sample+taps-n)%taps])*ws[n];
|
||||||
|
}
|
||||||
|
return (float complex)w;
|
||||||
|
}
|
||||||
|
static float complex lowpass2_sym(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||||
|
float complex w = 0;
|
||||||
|
int n;
|
||||||
|
int s = (sample+1) % taps; // lpIQ
|
||||||
|
int SW = (taps-1)/2;
|
||||||
|
int B1 = s + SW;
|
||||||
|
int n1 = SW - s;
|
||||||
|
int n0 = 0;
|
||||||
|
|
||||||
|
if (s > SW) {
|
||||||
|
B1 -= taps;
|
||||||
|
n1 = -n1 - 1;
|
||||||
|
n0 = B1+n1+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
w = buffer[B1]*ws[SW];
|
||||||
|
|
||||||
|
for (n = 1; n < n1+1; n++) {
|
||||||
|
w += (buffer[B1 + n] + buffer[B1 - n]) * ws[SW+n];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (n = 0; n < SW-n1; n++) {
|
||||||
|
w += (buffer[s + n] + buffer[s-1 - n]) * ws[SW+SW-n];
|
||||||
|
}
|
||||||
|
|
||||||
|
return w;
|
||||||
|
// symmetry: ws[n] == ws[taps-1-n]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static float re_lowpass0(float buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
static float re_lowpass0(float buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||||
ui32_t n;
|
ui32_t n;
|
||||||
|
@ -669,33 +721,32 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
||||||
if (dsp->opt_iq)
|
if (dsp->opt_iq)
|
||||||
{
|
{
|
||||||
if (dsp->opt_iq == 5) {
|
if (dsp->opt_iq == 5) {
|
||||||
ui32_t s_reset = dsp->dectaps*dsp->lut_len;
|
|
||||||
int j;
|
int j;
|
||||||
if ( f32read_cblock(dsp) < dsp->decM ) return EOF;
|
if ( f32read_cblock(dsp) < dsp->decM ) return EOF;
|
||||||
for (j = 0; j < dsp->decM; j++) {
|
for (j = 0; j < dsp->decM; j++) {
|
||||||
if (dsp->opt_nolut) {
|
if (dsp->opt_nolut) {
|
||||||
double _s_base = (double)(dsp->sample_in*dsp->decM+j); // dsp->sample_dec
|
double _s_base = (double)(dsp->sample_in*dsp->decM+j); // dsp->sample_dec
|
||||||
double f0 = dsp->xlt_fq*_s_base - dsp->Df*_s_base/(double)dsp->sr_base;
|
double f0 = dsp->xlt_fq*_s_base - dsp->Df*_s_base/(double)dsp->sr_base;
|
||||||
z = dsp->decMbuf[j] * cexp(f0*2*M_PI*I);
|
z = dsp->decMbuf[j] * cexp(f0*_2PI*I);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
z = dsp->decMbuf[j] * dsp->ex[dsp->sample_dec % dsp->lut_len];
|
z = dsp->decMbuf[j] * dsp->ex[dsp->sample_decM];
|
||||||
}
|
}
|
||||||
|
dsp->sample_decM += 1; if (dsp->sample_decM >= dsp->lut_len) dsp->sample_decM = 0;
|
||||||
|
|
||||||
dsp->decXbuffer[dsp->sample_dec % dsp->dectaps] = z;
|
dsp->decXbuffer[dsp->sample_decX] = z;
|
||||||
dsp->sample_dec += 1;
|
dsp->sample_decX += 1; if (dsp->sample_decX >= dsp->dectaps) dsp->sample_decX = 0;
|
||||||
if (dsp->sample_dec == s_reset) dsp->sample_dec = 0;
|
|
||||||
}
|
}
|
||||||
if (dsp->decM > 1)
|
if (dsp->decM > 1)
|
||||||
{
|
{
|
||||||
z = lowpass(dsp->decXbuffer, dsp->sample_dec, dsp->dectaps, ws_dec);
|
z = lowpass(dsp->decXbuffer, dsp->sample_decX, dsp->dectaps, ws_dec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( f32read_csample(dsp, &z) == EOF ) return EOF;
|
else if ( f32read_csample(dsp, &z) == EOF ) return EOF;
|
||||||
|
|
||||||
if (dsp->opt_dc && !dsp->opt_nolut)
|
if (dsp->opt_dc && !dsp->opt_nolut)
|
||||||
{
|
{
|
||||||
z *= cexp(-t*2*M_PI*dsp->Df*I);
|
z *= cexp(-t*_2PI*dsp->Df*I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -710,7 +761,7 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
||||||
w = z * conj(z0);
|
w = z * conj(z0);
|
||||||
s_fm = gain * carg(w)/M_PI;
|
s_fm = gain * carg(w)/M_PI;
|
||||||
|
|
||||||
dsp->rot_iqbuf[dsp->sample_in % dsp->N_IQBUF] = z;
|
dsp->rot_iqbuf[dsp->sample_in % dsp->N_IQBUF] = z; // sample_in & (N-1) , N = (1<<LOG2N)
|
||||||
|
|
||||||
|
|
||||||
if (dsp->opt_iq >= 2)
|
if (dsp->opt_iq >= 2)
|
||||||
|
@ -718,8 +769,8 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
||||||
if (dsp->opt_iq >= 2) {
|
if (dsp->opt_iq >= 2) {
|
||||||
double xbit = 0.0;
|
double xbit = 0.0;
|
||||||
//float complex xi = cexp(+I*M_PI*dsp->h/dsp->sps);
|
//float complex xi = cexp(+I*M_PI*dsp->h/dsp->sps);
|
||||||
double f1 = -dsp->h*dsp->sr/(2.0*dsp->sps);
|
//double f1 = -dsp->h*dsp->sr/(2.0*dsp->sps);
|
||||||
double f2 = -f1;
|
//double f2 = -f1;
|
||||||
|
|
||||||
float complex X0 = 0;
|
float complex X0 = 0;
|
||||||
float complex X = 0;
|
float complex X = 0;
|
||||||
|
@ -731,13 +782,13 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
||||||
z0 = dsp->rot_iqbuf[(dsp->sample_in-n + dsp->N_IQBUF) % dsp->N_IQBUF];
|
z0 = dsp->rot_iqbuf[(dsp->sample_in-n + dsp->N_IQBUF) % dsp->N_IQBUF];
|
||||||
|
|
||||||
// f1
|
// f1
|
||||||
X0 = z0 * cexp(-tn*2*M_PI*f1*I); // alt
|
X0 = z0 * cexp(-tn*dsp->iw1); // alt
|
||||||
X = z * cexp(-t *2*M_PI*f1*I); // neu
|
X = z * cexp(-t *dsp->iw1); // neu
|
||||||
dsp->F1sum += X - X0;
|
dsp->F1sum += X - X0;
|
||||||
|
|
||||||
// f2
|
// f2
|
||||||
X0 = z0 * cexp(-tn*2*M_PI*f2*I); // alt
|
X0 = z0 * cexp(-tn*dsp->iw2); // alt
|
||||||
X = z * cexp(-t *2*M_PI*f2*I); // neu
|
X = z * cexp(-t *dsp->iw2); // neu
|
||||||
dsp->F2sum += X - X0;
|
dsp->F2sum += X - X0;
|
||||||
|
|
||||||
xbit = cabs(dsp->F2sum) - cabs(dsp->F1sum);
|
xbit = cabs(dsp->F2sum) - cabs(dsp->F1sum);
|
||||||
|
@ -747,8 +798,8 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
||||||
else if (0 && dsp->opt_iq == 4) {
|
else if (0 && dsp->opt_iq == 4) {
|
||||||
double xbit = 0.0;
|
double xbit = 0.0;
|
||||||
//float complex xi = cexp(+I*M_PI*dsp->h/dsp->sps);
|
//float complex xi = cexp(+I*M_PI*dsp->h/dsp->sps);
|
||||||
double f1 = -dsp->h*dsp->sr/(2*dsp->sps);
|
//double f1 = -dsp->h*dsp->sr/(2*dsp->sps);
|
||||||
double f2 = -f1;
|
//double f2 = -f1;
|
||||||
|
|
||||||
float complex X1 = 0;
|
float complex X1 = 0;
|
||||||
float complex X2 = 0;
|
float complex X2 = 0;
|
||||||
|
@ -759,8 +810,8 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
||||||
n--;
|
n--;
|
||||||
t = -n / (double)dsp->sr;
|
t = -n / (double)dsp->sr;
|
||||||
z = dsp->rot_iqbuf[(dsp->sample_in - n + dsp->N_IQBUF) % dsp->N_IQBUF]; // +1
|
z = dsp->rot_iqbuf[(dsp->sample_in - n + dsp->N_IQBUF) % dsp->N_IQBUF]; // +1
|
||||||
X1 += z*cexp(-t*2*M_PI*f1*I);
|
X1 += z*cexp(-t*dsp->iw1);
|
||||||
X2 += z*cexp(-t*2*M_PI*f2*I);
|
X2 += z*cexp(-t*dsp->iw2);
|
||||||
}
|
}
|
||||||
|
|
||||||
xbit = cabs(X2) - cabs(X1);
|
xbit = cabs(X2) - cabs(X1);
|
||||||
|
@ -787,7 +838,7 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
||||||
dsp->fm_buffer[dsp->sample_in % dsp->M] = s_fm;
|
dsp->fm_buffer[dsp->sample_in % dsp->M] = s_fm;
|
||||||
|
|
||||||
if (inv) s = -s;
|
if (inv) s = -s;
|
||||||
dsp->bufs[dsp->sample_in % dsp->M] = s;
|
dsp->bufs[dsp->sample_in % dsp->M] = s; // sample_in & (M-1) , M = (1<<LOG2N)
|
||||||
|
|
||||||
|
|
||||||
xneu = dsp->bufs[(dsp->sample_in ) % dsp->M];
|
xneu = dsp->bufs[(dsp->sample_in ) % dsp->M];
|
||||||
|
@ -1146,7 +1197,7 @@ int init_buffers(dsp_t *dsp) {
|
||||||
int i, pos;
|
int i, pos;
|
||||||
float b0, b1, b2, b, t;
|
float b0, b1, b2, b, t;
|
||||||
float normMatch;
|
float normMatch;
|
||||||
double sigma = sqrt(log(2)) / (2*M_PI*dsp->BT);
|
double sigma = sqrt(log(2)) / (_2PI*dsp->BT);
|
||||||
|
|
||||||
int p2 = 1;
|
int p2 = 1;
|
||||||
int K, L, M;
|
int K, L, M;
|
||||||
|
@ -1227,7 +1278,7 @@ int init_buffers(dsp_t *dsp) {
|
||||||
if (dsp->ex == NULL) return -1;
|
if (dsp->ex == NULL) return -1;
|
||||||
for (n = 0; n < dsp->lut_len; n++) {
|
for (n = 0; n < dsp->lut_len; n++) {
|
||||||
t = f0*(double)n;
|
t = f0*(double)n;
|
||||||
dsp->ex[n] = cexp(t*2*M_PI*I);
|
dsp->ex[n] = cexp(t*_2PI*I);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1314,7 +1365,7 @@ int init_buffers(dsp_t *dsp) {
|
||||||
|
|
||||||
dsp->K = K;
|
dsp->K = K;
|
||||||
dsp->L = L;
|
dsp->L = L;
|
||||||
dsp->M = M;
|
dsp->M = M; // = (1<<LOG2N)
|
||||||
|
|
||||||
dsp->Nvar = L; // wenn Nvar fuer xnorm, dann Nvar=rshd.L
|
dsp->Nvar = L; // wenn Nvar fuer xnorm, dann Nvar=rshd.L
|
||||||
|
|
||||||
|
@ -1391,13 +1442,21 @@ int init_buffers(dsp_t *dsp) {
|
||||||
{
|
{
|
||||||
if (dsp->nch < 2) return -1;
|
if (dsp->nch < 2) return -1;
|
||||||
|
|
||||||
dsp->N_IQBUF = dsp->DFT.N;
|
dsp->N_IQBUF = dsp->DFT.N; // = (1<<LOG2N)
|
||||||
dsp->rot_iqbuf = calloc(dsp->N_IQBUF+1, sizeof(float complex)); if (dsp->rot_iqbuf == NULL) return -1;
|
dsp->rot_iqbuf = calloc(dsp->N_IQBUF+1, sizeof(float complex)); if (dsp->rot_iqbuf == NULL) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dsp->fm_buffer = (float *)calloc( M+1, sizeof(float)); if (dsp->fm_buffer == NULL) return -1; // dsp->bufs[]
|
dsp->fm_buffer = (float *)calloc( M+1, sizeof(float)); if (dsp->fm_buffer == NULL) return -1; // dsp->bufs[]
|
||||||
|
|
||||||
|
|
||||||
|
if (dsp->opt_iq)
|
||||||
|
{
|
||||||
|
double f1 = -dsp->h*dsp->sr/(2.0*dsp->sps);
|
||||||
|
double f2 = -f1;
|
||||||
|
dsp->iw1 = _2PI*I*f1;
|
||||||
|
dsp->iw2 = _2PI*I*f2;
|
||||||
|
}
|
||||||
|
|
||||||
return K;
|
return K;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1489,8 +1548,8 @@ int find_header(dsp_t *dsp, float thres, int hdmax, int bitofs, int opt_dc) {
|
||||||
double diffDf = dsp->dDf*0.6; //0.4
|
double diffDf = dsp->dDf*0.6; //0.4
|
||||||
if (1 && dsp->opt_iq >= 2) {
|
if (1 && dsp->opt_iq >= 2) {
|
||||||
// update rot_iqbuf, F1sum, F2sum
|
// update rot_iqbuf, F1sum, F2sum
|
||||||
double f1 = -dsp->h*dsp->sr/(2*dsp->sps);
|
//double f1 = -dsp->h*dsp->sr/(2*dsp->sps);
|
||||||
double f2 = -f1;
|
//double f2 = -f1;
|
||||||
float complex X1 = 0;
|
float complex X1 = 0;
|
||||||
float complex X2 = 0;
|
float complex X2 = 0;
|
||||||
float complex _z = 0;
|
float complex _z = 0;
|
||||||
|
@ -1499,12 +1558,12 @@ int find_header(dsp_t *dsp, float thres, int hdmax, int bitofs, int opt_dc) {
|
||||||
{
|
{
|
||||||
// update rot_iqbuf
|
// update rot_iqbuf
|
||||||
double _tn = (dsp->sample_in - _n) / (double)dsp->sr;
|
double _tn = (dsp->sample_in - _n) / (double)dsp->sr;
|
||||||
dsp->rot_iqbuf[(dsp->sample_in - _n + dsp->N_IQBUF) % dsp->N_IQBUF] *= cexp(-_tn*2*M_PI*diffDf*I);
|
dsp->rot_iqbuf[(dsp->sample_in - _n + dsp->N_IQBUF) % dsp->N_IQBUF] *= cexp(-_tn*_2PI*diffDf*I);
|
||||||
//
|
//
|
||||||
//update/reset F1sum, F2sum
|
//update/reset F1sum, F2sum
|
||||||
_z = dsp->rot_iqbuf[(dsp->sample_in - _n + dsp->N_IQBUF) % dsp->N_IQBUF];
|
_z = dsp->rot_iqbuf[(dsp->sample_in - _n + dsp->N_IQBUF) % dsp->N_IQBUF];
|
||||||
X1 += _z*cexp(-_tn*2*M_PI*f1*I);
|
X1 += _z*cexp(-_tn*dsp->iw1);
|
||||||
X2 += _z*cexp(-_tn*2*M_PI*f2*I);
|
X2 += _z*cexp(-_tn*dsp->iw2);
|
||||||
_n--;
|
_n--;
|
||||||
}
|
}
|
||||||
dsp->F1sum = X1;
|
dsp->F1sum = X1;
|
||||||
|
@ -1685,3 +1744,4 @@ int find_softbinhead(FILE *fp, hdb_t *hdb, float *score) {
|
||||||
|
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI (3.1415926535897932384626433832795)
|
#define M_PI (3.1415926535897932384626433832795)
|
||||||
#endif
|
#endif
|
||||||
|
#define _2PI (6.2831853071795864769252867665590)
|
||||||
|
|
||||||
|
|
||||||
#define LP_IQ 1
|
#define LP_IQ 1
|
||||||
#define LP_FM 2
|
#define LP_FM 2
|
||||||
|
@ -81,6 +85,10 @@ typedef struct {
|
||||||
float complex *rot_iqbuf;
|
float complex *rot_iqbuf;
|
||||||
float complex F1sum;
|
float complex F1sum;
|
||||||
float complex F2sum;
|
float complex F2sum;
|
||||||
|
//
|
||||||
|
double complex iw1;
|
||||||
|
double complex iw2;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
char *rawbits;
|
char *rawbits;
|
||||||
|
@ -115,8 +123,9 @@ typedef struct {
|
||||||
int decM;
|
int decM;
|
||||||
ui32_t sr_base;
|
ui32_t sr_base;
|
||||||
ui32_t dectaps;
|
ui32_t dectaps;
|
||||||
ui32_t sample_dec;
|
ui32_t sample_decX;
|
||||||
ui32_t lut_len;
|
ui32_t lut_len;
|
||||||
|
ui32_t sample_decM;
|
||||||
float complex *decXbuffer;
|
float complex *decXbuffer;
|
||||||
float complex *decMbuf;
|
float complex *decMbuf;
|
||||||
float complex *ex; // exp_lut
|
float complex *ex; // exp_lut
|
||||||
|
@ -181,3 +190,5 @@ int find_header(dsp_t *, float, int, int, int);
|
||||||
int f32soft_read(FILE *fp, float *s);
|
int f32soft_read(FILE *fp, float *s);
|
||||||
int find_binhead(FILE *fp, hdb_t *hdb, float *score);
|
int find_binhead(FILE *fp, hdb_t *hdb, float *score);
|
||||||
int find_softbinhead(FILE *fp, hdb_t *hdb, float *score);
|
int find_softbinhead(FILE *fp, hdb_t *hdb, float *score);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1707,7 +1707,7 @@ int main(int argc, char **argv) {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
float _frmcnt = -1.0f;
|
float _frmcnt = -1.0f;
|
||||||
|
|
||||||
memset(buffer_rawhex, BUFLEN+1, 0);
|
memset(buffer_rawhex, 0, BUFLEN+1);
|
||||||
|
|
||||||
while ( (ch=fgetc(fp)) != EOF)
|
while ( (ch=fgetc(fp)) != EOF)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,9 +56,11 @@ typedef struct {
|
||||||
|
|
||||||
|
|
||||||
#define BITS (10)
|
#define BITS (10)
|
||||||
#define FRAME_LEN (220)
|
#define STDFRMLEN (220) // 108 byte
|
||||||
|
#define FRAME_LEN (220) //(std=220, 108 byte) (full=440=2*std, 216 byte)
|
||||||
#define BITFRAME_LEN (FRAME_LEN*BITS)
|
#define BITFRAME_LEN (FRAME_LEN*BITS)
|
||||||
|
#define FRMBYTE_STD (108) //(FRAME_LEN-FRAMESTART)/2 = 108
|
||||||
|
// FRAME_FULL = 2*FRAME_STD = 216 ?
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int out;
|
int out;
|
||||||
|
@ -85,7 +87,7 @@ typedef struct {
|
||||||
// shorter header correlation, such that, in mixed signal/noise,
|
// shorter header correlation, such that, in mixed signal/noise,
|
||||||
// signal samples have more weight: header = 0x00 0xAA 0x24 0x24
|
// signal samples have more weight: header = 0x00 0xAA 0x24 0x24
|
||||||
// (in particular for soft bit input!)
|
// (in particular for soft bit input!)
|
||||||
static char imet54_header[] = //"0000000001""0101010101""0000000001""0101010101"
|
static char imet54_header[] = //"0000000001""0101010101""0000000001""0101010101" // 20x 0x00AA
|
||||||
//"0000000001""0101010101""0000000001""0101010101"
|
//"0000000001""0101010101""0000000001""0101010101"
|
||||||
//"0000000001""0101010101""0000000001""0101010101"
|
//"0000000001""0101010101""0000000001""0101010101"
|
||||||
//"0000000001""0101010101""0000000001""0101010101"
|
//"0000000001""0101010101""0000000001""0101010101"
|
||||||
|
@ -227,8 +229,9 @@ static ui8_t hamming(int opt_ecc, ui8_t *cwb, ui8_t *sym) {
|
||||||
static int crc32ok(ui8_t *bytes, int len) {
|
static int crc32ok(ui8_t *bytes, int len) {
|
||||||
ui32_t poly0 = 0x0EDB;
|
ui32_t poly0 = 0x0EDB;
|
||||||
ui32_t poly1 = 0x8260;
|
ui32_t poly1 = 0x8260;
|
||||||
//[105 , 7, 0x8EDB, 0x8260],
|
//[105 , 7, 0x8EDB, 0x8260] // CRC32 802-3 (Ethernet) reversed reciprocal
|
||||||
//[104 , 0, 0x48EB, 0x1ACA]
|
//[104 , 0, 0x48EB, 0x1ACA]
|
||||||
|
//[102 , 0, 0x1DB7, 0x04C1] // CRC32 802-3 (Ethernet) normal
|
||||||
int n = 104;
|
int n = 104;
|
||||||
int b = 0;
|
int b = 0;
|
||||||
ui32_t c0 = 0x48EB;
|
ui32_t c0 = 0x48EB;
|
||||||
|
@ -242,7 +245,7 @@ static int crc32ok(ui8_t *bytes, int len) {
|
||||||
ui32_t crc0 = 0;
|
ui32_t crc0 = 0;
|
||||||
ui32_t crc1 = 0;
|
ui32_t crc1 = 0;
|
||||||
|
|
||||||
if (len < 108) return 0;
|
if (len < 108) return 0; // FRMBYTE_STD=108
|
||||||
|
|
||||||
while (n >= 0) {
|
while (n >= 0) {
|
||||||
|
|
||||||
|
@ -453,7 +456,7 @@ static int reset_gpx(gpx_t *gpx) {
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) {
|
static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps, int ecc_std) {
|
||||||
|
|
||||||
int prnGPS = 0,
|
int prnGPS = 0,
|
||||||
prnPTU = 0,
|
prnPTU = 0,
|
||||||
|
@ -462,7 +465,8 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) {
|
||||||
int tp_err = 0;
|
int tp_err = 0;
|
||||||
int pos_ok = 0,
|
int pos_ok = 0,
|
||||||
frm_ok = 0,
|
frm_ok = 0,
|
||||||
crc_ok = 0;
|
crc_ok = 0,
|
||||||
|
std_ok = 0;
|
||||||
int rs_type = 54;
|
int rs_type = 54;
|
||||||
|
|
||||||
crc_ok = crc32ok(gpx->frame, len);
|
crc_ok = crc32ok(gpx->frame, len);
|
||||||
|
@ -515,8 +519,17 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) {
|
||||||
if (gpx->RH > -0.5f) fprintf(stdout, " RH=%.0f%% ", gpx->RH);
|
if (gpx->RH > -0.5f) fprintf(stdout, " RH=%.0f%% ", gpx->RH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpx->option.vbs) {
|
if ( crc_ok ) fprintf(stdout, " [OK]"); // std frame: frame[104..105]==0x4000 ?
|
||||||
if ( crc_ok ) fprintf(stdout, " [OK]"); else fprintf(stdout, " [NO]");
|
else {
|
||||||
|
if (gpx->frame[pos_F8] == 0xF8) fprintf(stdout, " [NO]");
|
||||||
|
else if ( ecc_std == 0 ) { // full frame: pos_F8_full==pos_F8_std+11 ?
|
||||||
|
fprintf(stdout, " [ok]");
|
||||||
|
std_ok = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout, " [no]");
|
||||||
|
std_ok = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// (imet54:GPS+PTU) status: 003E , (imet50:GPS); 0030
|
// (imet54:GPS+PTU) status: 003E , (imet50:GPS); 0030
|
||||||
|
@ -534,7 +547,7 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// prnGPS,prnTPU
|
// prnGPS,prnTPU
|
||||||
if (gpx->option.jsn && frm_ok && crc_ok && (gpx->status&0x30)==0x30) {
|
if (gpx->option.jsn && frm_ok && (crc_ok || std_ok) && (gpx->status&0x30)==0x30) {
|
||||||
char *ver_jsn = NULL;
|
char *ver_jsn = NULL;
|
||||||
char *subtype = (rs_type == 54) ? "IMET54" : "IMET50";
|
char *subtype = (rs_type == 54) ? "IMET54" : "IMET50";
|
||||||
unsigned long count_day = (unsigned long)(gpx->std*3600 + gpx->min*60 + gpx->sek+0.5); // (gpx->timems/1e3+0.5) has gaps
|
unsigned long count_day = (unsigned long)(gpx->std*3600 + gpx->min*60 + gpx->sek+0.5); // (gpx->timems/1e3+0.5) has gaps
|
||||||
|
@ -572,7 +585,7 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) {
|
||||||
|
|
||||||
static void print_frame(gpx_t *gpx, int len, int b2B) {
|
static void print_frame(gpx_t *gpx, int len, int b2B) {
|
||||||
int i, j;
|
int i, j;
|
||||||
int ecc_frm = 0, ecc_gps = 0;
|
int ecc_frm = 0, ecc_gps = 0, ecc_std = 0;
|
||||||
ui8_t bits8n1[BITFRAME_LEN+10]; // (RAW)BITFRAME_LEN
|
ui8_t bits8n1[BITFRAME_LEN+10]; // (RAW)BITFRAME_LEN
|
||||||
ui8_t bits[BITFRAME_LEN]; // 8/10 (RAW)BITFRAME_LEN
|
ui8_t bits[BITFRAME_LEN]; // 8/10 (RAW)BITFRAME_LEN
|
||||||
ui8_t nib[FRAME_LEN];
|
ui8_t nib[FRAME_LEN];
|
||||||
|
@ -600,12 +613,15 @@ static void print_frame(gpx_t *gpx, int len, int b2B) {
|
||||||
|
|
||||||
ecc_frm = 0;
|
ecc_frm = 0;
|
||||||
ecc_gps = 0;
|
ecc_gps = 0;
|
||||||
|
ecc_std = 0;
|
||||||
for (j = 0; j < len/8; j++) { // alt. only GPS block
|
for (j = 0; j < len/8; j++) { // alt. only GPS block
|
||||||
ecc_frm += ec[j];
|
ecc_frm += ec[j];
|
||||||
if (ec[j] > 0x10) ecc_frm = -1;
|
if (ec[j] > 0x10) ecc_frm = -1;
|
||||||
if (j < pos_GPSalt+4+8) ecc_gps = ecc_frm;
|
if (j < pos_GPSalt+4+8) ecc_gps = ecc_frm;
|
||||||
|
if (j < 2*FRMBYTE_STD) ecc_std = ecc_frm;
|
||||||
if (ecc_frm < 0) break;
|
if (ecc_frm < 0) break;
|
||||||
}
|
}
|
||||||
|
if (j < 2*FRMBYTE_STD) ecc_std = -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ecc_frm = -2; // TODO: parse ecc-info from raw file
|
ecc_frm = -2; // TODO: parse ecc-info from raw file
|
||||||
|
@ -614,6 +630,8 @@ static void print_frame(gpx_t *gpx, int len, int b2B) {
|
||||||
|
|
||||||
if (gpx->option.raw)
|
if (gpx->option.raw)
|
||||||
{
|
{
|
||||||
|
int crc_ok = crc32ok(gpx->frame, len);
|
||||||
|
|
||||||
for (i = 0; i < len/16; i++) {
|
for (i = 0; i < len/16; i++) {
|
||||||
fprintf(stdout, "%02X", gpx->frame[i]);
|
fprintf(stdout, "%02X", gpx->frame[i]);
|
||||||
if (gpx->option.raw > 1)
|
if (gpx->option.raw > 1)
|
||||||
|
@ -622,7 +640,13 @@ static void print_frame(gpx_t *gpx, int len, int b2B) {
|
||||||
if (gpx->option.raw == 4 && i % 4 == 3) fprintf(stdout, " ");
|
if (gpx->option.raw == 4 && i % 4 == 3) fprintf(stdout, " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( crc32ok(gpx->frame, len) ) fprintf(stdout, " [OK]"); else fprintf(stdout, " [NO]");
|
|
||||||
|
if ( crc_ok ) fprintf(stdout, " [OK]"); // std frame: frame[104..105]==0x4000 ?
|
||||||
|
else {
|
||||||
|
if (gpx->frame[pos_F8] == 0xF8) fprintf(stdout, " [NO]"); // full frame: pos_F8_full==pos_F8_std+11 ?
|
||||||
|
else if ( ecc_std == 0 ) fprintf(stdout, " [ok]");
|
||||||
|
else fprintf(stdout, " [no]");
|
||||||
|
}
|
||||||
if (gpx->option.ecc && ecc_frm != 0) {
|
if (gpx->option.ecc && ecc_frm != 0) {
|
||||||
fprintf(stdout, " # (%d)", ecc_frm);
|
fprintf(stdout, " # (%d)", ecc_frm);
|
||||||
fprintf(stdout, " [%d]", ecc_gps);
|
fprintf(stdout, " [%d]", ecc_gps);
|
||||||
|
@ -630,12 +654,12 @@ static void print_frame(gpx_t *gpx, int len, int b2B) {
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
|
|
||||||
if (gpx->option.slt /*&& gpx->option.jsn*/) {
|
if (gpx->option.slt /*&& gpx->option.jsn*/) {
|
||||||
print_position(gpx, len/16, ecc_frm, ecc_gps);
|
print_position(gpx, len/16, ecc_frm, ecc_gps, ecc_std);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_position(gpx, len/16, ecc_frm, ecc_gps);
|
print_position(gpx, len/16, ecc_frm, ecc_gps, ecc_std);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1522,7 +1522,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
while (1 > 0) {
|
while (1 > 0) {
|
||||||
|
|
||||||
memset(buffer_rawhex, 2*(FRAME_LEN+AUX_LEN)+12, 0);
|
memset(buffer_rawhex, 0, 2*(FRAME_LEN+AUX_LEN)+12);
|
||||||
pbuf = fgets(buffer_rawhex, 2*(FRAME_LEN+AUX_LEN)+12, fp);
|
pbuf = fgets(buffer_rawhex, 2*(FRAME_LEN+AUX_LEN)+12, fp);
|
||||||
if (pbuf == NULL) break;
|
if (pbuf == NULL) break;
|
||||||
buffer_rawhex[2*(FRAME_LEN+AUX_LEN)] = '\0';
|
buffer_rawhex[2*(FRAME_LEN+AUX_LEN)] = '\0';
|
||||||
|
|
|
@ -751,12 +751,12 @@ static int print_pos(gpx_t *gpx, int bcOK, int csOK) {
|
||||||
fprintf(stdout, " lon: "col_GPSlon"%.5f"col_TXT" ", gpx->lon);
|
fprintf(stdout, " lon: "col_GPSlon"%.5f"col_TXT" ", gpx->lon);
|
||||||
fprintf(stdout, " alt: "col_GPSalt"%.2f"col_TXT" ", gpx->alt);
|
fprintf(stdout, " alt: "col_GPSalt"%.2f"col_TXT" ", gpx->alt);
|
||||||
if (!err2) {
|
if (!err2) {
|
||||||
fprintf(stdout, " vH: "col_GPSvel"%.1f"col_TXT" D: "col_GPSvel"%.1f"col_TXT" vV: "col_GPSvel"%.1f"col_TXT" ", gpx->vH, gpx->vD, gpx->vV);
|
fprintf(stdout, " vH: "col_GPSvel"%4.1f"col_TXT" D: "col_GPSvel"%5.1f"col_TXT" vV: "col_GPSvel"%3.1f"col_TXT" ", gpx->vH, gpx->vD, gpx->vV);
|
||||||
}
|
}
|
||||||
if (gpx->option.vbs >= 2 && (bcOK || csOK)) { // SN
|
if (gpx->option.vbs >= 1 && (bcOK || csOK)) { // SN
|
||||||
fprintf(stdout, " SN: "col_SN"%s"col_TXT, gpx->SN);
|
fprintf(stdout, " SN: "col_SN"%s"col_TXT, gpx->SN);
|
||||||
}
|
}
|
||||||
if (gpx->option.vbs >= 2) {
|
if (gpx->option.vbs >= 1) {
|
||||||
fprintf(stdout, " # ");
|
fprintf(stdout, " # ");
|
||||||
if (bcOK > 0) fprintf(stdout, " "col_CSok"(ok)"col_TXT);
|
if (bcOK > 0) fprintf(stdout, " "col_CSok"(ok)"col_TXT);
|
||||||
else if (bcOK < 0) fprintf(stdout, " "col_CSoo"(oo)"col_TXT);
|
else if (bcOK < 0) fprintf(stdout, " "col_CSoo"(oo)"col_TXT);
|
||||||
|
@ -769,7 +769,9 @@ static int print_pos(gpx_t *gpx, int bcOK, int csOK) {
|
||||||
fprintf(stdout, " ");
|
fprintf(stdout, " ");
|
||||||
if (gpx->T > -273.0f) fprintf(stdout, " T:%.1fC", gpx->T);
|
if (gpx->T > -273.0f) fprintf(stdout, " T:%.1fC", gpx->T);
|
||||||
if (gpx->RH > -0.5f) fprintf(stdout, " RH=%.0f%%", gpx->RH);
|
if (gpx->RH > -0.5f) fprintf(stdout, " RH=%.0f%%", gpx->RH);
|
||||||
if (gpx->TH > -273.0f) fprintf(stdout, " TH:%.1fC", gpx->TH);
|
if (gpx->option.vbs >= 2) {
|
||||||
|
if (gpx->TH > -273.0f) fprintf(stdout, " TH:%.1fC", gpx->TH);
|
||||||
|
}
|
||||||
if (gpx->P > 0.0f) {
|
if (gpx->P > 0.0f) {
|
||||||
if (gpx->P < 100.0f) fprintf(stdout, " P=%.2fhPa ", gpx->P);
|
if (gpx->P < 100.0f) fprintf(stdout, " P=%.2fhPa ", gpx->P);
|
||||||
else fprintf(stdout, " P=%.1fhPa ", gpx->P);
|
else fprintf(stdout, " P=%.1fhPa ", gpx->P);
|
||||||
|
@ -789,12 +791,12 @@ static int print_pos(gpx_t *gpx, int bcOK, int csOK) {
|
||||||
fprintf(stdout, " lon: %.5f ", gpx->lon);
|
fprintf(stdout, " lon: %.5f ", gpx->lon);
|
||||||
fprintf(stdout, " alt: %.2f ", gpx->alt);
|
fprintf(stdout, " alt: %.2f ", gpx->alt);
|
||||||
if (!err2) {
|
if (!err2) {
|
||||||
fprintf(stdout, " vH: %.1f D: %.1f vV: %.1f ", gpx->vH, gpx->vD, gpx->vV);
|
fprintf(stdout, " vH: %4.1f D: %5.1f vV: %3.1f ", gpx->vH, gpx->vD, gpx->vV);
|
||||||
}
|
}
|
||||||
if (gpx->option.vbs >= 2 && (bcOK || csOK)) { // SN
|
if (gpx->option.vbs >= 1 && (bcOK || csOK)) { // SN
|
||||||
fprintf(stdout, " SN: %s", gpx->SN);
|
fprintf(stdout, " SN: %s", gpx->SN);
|
||||||
}
|
}
|
||||||
if (gpx->option.vbs >= 2) {
|
if (gpx->option.vbs >= 1) {
|
||||||
fprintf(stdout, " # ");
|
fprintf(stdout, " # ");
|
||||||
//if (bcOK) fprintf(stdout, " (ok)"); else fprintf(stdout, " (no)");
|
//if (bcOK) fprintf(stdout, " (ok)"); else fprintf(stdout, " (no)");
|
||||||
if (bcOK > 0) fprintf(stdout, " (ok)");
|
if (bcOK > 0) fprintf(stdout, " (ok)");
|
||||||
|
@ -807,7 +809,9 @@ static int print_pos(gpx_t *gpx, int bcOK, int csOK) {
|
||||||
fprintf(stdout, " ");
|
fprintf(stdout, " ");
|
||||||
if (gpx->T > -273.0f) fprintf(stdout, " T:%.1fC", gpx->T);
|
if (gpx->T > -273.0f) fprintf(stdout, " T:%.1fC", gpx->T);
|
||||||
if (gpx->RH > -0.5f) fprintf(stdout, " RH=%.0f%%", gpx->RH);
|
if (gpx->RH > -0.5f) fprintf(stdout, " RH=%.0f%%", gpx->RH);
|
||||||
if (gpx->TH > -273.0f) fprintf(stdout, " TH:%.1fC", gpx->TH);
|
if (gpx->option.vbs >= 2) {
|
||||||
|
if (gpx->TH > -273.0f) fprintf(stdout, " TH:%.1fC", gpx->TH);
|
||||||
|
}
|
||||||
if (gpx->P > 0.0f) {
|
if (gpx->P > 0.0f) {
|
||||||
if (gpx->P < 100.0f) fprintf(stdout, " P=%.2fhPa ", gpx->P);
|
if (gpx->P < 100.0f) fprintf(stdout, " P=%.2fhPa ", gpx->P);
|
||||||
else fprintf(stdout, " P=%.1fhPa ", gpx->P);
|
else fprintf(stdout, " P=%.1fhPa ", gpx->P);
|
||||||
|
@ -1323,6 +1327,7 @@ int main(int argc, char **argv) {
|
||||||
header_found = 0;
|
header_found = 0;
|
||||||
|
|
||||||
// bis Ende der Sekunde vorspulen; allerdings Doppel-Frame alle 10 sek
|
// bis Ende der Sekunde vorspulen; allerdings Doppel-Frame alle 10 sek
|
||||||
|
// M20 only single frame ... AUX ?
|
||||||
if (gpx.option.vbs < 3) { // && (regulare frame) // print_frame-return?
|
if (gpx.option.vbs < 3) { // && (regulare frame) // print_frame-return?
|
||||||
while ( bitpos < 5*BITFRAME_LEN ) {
|
while ( bitpos < 5*BITFRAME_LEN ) {
|
||||||
if (option_softin) {
|
if (option_softin) {
|
||||||
|
@ -1355,7 +1360,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
while (1 > 0) {
|
while (1 > 0) {
|
||||||
|
|
||||||
memset(buffer_rawhex, 2*(FRAME_LEN+AUX_LEN)+12, 0);
|
memset(buffer_rawhex, 0, 2*(FRAME_LEN+AUX_LEN)+12);
|
||||||
pbuf = fgets(buffer_rawhex, 2*(FRAME_LEN+AUX_LEN)+12, fp);
|
pbuf = fgets(buffer_rawhex, 2*(FRAME_LEN+AUX_LEN)+12, fp);
|
||||||
if (pbuf == NULL) break;
|
if (pbuf == NULL) break;
|
||||||
buffer_rawhex[2*(FRAME_LEN+AUX_LEN)] = '\0';
|
buffer_rawhex[2*(FRAME_LEN+AUX_LEN)] = '\0';
|
||||||
|
|
|
@ -702,7 +702,7 @@ int main(int argc, char **argv) {
|
||||||
if (!option2 && !option_raw) {
|
if (!option2 && !option_raw) {
|
||||||
jmpRS11:
|
jmpRS11:
|
||||||
if (reset_gpx) {
|
if (reset_gpx) {
|
||||||
memset(&gpx, sizeof(gpx), 0);
|
memset(&gpx, 0, sizeof(gpx));
|
||||||
sn = -1;
|
sn = -1;
|
||||||
freq = -1;
|
freq = -1;
|
||||||
reset_gpx = 0;
|
reset_gpx = 0;
|
||||||
|
@ -867,7 +867,7 @@ int main(int argc, char **argv) {
|
||||||
else if (option2 && !option_raw) { // iMS-100
|
else if (option2 && !option_raw) { // iMS-100
|
||||||
jmpIMS:
|
jmpIMS:
|
||||||
if (reset_gpx) {
|
if (reset_gpx) {
|
||||||
memset(&gpx, sizeof(gpx), 0);
|
memset(&gpx, 0, sizeof(gpx));
|
||||||
gpx.RH = NAN;
|
gpx.RH = NAN;
|
||||||
gpx.T = NAN;
|
gpx.T = NAN;
|
||||||
sn = -1;
|
sn = -1;
|
||||||
|
|
|
@ -2122,7 +2122,10 @@ static int print_position(gpx_t *gpx, int ec) {
|
||||||
if (gpx->option.ptu) out_mask |= crc_PTU;
|
if (gpx->option.ptu) out_mask |= crc_PTU;
|
||||||
|
|
||||||
err = get_FrameConf(gpx, 0);
|
err = get_FrameConf(gpx, 0);
|
||||||
if (out && !err) prn_frm(gpx);
|
if (out && !err) {
|
||||||
|
prn_frm(gpx);
|
||||||
|
output = 1;
|
||||||
|
}
|
||||||
|
|
||||||
pck = (gpx->frame[pos_PTU]<<8) | gpx->frame[pos_PTU+1];
|
pck = (gpx->frame[pos_PTU]<<8) | gpx->frame[pos_PTU+1];
|
||||||
ofs = 0;
|
ofs = 0;
|
||||||
|
|
Ładowanie…
Reference in New Issue