From bbb432274e3978d286f9d3d336c6349c52a5cc75 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Fri, 31 May 2024 19:43:49 +0930 Subject: [PATCH] Add support for WxR-301 PN9 variant --- auto_rx/autorx/__init__.py | 2 +- auto_rx/autorx/config.py | 3 +- auto_rx/autorx/decode.py | 76 +++++++++++++++++++++- auto_rx/autorx/scan.py | 9 +++ auto_rx/autorx/sondehub.py | 10 +++ auto_rx/autorx/templates/index.html | 1 + auto_rx/autorx/utils.py | 4 ++ scan/dft_detect.c | 53 +++++++++------- weathex/weathex301d.c | 98 +++++++++++++++++------------ 9 files changed, 188 insertions(+), 68 deletions(-) diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index 1c75940..22d92de 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -12,7 +12,7 @@ from queue import Queue # MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus. # PATCH - Small changes, or minor feature additions. -__version__ = "1.7.3-beta11" +__version__ = "1.7.3-beta12" # Global Variables diff --git a/auto_rx/autorx/config.py b/auto_rx/autorx/config.py index e291747..faf6d54 100644 --- a/auto_rx/autorx/config.py +++ b/auto_rx/autorx/config.py @@ -428,7 +428,8 @@ def read_auto_rx_config(filename, no_sdr_test=False): "MEISEI": True, "MTS01": False, # Until we test it "MRZ": False, # .... except for the MRZ, until we know it works. - "WXR301": True, # No fsk_demod chain for this yet. + "WXR301": True, + "WXRPN9": True, "UDP": False, } diff --git a/auto_rx/autorx/decode.py b/auto_rx/autorx/decode.py index 85f859a..639b5b9 100644 --- a/auto_rx/autorx/decode.py +++ b/auto_rx/autorx/decode.py @@ -40,7 +40,8 @@ VALID_SONDE_TYPES = [ "MRZ", "MTS01", "UDP", - "WXR301" + "WXR301", + "WXRPN9" ] # Known 'Drifty' Radiosonde types @@ -120,7 +121,8 @@ class SondeDecoder(object): "MRZ", "MTS01", "UDP", - "WXR301" + "WXR301", + "WXRPN9" ] def __init__( @@ -762,7 +764,31 @@ class SondeDecoder(object): # WXR301, via iq_dec as a FM Demod. decode_cmd += f"./iq_dec --FM --IFbw {_if_bw} --lpFM --wav --iq 0.0 - {_sample_rate} 16 2>/dev/null | ./weathex301d -b --json" + elif self.sonde_type == "WXRPN9": + # Weathex WxR-301D (PN9) + + _sample_rate = 96000 + _if_bw = 64 + decode_cmd = get_sdr_iq_cmd( + sdr_type = self.sdr_type, + frequency = self.sonde_freq, + sample_rate = _sample_rate, + sdr_hostname = self.sdr_hostname, + sdr_port = self.sdr_port, + ss_iq_path = self.ss_iq_path, + rtl_device_idx = self.rtl_device_idx, + ppm = self.ppm, + gain = self.gain, + bias = self.bias + ) + + # Add in tee command to save IQ to disk if debugging is enabled. + if self.save_decode_iq: + decode_cmd += f" tee {self.save_decode_iq_path} |" + + # WXR301, via iq_dec as a FM Demod. + decode_cmd += f"./iq_dec --FM --IFbw {_if_bw} --lpFM --wav --iq 0.0 - {_sample_rate} 16 2>/dev/null | ./weathex301d -b --json --pn9" elif self.sonde_type == "UDP": # UDP Input Mode. @@ -1313,6 +1339,50 @@ class SondeDecoder(object): demod_stats = FSKDemodStats(averaging_time=5.0, peak_hold=True) self.rx_frequency = self.sonde_freq + elif self.sonde_type == "WXRPN9": + # Weathex WxR-301D Sonde, PN9 variant + + _baud_rate = 4800 + _sample_rate = 96000 + + # Limit FSK estimator window to roughly +/- 40 kHz + _lower = -40000 + _upper = 40000 + + demod_cmd = get_sdr_iq_cmd( + sdr_type = self.sdr_type, + frequency = self.sonde_freq, + sample_rate = _sample_rate, + sdr_hostname = self.sdr_hostname, + sdr_port = self.sdr_port, + ss_iq_path = self.ss_iq_path, + rtl_device_idx = self.rtl_device_idx, + ppm = self.ppm, + gain = self.gain, + bias = self.bias, + dc_block = True + ) + + # Add in tee command to save IQ to disk if debugging is enabled. + if self.save_decode_iq: + demod_cmd += f" tee {self.save_decode_iq_path} |" + + # Trying out using the mask estimator here to reduce issues with interference + demod_cmd += "./fsk_demod --cs16 -s -b %d -u %d --mask 60000 --stats=%d 2 %d %d - -" % ( + _lower, + _upper, + _stats_rate, + _sample_rate, + _baud_rate, + ) + + # Soft-decision decoding, inverted. + decode_cmd = f"./weathex301d --softin -i --json --pn9 2>/dev/null" + + # Weathex sondes transmit continuously - average over the last frame, and use a peak hold + demod_stats = FSKDemodStats(averaging_time=5.0, peak_hold=True) + self.rx_frequency = self.sonde_freq + else: return None @@ -1700,7 +1770,7 @@ class SondeDecoder(object): # Weathex Specific Actions # Same datetime issues as with iMets, and LMS6 - if self.sonde_type == "WXR301": + if (self.sonde_type == "WXR301") or (self.sonde_type == "WXRPN9"): # Fix up the time. _telemetry["datetime_dt"] = fix_datetime(_telemetry["datetime"]) # Re-generate the datetime string. diff --git a/auto_rx/autorx/scan.py b/auto_rx/autorx/scan.py index fe040da..d571f4b 100644 --- a/auto_rx/autorx/scan.py +++ b/auto_rx/autorx/scan.py @@ -620,6 +620,15 @@ def detect_sonde( # to do no whitening on the signal. _offset_est = 0.0 + elif "WXRPN9" in _type: + logging.debug( + "Scanner (%s) - Detected a Weathex WxR-301D Sonde (PN9 Variant)! (Score: %.2f, Offset: %.1f Hz)" + % (_sdr_name, _score, _offset_est) + ) + _sonde_type = "WXRPN9" + # Clear out the offset estimate for WxR-301's as it's not accurate + # to do no whitening on the signal. + _offset_est = 0.0 else: _sonde_type = None diff --git a/auto_rx/autorx/sondehub.py b/auto_rx/autorx/sondehub.py index 296ce35..e5137dd 100644 --- a/auto_rx/autorx/sondehub.py +++ b/auto_rx/autorx/sondehub.py @@ -233,6 +233,16 @@ class SondehubUploader(object): _output["type"] = "WxR-301D" _output["serial"] = telemetry["id"].split("-")[1] + # Double check for the subtype being present, just in case... + if "subtype" in telemetry: + if telemetry["subtype"] == "WXR_PN9": + _output["type"] = "WxR-301D (PN9)" + + elif telemetry["type"] == "WXRPN9": + _output["manufacturer"] = "Weathex" + _output["type"] = "WxR-301D (PN9)" + _output["serial"] = telemetry["id"].split("-")[1] + else: self.log_error("Unknown Radiosonde Type %s" % telemetry["type"]) return None diff --git a/auto_rx/autorx/templates/index.html b/auto_rx/autorx/templates/index.html index 8b4b2be..f03c0e0 100644 --- a/auto_rx/autorx/templates/index.html +++ b/auto_rx/autorx/templates/index.html @@ -1665,6 +1665,7 @@ +
diff --git a/auto_rx/autorx/utils.py b/auto_rx/autorx/utils.py index 9c789f0..ac5f3c5 100644 --- a/auto_rx/autorx/utils.py +++ b/auto_rx/autorx/utils.py @@ -212,6 +212,8 @@ def short_type_lookup(type_name): return "Meteosis MTS01" elif type_name == "WXR301": return "Weathex WxR-301D" + elif type_name == "WXRPN9": + return "Weathex WxR-301D (PN9 Variant)" else: return "Unknown" @@ -256,6 +258,8 @@ def short_short_type_lookup(type_name): return "MTS01" elif type_name == "WXR301": return "WXR301" + elif type_name == "WXRPN9": + return "WXR301(PN9)" else: return "Unknown" diff --git a/scan/dft_detect.c b/scan/dft_detect.c index 32ea4cd..ea39222 100644 --- a/scan/dft_detect.c +++ b/scan/dft_detect.c @@ -116,6 +116,10 @@ static char weathex_header[] = "10101010""10101010""10101010" // AA AA AA (preamble) "00101101""11010100"; //"10101010"; // 2D D4 55/AA +static char wxr2pn9_header[] = + "10101010""10101010""10101010" // AA AA AA (preamble) + "11000001""10010100"; //"11000001"; // C1 94 C1 + typedef struct { int sps; // header: symbol rate, baud @@ -140,28 +144,29 @@ static float lpFM_bw[2] = { 4e3, 10e3 }; // FM-audio lowpass bandwidth static float lpIQ_bw[N_bwIQ] = { 6e3, 12e3, 22e3, 200e3 }; // IF iq lowpass bandwidth static float set_lpIQ = 0.0; -#define tn_DFM 2 -#define tn_RS41 3 -#define tn_RS92 4 -#define tn_M10 5 -#define tn_M20 6 -#define tn_LMS6 8 -#define tn_MEISEI 9 -#define tn_MRZ 12 -#define tn_MTS01 13 -#define tn_C34C50 15 -#define tn_WXR301 16 -#define tn_MK2LMS 18 -#define tn_IMET5 24 -#define tn_IMETa 25 -#define tn_IMET4 26 -#define tn_IMET1rs 28 -#define tn_IMET1ab 29 +#define tn_DFM 2 +#define tn_RS41 3 +#define tn_RS92 4 +#define tn_M10 5 +#define tn_M20 6 +#define tn_LMS6 8 +#define tn_MEISEI 9 +#define tn_MRZ 12 +#define tn_MTS01 13 +#define tn_C34C50 15 +#define tn_WXR301 16 +#define tn_WXRpn9 17 +#define tn_MK2LMS 18 +#define tn_IMET5 24 +#define tn_IMETa 25 +#define tn_IMET4 26 +#define tn_IMET1rs 28 +#define tn_IMET1ab 29 -#define Nrs 16 -#define idxIMETafsk 13 -#define idxRS 14 -#define idxI4 15 +#define Nrs 17 +#define idxIMETafsk 14 +#define idxRS 15 +#define idxI4 16 static rsheader_t rs_hdr[Nrs] = { { 2500, 0, 0, dfm_header, 1.0, 0.0, 0.65, 2, NULL, "DFM9", tn_DFM, 0, 1, 0.0, 0.0}, // DFM6: -2 ? { 4800, 0, 0, rs41_header, 0.5, 0.0, 0.70, 2, NULL, "RS41", tn_RS41, 0, 1, 0.0, 0.0}, @@ -175,6 +180,7 @@ static rsheader_t rs_hdr[Nrs] = { { 1200, 0, 0, mts01_header, 1.0, 0.0, 0.65, 2, NULL, "MTS01", tn_MTS01, 0, 0, 0.0, 0.0}, { 5800, 0, 0, c34_preheader, 1.5, 0.0, 0.80, 2, NULL, "C34C50", tn_C34C50, 0, 2, 0.0, 0.0}, // C34/C50 2900 Hz tone { 4800, 0, 0, weathex_header, 1.0, 0.0, 0.65, 2, NULL, "WXR301", tn_WXR301, 0, 3, 0.0, 0.0}, + { 5000, 0, 0, wxr2pn9_header, 1.0, 0.0, 0.65, 2, NULL, "WXRPN9", tn_WXRpn9, 0, 3, 0.0, 0.0}, { 9600, 0, 0, imet1ab_header, 1.0, 0.0, 0.80, 2, NULL, "IMET1AB", tn_IMET1ab, 1, 3, 0.0, 0.0}, // (rs_hdr[idxAB]) { 9600, 0, 0, imet_preamble, 0.5, 0.0, 0.80, 4, NULL, "IMETafsk", tn_IMETa , 1, 1, 0.0, 0.0}, // IMET1AB, IMET1RS (IQ)IMET4 { 9600, 0, 0, imet1rs_header, 0.5, 0.0, 0.80, 2, NULL, "IMET1RS", tn_IMET1rs, 0, 3, 0.0, 0.0}, // (rs_hdr[idxRS]) IMET4: lpIQ=0 ... @@ -184,6 +190,7 @@ static rsheader_t rs_hdr[Nrs] = { static int idx_MTS01 = -1, idx_C34C50 = -1, idx_WXR301 = -1, + idx_WXRPN9 = -1, idx_IMET1AB = -1; @@ -1143,6 +1150,7 @@ static int init_buffers() { #endif #ifdef NOWXR301 if ( strncmp(rs_hdr[j].type, "WXR301", 5) == 0 ) idx_WXR301 = j; + if ( strncmp(rs_hdr[j].type, "WXRPN9", 5) == 0 ) idx_WXRPN9 = j; #endif #ifdef NOIMET1AB if ( strncmp(rs_hdr[j].type, "IMET1AB", 7) == 0 ) idx_IMET1AB = j; @@ -1153,7 +1161,7 @@ static int init_buffers() { rs_hdr[j].spb = sample_rate/(float)rs_hdr[j].sps; rs_hdr[j].hLen = strlen(rs_hdr[j].header); rs_hdr[j].L = rs_hdr[j].hLen * rs_hdr[j].spb + 0.5; - if (j != idx_MTS01 && j != idx_C34C50 && j != idx_WXR301 && j != idx_IMET1AB) { + if (j != idx_MTS01 && j != idx_C34C50 && j != idx_WXR301 && j != idx_WXRPN9 && j != idx_IMET1AB) { if (rs_hdr[j].hLen > hLen) hLen = rs_hdr[j].hLen; if (rs_hdr[j].L > Lmax) Lmax = rs_hdr[j].L; } @@ -1477,6 +1485,7 @@ int main(int argc, char **argv) { if ( j == idx_MTS01 ) continue; // only ifdef NOMTS01 if ( j == idx_C34C50 ) continue; // only ifdef NOC34C50 if ( j == idx_WXR301 ) continue; // only ifdef NOWXR301 + if ( j == idx_WXRPN9 ) continue; // only ifdef NOWXR301 if ( j == idx_IMET1AB ) continue; // only ifdef NOIMET1AB mv0_pos[j] = mv_pos[j]; diff --git a/weathex/weathex301d.c b/weathex/weathex301d.c index ff210b9..d50a770 100644 --- a/weathex/weathex301d.c +++ b/weathex/weathex301d.c @@ -1,10 +1,8 @@ /* - Malaysia - 401100 kHz (64kHz wide) - 2023-05-12 ([ 4400] 12:20:37 alt: 12616.6 lat: 2.6785 lon: 101.5827) - 2023-07-27 ([ 6402] 00:47:32 alt: 26835.9 lat: 2.6918 lon: 101.5025) - Weathex WxR-301D w/o PN9 + Weathex WxR-301D (64kHz wide) + UAII2022 Lindenberg: w/ PN9, 5000 baud + Malaysia: w/o PN9, 4800 baud */ #include @@ -38,25 +36,21 @@ int option_verbose = 0, wavloaded = 0; int wav_channel = 0; // audio channel: left +int option_pn9 = 0; -#define BAUD_RATE 4800.0 // (4997.2) // 5000 +#define BAUD_RATE 4800.0 +#define BAUD_RATE_PN9 5000.0 //(4997.2) // 5000 #define FRAMELEN 69 //64 #define BITFRAMELEN (8*FRAMELEN) -/* -#define HEADLEN 56 -#define HEADOFS 0 -char header[] = "10101010""10101010""10101010" // AA AA AA (preamble) - "11000001""10010100""11000001"; // C1 94 C1 -*/ -//preamble_header_sn1: 101010101010101010101010 1100000110010100110000011100011001111000 110001010110110111100100 -//preamble_header_sn2: 101010101010101010101010 1100000110010100110000011100011001111000 001100100110110111100100 -//preamble_header_sn3: 101010101010101010101010 1100000110010100110000011100011001111000 001010000110110111100100 -#define HEADLEN 40 //48 +#define HEADLEN 40 #define HEADOFS 0 +char header_pn9[] = "10101010""10101010""10101010"//"10101010" // AA AA AA (preamble) + "11000001""10010100"; //"11000001""11000110"; // C1 94 (C1 C6) + char header[] = "10101010""10101010""10101010" // AA AA AA (preamble) - "00101101""11010100"; //"10101010"; // 2D D4 55/AA + "00101101""11010100"; //"10101010"; // 2D D4 (55/AA) char buf[HEADLEN+1] = "xxxxxxxxxx\0"; int bufpos = 0; @@ -65,6 +59,7 @@ char frame_bits[BITFRAMELEN+1]; ui8_t frame_bytes[FRAMELEN+1]; ui8_t xframe[FRAMELEN+1]; +float baudrate = BAUD_RATE; /* ------------------------------------------------------------------------------------ */ @@ -131,7 +126,7 @@ int read_wav_header(FILE *fp) { if (sample_rate == 900001) sample_rate -= 1; - samples_per_bit = sample_rate/(float)BAUD_RATE; + samples_per_bit = sample_rate/(float)baudrate; fprintf(stderr, "samples/bit: %.2f\n", samples_per_bit); @@ -252,9 +247,9 @@ int f32soft_read(FILE *fp, float *s) { } -int compare() { +int compare(char *hdr) { int i=0; - while ((i < HEADLEN) && (buf[(bufpos+i) % HEADLEN] == header[HEADLEN+HEADOFS-1-i])) { + while ((i < HEADLEN) && (buf[(bufpos+i) % HEADLEN] == hdr[HEADLEN+HEADOFS-1-i])) { i++; } return i; @@ -266,9 +261,9 @@ char inv(char c) { return c; } -int compare2() { +int compare2(char *hdr) { int i=0; - while ((i < HEADLEN) && (buf[(bufpos+i) % HEADLEN] == inv(header[HEADLEN+HEADOFS-1-i]))) { + while ((i < HEADLEN) && (buf[(bufpos+i) % HEADLEN] == inv(hdr[HEADLEN+HEADOFS-1-i]))) { i++; } return i; @@ -307,8 +302,8 @@ int bits2bytes(char *bitstr, ui8_t *bytes) { // cf. https://www.ti.com/lit/an/swra322/swra322.pdf // https://destevez.net/2019/07/lucky-7-decoded/ // -// counter low byte: frame[OFS+4] XOR 0xCC -// zero bytes, frame[OFS+30]: 0C CA C9 FB 49 37 E5 A8 +// counter low byte: frame[ofs+4] XOR 0xCC +// zero bytes, frame[ofs+30]: 0C CA C9 FB 49 37 E5 A8 // ui8_t PN9b[64] = { 0xFF, 0x87, 0xB8, 0x59, 0xB7, 0xA1, 0xCC, 0x24, 0x57, 0x5E, 0x4B, 0x9C, 0x0E, 0xE9, 0xEA, 0x50, @@ -356,7 +351,10 @@ typedef struct { gpx_t gpx; -#define OFS 6 // xPN9: OFS=8, different baud +// xPN9: OFS=8, 5000 baud ; w/o PN9: OFS=6, 4800 baud +#define OFS 6 +#define OFS_PN9 8 +int ofs = OFS; int print_frame() { int j; @@ -366,12 +364,14 @@ int print_frame() { for (j = 0; j < FRAMELEN; j++) { ui8_t b = frame_bytes[j]; - //if (j >= 6) b ^= PN9b[(j-6)%64]; // PN9 baud diff + if (option_pn9) { + if (j >= 6) b ^= PN9b[(j-6)%64]; + } xframe[j] = b; } - chkval = xor8sum(xframe+OFS, 53); - chkdat = (xframe[OFS+53]<<8) | xframe[OFS+53+1]; + chkval = xor8sum(xframe+ofs, 53); + chkdat = (xframe[ofs+53]<<8) | xframe[ofs+53+1]; chk_ok = (chkdat == chkval); if (option_raw) { @@ -398,12 +398,12 @@ int print_frame() { int val; // SN - sn = xframe[OFS] | (xframe[OFS+1]<<8) | (xframe[OFS+2]<<16) | (xframe[OFS+3]<<24); + sn = xframe[ofs] | (xframe[ofs+1]<<8) | (xframe[ofs+2]<<16) | (xframe[ofs+3]<<24); // counter - cnt = xframe[OFS+4] | (xframe[OFS+5]<<8); + cnt = xframe[ofs+4] | (xframe[ofs+5]<<8); - ui8_t frid = xframe[OFS+6]; + ui8_t frid = xframe[ofs+6]; if (frid == 1) { @@ -436,7 +436,7 @@ int print_frame() { // time/UTC int hms; - hms = xframe[OFS+7] | (xframe[OFS+8]<<8) | (xframe[OFS+9]<<16); + hms = xframe[ofs+7] | (xframe[ofs+8]<<8) | (xframe[ofs+9]<<16); hms &= 0x3FFFF; //printf(" (%6d) ", hms); ui8_t h = hms / 10000; @@ -448,30 +448,35 @@ int print_frame() { gpx.sec = s; // alt - val = xframe[OFS+13] | (xframe[OFS+14]<<8) | (xframe[OFS+15]<<16); + val = xframe[ofs+13] | (xframe[ofs+14]<<8) | (xframe[ofs+15]<<16); val >>= 4; val &= 0x7FFFF; // int19 ? //if (val & 0x40000) val -= 0x80000; ?? or sign bit ? float alt = val / 10.0f; printf(" alt: %.1f ", alt); // MSL gpx.alt = alt; + int val_alt = val; // lat - val = xframe[OFS+15] | (xframe[OFS+16]<<8) | (xframe[OFS+17]<<16) | (xframe[OFS+18]<<24); + val = xframe[ofs+15] | (xframe[ofs+16]<<8) | (xframe[ofs+17]<<16) | (xframe[ofs+18]<<24); val >>= 7; val &= 0x1FFFFFF; // int25 ? ?? sign NMEA N/S ? //if (val & 0x1000000) val -= 0x2000000; // sign bit ? (or 90 -> -90 wrap ?) float lat = val / 1e5f; printf(" lat: %.4f ", lat); gpx.lat = lat; + int val_lat = val; // lon - val = xframe[OFS+19] | (xframe[OFS+20]<<8) | (xframe[OFS+21]<<16)| (xframe[OFS+22]<<24); + val = xframe[ofs+19] | (xframe[ofs+20]<<8) | (xframe[ofs+21]<<16)| (xframe[ofs+22]<<24); val &= 0x3FFFFFF; // int26 ? ?? sign NMEA E/W ? //if (val & 0x2000000) val -= 0x4000000; // or sign bit ? (or 180 -> -180 wrap ?) float lon = val / 1e5f; printf(" lon: %.4f ", lon); gpx.lon = lon; + int val_lon = val; + + int zero_pos = val_alt == 0 && val_lat == 0 && val_lon == 0; // checksum printf(" %s", chk_ok ? "[OK]" : "[NO]"); @@ -480,7 +485,7 @@ int print_frame() { printf("\n"); // JSON - if (option_json && gpx.chk2ok) { + if (option_json && gpx.chk2ok && !zero_pos) { if (gpx.chk1ok && gpx.sn2 == gpx.sn1 && gpx.cnt2 == gpx.cnt1) // double check, unreliable checksums { char *ver_jsn = NULL; @@ -493,6 +498,10 @@ int print_frame() { // if data from subframe1, // check gpx.chk1ok && gpx.sn1==gpx.sn2 && gpx.cnt1==gpx.cnt2 + if (option_pn9) { + fprintf(stdout, ", \"subtype\": \"WXR_PN9\""); + } + if (gpx.jsn_freq > 0) { fprintf(stdout, ", \"freq\": %d", gpx.jsn_freq ); } @@ -527,6 +536,7 @@ int main(int argc, char **argv) { int header_found = 0; int cfreq = -1; + char *hdr = header; fpname = argv[0]; ++argv; @@ -538,6 +548,7 @@ int main(int argc, char **argv) { fprintf(stderr, " -b\n"); return 0; } + else if (strcmp(*argv, "--pn9") == 0) { option_pn9 = 1; } else if ( (strcmp(*argv, "-i") == 0) || (strcmp(*argv, "--invert") == 0) ) { option_inv = 1; } @@ -575,6 +586,11 @@ int main(int argc, char **argv) { } if (!wavloaded) fp = stdin; + if (option_pn9) { + baudrate = BAUD_RATE_PN9; + hdr = header_pn9; + ofs = OFS_PN9; + } if ( !option_softin ) { i = read_wav_header(fp); @@ -592,7 +608,7 @@ int main(int argc, char **argv) { { float s = 0.0f; int bit = 0; - sample_rate = BAUD_RATE; + sample_rate = baudrate; sample_count = 0; while (!f32soft_read(fp, &s)) { @@ -605,12 +621,12 @@ int main(int argc, char **argv) { if (!header_found) { - h = compare(); //h2 = compare2(); + h = compare(hdr); //h2 = compare2(hdr); if ((h >= HEADLEN)) { header_found = 1; fflush(stdout); if (option_timestamp) printf("<%8.3f> ", sample_count/(double)sample_rate); - strncpy(frame_bits, header, HEADLEN); + strncpy(frame_bits, hdr, HEADLEN); bit_count += HEADLEN; frames++; } @@ -649,12 +665,12 @@ int main(int argc, char **argv) { if (!header_found) { - h = compare(); //h2 = compare2(); + h = compare(hdr); //h2 = compare2(hdr); if ((h >= HEADLEN)) { header_found = 1; fflush(stdout); if (option_timestamp) printf("<%8.3f> ", sample_count/(double)sample_rate); - strncpy(frame_bits, header, HEADLEN); + strncpy(frame_bits, hdr, HEADLEN); bit_count += HEADLEN; frames++; }