summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/general
diff options
context:
space:
mode:
authorTom Rondeau2011-09-23 14:06:15 -0400
committerTom Rondeau2011-09-23 14:06:15 -0400
commitccc98551c8f8a4f1c4ba52647037d9eb84a94b29 (patch)
tree503efc0514f9d2c47c050288ca21813788eddfd4 /gnuradio-core/src/lib/general
parentc091c56ee98f0f2eca891ebc23524925f7d1a74a (diff)
downloadgnuradio-ccc98551c8f8a4f1c4ba52647037d9eb84a94b29.tar.gz
gnuradio-ccc98551c8f8a4f1c4ba52647037d9eb84a94b29.tar.bz2
gnuradio-ccc98551c8f8a4f1c4ba52647037d9eb84a94b29.zip
fixing PLL's so their output update is done at the right time; were lagging by a sample before.
Diffstat (limited to 'gnuradio-core/src/lib/general')
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc8
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc3
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_refout_cc.cc5
3 files changed, 10 insertions, 6 deletions
diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
index 19ab316a1..1668f71f0 100644
--- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
@@ -99,6 +99,9 @@ gr_pll_carriertracking_cc::work (int noutput_items,
float t_imag, t_real;
for (int i = 0; i < noutput_items; i++){
+ gr_sincosf(d_phase,&t_imag,&t_real);
+ optr[i] = iptr[i] * gr_complex(t_real,-t_imag);
+
error = phase_detector(iptr[i],d_phase);
d_freq = d_freq + d_beta * error;
@@ -108,9 +111,8 @@ gr_pll_carriertracking_cc::work (int noutput_items,
d_freq = d_max_freq;
else if (d_freq < d_min_freq)
d_freq = d_min_freq;
- gr_sincosf(d_phase,&t_imag,&t_real);
- optr[i] = iptr[i] * gr_complex(t_real,-t_imag);
- d_locksig = d_locksig * (1.0 - d_alpha) + d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag);
+ d_locksig = d_locksig * (1.0 - d_alpha) +
+ d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag);
if ((d_squelch_enable) && !lock_detector())
optr[i] = 0;
diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
index 1f17f2afc..997ba4042 100644
--- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
+++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
@@ -80,6 +80,8 @@ gr_pll_freqdet_cf::work (int noutput_items,
int size = noutput_items;
while (size-- > 0) {
+ *optr++ = d_freq;
+
error = phase_detector(*iptr++,d_phase);
d_freq = d_freq + d_beta * error;
@@ -89,7 +91,6 @@ gr_pll_freqdet_cf::work (int noutput_items,
d_freq = d_max_freq;
else if (d_freq < d_min_freq)
d_freq = d_min_freq;
- *optr++ = d_freq;
}
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
index 8a7fbf88b..d01f28e45 100644
--- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
@@ -82,6 +82,9 @@ gr_pll_refout_cc::work (int noutput_items,
int size = noutput_items;
while (size-- > 0) {
+ gr_sincosf(d_phase,&t_imag,&t_real);
+ *optr++ = gr_complex(t_real,t_imag);
+
error = phase_detector(*iptr++,d_phase);
d_freq = d_freq + d_beta * error;
@@ -91,8 +94,6 @@ gr_pll_refout_cc::work (int noutput_items,
d_freq = d_max_freq;
else if (d_freq < d_min_freq)
d_freq = d_min_freq;
- gr_sincosf(d_phase,&t_imag,&t_real);
- *optr++ = gr_complex(t_real,t_imag);
}
return noutput_items;
}