diff --git a/gr-jay/grc/jay_bit_slicer.xml b/gr-jay/grc/jay_bit_slicer.xml
index 2c6a208..2e93c8f 100644
--- a/gr-jay/grc/jay_bit_slicer.xml
+++ b/gr-jay/grc/jay_bit_slicer.xml
@@ -3,7 +3,7 @@
jay_bit_slicer
[JAY]
import jay
- jay.bit_slicer($sampleRate, $samplesPerSym, $kLoopFilter, $kThreshold)
+ jay.bit_slicer($sampleRate, $samplesPerSym, $kLoopFilter, $kThreshold, $doPrintPackets)
Samplerate
sampleRate
@@ -26,6 +26,11 @@
0.1
float
+
+ Print packets
+ doPrintPackets
+ int
+
in
float
diff --git a/gr-jay/include/jay/bit_slicer.h b/gr-jay/include/jay/bit_slicer.h
index 7a14ab2..408b788 100644
--- a/gr-jay/include/jay/bit_slicer.h
+++ b/gr-jay/include/jay/bit_slicer.h
@@ -46,7 +46,7 @@ namespace gr {
* class. jay::bit_slicer::make is the public interface for
* creating new instances.
*/
- static sptr make(int sampleRate, int samplesPerSym, float kLoopfilter, float kThreshold);
+ static sptr make(int sampleRate, int samplesPerSym, float kLoopfilter, float kThreshold, int doPrintPackets);
};
} // namespace jay
diff --git a/gr-jay/lib/bit_slicer_impl.cc b/gr-jay/lib/bit_slicer_impl.cc
index 7116deb..34ee6a6 100644
--- a/gr-jay/lib/bit_slicer_impl.cc
+++ b/gr-jay/lib/bit_slicer_impl.cc
@@ -25,7 +25,6 @@
#include
#include "bit_slicer_impl.h"
-#define WITH_PRINT_PACKETS 0
#define WITH_DEBUG_MESSAGES 0
#define WITH_DEBUG_FILE 0
@@ -34,15 +33,15 @@ namespace gr
namespace jay
{
-bit_slicer::sptr bit_slicer::make(int sampleRate, int samplesPerSym, float kLoopFilter, float kThreshold)
+bit_slicer::sptr bit_slicer::make(int sampleRate, int samplesPerSym, float kLoopFilter, float kThreshold, int doPrintPackets)
{
- return gnuradio::get_initial_sptr(new bit_slicer_impl(sampleRate, samplesPerSym, kLoopFilter, kThreshold));
+ return gnuradio::get_initial_sptr(new bit_slicer_impl(sampleRate, samplesPerSym, kLoopFilter, kThreshold, doPrintPackets));
}
/*
* The private constructor
*/
-bit_slicer_impl::bit_slicer_impl(int sampleRate, int samplesPerSym, float kLoopFilter, float kThreshold)
+bit_slicer_impl::bit_slicer_impl(int sampleRate, int samplesPerSym, float kLoopFilter, float kThreshold, int doPrintPackets)
: gr::block("bit_slicer", gr::io_signature::make(1, 1, sizeof(float)),
gr::io_signature::make(1, 1, sizeof(float)))
, m_sampleRate(sampleRate)
@@ -52,6 +51,7 @@ bit_slicer_impl::bit_slicer_impl(int sampleRate, int samplesPerSym, float kLoopF
, m_baudRate((float)m_sampleRate/m_samplesPerSym)
, m_kLoopFilter(kLoopFilter)
, m_kThreshold(kThreshold)
+, m_doPrintPackets(doPrintPackets)
, m_vmin(0)
, m_vmax(0)
, m_v_sig(0)
@@ -121,7 +121,7 @@ int bit_slicer_impl::general_work (int noutput_items, gr_vector_int &ninput_item
const float alpha_thr = 0.01f;
const float alpha_dc = 0.002f;
const float hyst_thr = 0.1f;
- const float rho_thr = 0.999f;
+ const float rho_thr = 0.9999f;
const float agc_mu = 0.01f;
const float agc_target = 0.5f;
const float agc_gain_max = 10.0f;
@@ -190,9 +190,10 @@ int bit_slicer_impl::general_work (int noutput_items, gr_vector_int &ninput_item
int bit_id = (int)(accu >= 0.0);
if (m_isSignal)
{
-#if WITH_PRINT_PACKETS
- bitRecord(bit_id);
-#endif
+ if (m_doPrintPackets)
+ {
+ bitRecord(bit_id);
+ }
out[outCount++] = (float)bit_id;
}
else
@@ -223,9 +224,11 @@ int bit_slicer_impl::general_work (int noutput_items, gr_vector_int &ninput_item
}
}
-#if WITH_PRINT_PACKETS
- bitProcessGap(bitChg);
-#endif
+ if (m_doPrintPackets)
+ {
+ bitProcessGap(bitChg);
+ }
+
// Calc error
err = 0;
if (bitChg)
diff --git a/gr-jay/lib/bit_slicer_impl.h b/gr-jay/lib/bit_slicer_impl.h
index 32fddb6..1665d5e 100644
--- a/gr-jay/lib/bit_slicer_impl.h
+++ b/gr-jay/lib/bit_slicer_impl.h
@@ -38,6 +38,7 @@ class bit_slicer_impl : public bit_slicer
float m_baudRate;
float m_kLoopFilter;
float m_kThreshold;
+ int m_doPrintPackets;
float m_vmin;
float m_vmax;
float m_v_sig;
@@ -66,7 +67,7 @@ class bit_slicer_impl : public bit_slicer
bool stop() override;
public:
- bit_slicer_impl(int sampleRate, int samplesPerSym, float kLoopFilter, float kThreshold);
+ bit_slicer_impl(int sampleRate, int samplesPerSym, float kLoopFilter, float kThreshold, int doPrintPackets);
~bit_slicer_impl();
// Where all the action really happens