summaryrefslogtreecommitdiff
path: root/gr-analog
diff options
context:
space:
mode:
authorTom Rondeau2013-02-12 18:22:01 -0500
committerTom Rondeau2013-02-12 18:22:01 -0500
commit40c9245a9aa656b4ef1d9962ca57aa967db58e28 (patch)
tree636c318b07136ed1c3695fcdc7ac534564f55c33 /gr-analog
parent4a9b54a2b860c445401523a4c2fc3be5da8b3afc (diff)
downloadgnuradio-40c9245a9aa656b4ef1d9962ca57aa967db58e28.tar.gz
gnuradio-40c9245a9aa656b4ef1d9962ca57aa967db58e28.tar.bz2
gnuradio-40c9245a9aa656b4ef1d9962ca57aa967db58e28.zip
analog: fix a floating point accuracy issue in the CTCSS squelch block.
Diffstat (limited to 'gr-analog')
-rw-r--r--gr-analog/lib/ctcss_squelch_ff_impl.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.cc b/gr-analog/lib/ctcss_squelch_ff_impl.cc
index db49b4f6e..60cd94fdb 100644
--- a/gr-analog/lib/ctcss_squelch_ff_impl.cc
+++ b/gr-analog/lib/ctcss_squelch_ff_impl.cc
@@ -115,11 +115,12 @@ namespace gr {
d_goertzel_c.input(in);
d_goertzel_r.input(in);
+ float rounder = 100000;
float d_out_l, d_out_c, d_out_r;
if(d_goertzel_c.ready()) {
- d_out_l = abs(d_goertzel_l.output());
- d_out_c = abs(d_goertzel_c.output());
- d_out_r = abs(d_goertzel_r.output());
+ d_out_l = floor(rounder*abs(d_goertzel_l.output()))/rounder;
+ d_out_c = floor(rounder*abs(d_goertzel_c.output()))/rounder;
+ d_out_r = floor(rounder*abs(d_goertzel_r.output()))/rounder;
//printf("d_out_l=%f d_out_c=%f d_out_r=%f\n", d_out_l, d_out_c, d_out_r);
d_mute = (d_out_c < d_level || d_out_c < d_out_l || d_out_c < d_out_r);