diff --git a/demod/multi/demod_base.c b/demod/multi/demod_base.c index 3e39b1f..dea34a6 100644 --- a/demod/multi/demod_base.c +++ b/demod/multi/demod_base.c @@ -932,18 +932,20 @@ static int headcmp(dsp_t *dsp, int opt_dc) { //if (opt_dc == 0 || dsp->opt_iq > 1) dsp->dc = 0; // reset? e.g. 2nd pass - if (dsp->symhd != 1) step = 2; + if (dsp->symhd != 1) step = 2; // step == symhd if (inv) sign=1; for (pos = 0; pos < len; pos++) { // L = dsp->hdrlen * dsp->sps + 0.5; //read_bufbit(dsp, dsp->symhd, dsp->rawbits+pos*step, mvp+1-(int)(len*dsp->sps), pos); read_bufbit(dsp, dsp->symhd, dsp->rawbits+pos*step, dsp->mv_pos+1-dsp->L, pos); } + + pos = len*step; // == hdrlen dsp->rawbits[pos] = '\0'; - while (len > 0) { - if ((dsp->rawbits[len-1]^sign) != dsp->hdr[len-1]) errs += 1; - len--; + while (pos > 0) { + if ((dsp->rawbits[pos-1]^sign) != dsp->hdr[pos-1]) errs += 1; + pos--; } return errs; diff --git a/demod/multi/dfm09base.c b/demod/multi/dfm09base.c index 538c49a..5a66ceb 100644 --- a/demod/multi/dfm09base.c +++ b/demod/multi/dfm09base.c @@ -99,7 +99,7 @@ typedef struct { double dir; double horiV; double vertV; double lat2; double lon2; double alt2; double dir2; double horiV2; double vertV2; - //float T; + float T; float Rf; float _frmcnt; float meas24[9]; @@ -615,6 +615,7 @@ static int reset_cfgchk(gpx_t *gpx) { gpx->ptu_out = 0; //gpx->gps.dMSL = 0; *gpx->SN_out = '\0'; + gpx->T = -273.15f; return 0; } @@ -871,6 +872,18 @@ static int print_gpx(gpx_t *gpx) { gpx->prev_cntsec_diff = cntsec_diff; gpx->prev_manpol = gpx->option.inv; } + + gpx->T = -273.15f; + if (gpx->cfgchk && gpx->ptu_out) + { + gpx->T = get_Temp(gpx); + if (gpx->T < -270.0f && gpx->dfmtyp != DFM_types[UNDEF]) { + if ((gpx->sonde_typ & 0xF) == 0x8 || (gpx->sonde_typ & 0xF) == 0xC) + { + gpx->dfmtyp = DFM_types[UNKNW]; + } + } + } } if (output & 0xF000) { @@ -902,16 +915,16 @@ static int print_gpx(gpx_t *gpx) { if (gpx->cfgchk) { if (gpx->option.ptu && gpx->ptu_out) { - float t = get_Temp(gpx); - if (t > -270.0) { - printf(" T=%.1fC ", t); // 0xC:P+ DFM-09P , 0xC:T- DFM-17TU , 0xD:P- DFM-17P ? + //float t = get_Temp(gpx); + if (gpx->T > -270.0f) { + printf(" T=%.1fC ", gpx->T); // 0xC:P+ DFM-09P , 0xC:T- DFM-17TU , 0xD:P- DFM-17P ? if (gpx->option.vbs == 3) printf(" (0x%X:%c%c) ", gpx->sonde_typ & 0xF, gpx->sensortyp, gpx->option.inv?'-':'+'); } if (gpx->option.dbg) { float t2 = get_Temp2(gpx); float t4 = get_Temp4(gpx); - if (t2 > -270.0) printf(" T2=%.1fC ", t2); - if (t4 > -270.0) printf(" T4=%.1fC ", t4); + if (t2 > -270.0f) printf(" T2=%.1fC ", t2); + if (t4 > -270.0f) printf(" T4=%.1fC ", t4); } } if (gpx->option.vbs == 3 && gpx->ptu_out >= 0xA) { @@ -1013,8 +1026,8 @@ static int print_gpx(gpx_t *gpx) { printf(", \"batt\": %.2f", gpx->status[0]); } if (gpx->ptu_out) { // get temperature - float t = get_Temp(gpx); // ecc-valid temperature? - if (t > -270.0) printf(", \"temp\": %.1f", t); + //float t = get_Temp(gpx); // ecc-valid temperature? + if (gpx->T > -270.0f) printf(", \"temp\": %.1f", gpx->T); } if (gpx->posmode == 4 && contaux && gpx->xdata[0]) { char xdata_str[2*XDATA_LEN+1]; diff --git a/demod/multi/m10base.c b/demod/multi/m10base.c index 1afc4a6..99aa83a 100644 --- a/demod/multi/m10base.c +++ b/demod/multi/m10base.c @@ -1102,7 +1102,7 @@ static int print_frame(gpx_t *gpx, int pos, dsp_t *dsp) { } fprintf(stdout, "\n"); } - if (gpx->option.slt /*&& gpx->option.jsn*/) { + if (gpx->frame_bytes[1] != 0x49 && gpx->option.slt /*&& gpx->option.jsn*/) { print_pos(gpx, cs1 == cs2); } } @@ -1112,6 +1112,7 @@ static int print_frame(gpx_t *gpx, int pos, dsp_t *dsp) { byte = gpx->frame_bytes[i]; fprintf(stdout, "%02x", byte); } + if (cs1 == cs2) fprintf(stdout, " [OK]"); else fprintf(stdout, " [NO]"); fprintf(stdout, "\n"); } } diff --git a/demod/multi/m20base.c b/demod/multi/m20base.c index d2ff67c..52f7d7f 100644 --- a/demod/multi/m20base.c +++ b/demod/multi/m20base.c @@ -921,7 +921,7 @@ static int print_frame(gpx_t *gpx, int pos, dsp_t *dsp) { } fprintf(stdout, "\n"); } - if (gpx->option.slt /*&& gpx->option.jsn*/) { + if (gpx->option.slt /*&& gpx->option.jsn && gpx->frame_bytes[1] != 0x49*/) { print_pos(gpx, bc, cs1 == cs2); } } @@ -932,6 +932,7 @@ static int print_frame(gpx_t *gpx, int pos, dsp_t *dsp) { byte = gpx->frame_bytes[i]; fprintf(stdout, "%02x", byte); } + if (cs1 == cs2) fprintf(stdout, " [OK]"); else fprintf(stdout, " [NO]"); fprintf(stdout, "\n"); } }