- increased rho_thr

- add argument to switch printing of packets

git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@418 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-02-09 11:33:02 +00:00
parent 133b14cc87
commit 87b98ba4d2
4 changed files with 23 additions and 14 deletions
+6 -1
View File
@@ -3,7 +3,7 @@
<key>jay_bit_slicer</key> <key>jay_bit_slicer</key>
<category>[JAY]</category> <category>[JAY]</category>
<import>import jay</import> <import>import jay</import>
<make>jay.bit_slicer($sampleRate, $samplesPerSym, $kLoopFilter, $kThreshold)</make> <make>jay.bit_slicer($sampleRate, $samplesPerSym, $kLoopFilter, $kThreshold, $doPrintPackets)</make>
<param> <param>
<name>Samplerate</name> <name>Samplerate</name>
<key>sampleRate</key> <key>sampleRate</key>
@@ -26,6 +26,11 @@
<value>0.1</value> <value>0.1</value>
<type>float</type> <type>float</type>
</param> </param>
<param>
<name>Print packets</name>
<key>doPrintPackets</key>
<type>int</type>
</param>
<sink> <sink>
<name>in</name> <name>in</name>
<type>float</type> <type>float</type>
+1 -1
View File
@@ -46,7 +46,7 @@ namespace gr {
* class. jay::bit_slicer::make is the public interface for * class. jay::bit_slicer::make is the public interface for
* creating new instances. * 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 } // namespace jay
+12 -9
View File
@@ -25,7 +25,6 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include "bit_slicer_impl.h" #include "bit_slicer_impl.h"
#define WITH_PRINT_PACKETS 0
#define WITH_DEBUG_MESSAGES 0 #define WITH_DEBUG_MESSAGES 0
#define WITH_DEBUG_FILE 0 #define WITH_DEBUG_FILE 0
@@ -34,15 +33,15 @@ namespace gr
namespace jay 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 * 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::block("bit_slicer", gr::io_signature::make(1, 1, sizeof(float)),
gr::io_signature::make(1, 1, sizeof(float))) gr::io_signature::make(1, 1, sizeof(float)))
, m_sampleRate(sampleRate) , 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_baudRate((float)m_sampleRate/m_samplesPerSym)
, m_kLoopFilter(kLoopFilter) , m_kLoopFilter(kLoopFilter)
, m_kThreshold(kThreshold) , m_kThreshold(kThreshold)
, m_doPrintPackets(doPrintPackets)
, m_vmin(0) , m_vmin(0)
, m_vmax(0) , m_vmax(0)
, m_v_sig(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_thr = 0.01f;
const float alpha_dc = 0.002f; const float alpha_dc = 0.002f;
const float hyst_thr = 0.1f; 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_mu = 0.01f;
const float agc_target = 0.5f; const float agc_target = 0.5f;
const float agc_gain_max = 10.0f; 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); int bit_id = (int)(accu >= 0.0);
if (m_isSignal) if (m_isSignal)
{ {
#if WITH_PRINT_PACKETS if (m_doPrintPackets)
{
bitRecord(bit_id); bitRecord(bit_id);
#endif }
out[outCount++] = (float)bit_id; out[outCount++] = (float)bit_id;
} }
else else
@@ -223,9 +224,11 @@ int bit_slicer_impl::general_work (int noutput_items, gr_vector_int &ninput_item
} }
} }
#if WITH_PRINT_PACKETS if (m_doPrintPackets)
{
bitProcessGap(bitChg); bitProcessGap(bitChg);
#endif }
// Calc error // Calc error
err = 0; err = 0;
if (bitChg) if (bitChg)
+2 -1
View File
@@ -38,6 +38,7 @@ class bit_slicer_impl : public bit_slicer
float m_baudRate; float m_baudRate;
float m_kLoopFilter; float m_kLoopFilter;
float m_kThreshold; float m_kThreshold;
int m_doPrintPackets;
float m_vmin; float m_vmin;
float m_vmax; float m_vmax;
float m_v_sig; float m_v_sig;
@@ -66,7 +67,7 @@ class bit_slicer_impl : public bit_slicer
bool stop() override; bool stop() override;
public: 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(); ~bit_slicer_impl();
// Where all the action really happens // Where all the action really happens