From d655ce3aacaaeb4ce9297519f09e61817b241724 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sat, 29 Jul 2017 21:47:09 +0930 Subject: [PATCH] Added CRC checking, possible RS41 decode fix. --- auto_rx/auto_rx.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/auto_rx/auto_rx.py b/auto_rx/auto_rx.py index c4d4ca6..6505fae 100644 --- a/auto_rx/auto_rx.py +++ b/auto_rx/auto_rx.py @@ -297,9 +297,13 @@ def process_rs_line(line): rs_frame['temp'] = 0.0 rs_frame['humidity'] = 0.0 + logging.info("TELEMETRY: %s,%d,%s,%.5f,%.5f,%.1f,%s" % (rs_frame['id'], rs_frame['frame'],rs_frame['time'], rs_frame['lat'], rs_frame['lon'], rs_frame['alt'], rs_frame['crc'])) - return rs_frame + if rs_frame['crc'] != 'OK': + return None + else: + return rs_frame except: logging.error("Could not parse string: %s" % line) @@ -442,8 +446,8 @@ def decode_rs41(frequency, ppm=0, gain='automatic', bias=False, rx_queue=None, t # Add a -T option if bias is enabled bias_option = "-T " if bias else "" - decode_cmd = "rtl_fm %s-p %d -M fm -s 12k -f %d 2>/dev/null |" % (bias_option, int(ppm), frequency) - decode_cmd += "sox -t raw -r 12k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - lowpass 2600 2>/dev/null |" + decode_cmd = "rtl_fm %s-p %d -M fm -s 15k -f %d 2>/dev/null |" % (bias_option, int(ppm), frequency) + decode_cmd += "sox -t raw -r 15k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - highpass 20 2>/dev/null |" # Note: I've got the check-CRC option hardcoded in here as always on. # I figure this is prudent if we're going to proceed to push this telemetry data onto a map.