kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
				
				
				
			rs41: framelen an SNR erkennen
							rodzic
							
								
									837510451b
								
							
						
					
					
						commit
						00427a5698
					
				| 
						 | 
				
			
			@ -1125,7 +1125,7 @@ int main(int argc, char *argv[]) {
 | 
			
		|||
        frmlen = FRAME_LEN;
 | 
			
		||||
 | 
			
		||||
    int sumQ, bitQ, Qerror_count;
 | 
			
		||||
    double ratioQ, ratioQ0;
 | 
			
		||||
    double ratioQ;
 | 
			
		||||
 | 
			
		||||
#ifdef CYGWIN
 | 
			
		||||
    _setmode(fileno(stdin), _O_BINARY);  // _fileno(stdin)
 | 
			
		||||
| 
						 | 
				
			
			@ -1238,13 +1238,12 @@ int main(int argc, char *argv[]) {
 | 
			
		|||
        if (header_found && option_b) {
 | 
			
		||||
            bitstart = 1;
 | 
			
		||||
            sumQ = 0;
 | 
			
		||||
            ratioQ0 = 0;
 | 
			
		||||
            Qerror_count = 0;
 | 
			
		||||
 | 
			
		||||
            while ( byte_count < frmlen ) {
 | 
			
		||||
                bitQ = read_rawbit(fp, &bit);
 | 
			
		||||
                bitQ = read_rawbit(fp, &bit); // return: zeroX/bit (oder alternativ Varianz/bit)
 | 
			
		||||
                if ( bitQ == EOF) break;
 | 
			
		||||
                sumQ += bitQ;
 | 
			
		||||
                sumQ += bitQ; // zeroX/byte
 | 
			
		||||
                bitbuf[bit_count] = bit;
 | 
			
		||||
                bit_count++;
 | 
			
		||||
                if (bit_count == 8) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1254,20 +1253,18 @@ int main(int argc, char *argv[]) {
 | 
			
		|||
                    frame[byte_count] = byte ^ mask[byte_count % MASK_LEN];
 | 
			
		||||
                    byte_count++;
 | 
			
		||||
 | 
			
		||||
                    ratioQ0 = ratioQ;
 | 
			
		||||
                    ratioQ = sumQ/samples_per_bit;
 | 
			
		||||
                    //printf("# %3d  sumQ: %d  sumQ/(samples/bit): %.1f\n", byte_count-1, sumQ, sumQ/samples_per_bit);
 | 
			
		||||
                    if (byte_count > NDATA_LEN) {
 | 
			
		||||
                        if (ratioQ > 0.7  && ratioQ0 > 0.7) {
 | 
			
		||||
                    ratioQ = sumQ/samples_per_bit; // approx: bei Rauschen zeroX/byte leider nicht linear in sample_rate
 | 
			
		||||
                    if (byte_count > NDATA_LEN) { // Fehler erst ab minimaler framelen Zaehlen
 | 
			
		||||
                        if (ratioQ > 0.7) {       // Schwelle, ab wann wahrscheinlich Rauschbit
 | 
			
		||||
                            Qerror_count += 1;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    sumQ = 0;
 | 
			
		||||
                    sumQ = 0; // Fenster fuer zeroXcount: 8 bit
 | 
			
		||||
                }
 | 
			
		||||
                if (Qerror_count > 4) {
 | 
			
		||||
                if (Qerror_count > 4) {   // ab byte 320 entscheiden, ob framelen = 320 oder 518
 | 
			
		||||
                    if (byte_count > NDATA_LEN  && byte_count < NDATA_LEN+XDATA_LEN-10) {
 | 
			
		||||
                        byte_count = NDATA_LEN;
 | 
			
		||||
                    }
 | 
			
		||||
                    } // in print_frame() wird ab byte_count mit 00 aufgefuellt fuer Fehlerkorrektur
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												Plik diff jest za duży
												Load Diff
											
										
									
								
							
		Ładowanie…
	
		Reference in New Issue