remove all references to samp_rate

main
Jean-Michel Friedt 2023-03-05 13:55:24 +01:00
parent 10ec8de239
commit aaefa3334e
6 changed files with 13 additions and 34 deletions

View File

@ -3,10 +3,6 @@ label: m17_coder
category: '[m17]' category: '[m17]'
parameters: parameters:
- id: samp_rate
label: samp_rate
dtype: float
default: samp_rate
- id: src_id - id: src_id
label: Source ID label: Source ID
dtype: string dtype: string
@ -33,10 +29,9 @@ asserts:
- ${ type < 65536 } - ${ type < 65536 }
templates: templates:
imports: from gnuradio import m17 imports: from gnuradio import m17
make: m17.m17_coder(${src_id},${dst_id},${type},${meta},${samp_rate},${debug}) make: m17.m17_coder(${src_id},${dst_id},${type},${meta},${debug})
callbacks: callbacks:
- set_meta(${meta}) - set_meta(${meta})
- set_samp_rate(${samp_rate})
- set_src_id(${src_id}) - set_src_id(${src_id})
- set_dst_id(${dst_id}) - set_dst_id(${dst_id})
- set_type(${type}) - set_type(${type})
@ -64,7 +59,7 @@ outputs:
optional: 0 optional: 0
documentation: |- documentation: |-
The m17-coder block reads a byte datastream clocked (samp_rate) at 200 bits/s and will output a real stream at 24 times this input rate. The source and destination fields are 6-character strings, the type field is a 0-255 value and the meta field a free string which can be updated during transmission. The m17-coder block reads a byte datastream clocked at 200 bits/s and outputs a real stream at 24 times this input rate (4800 Hz). The source and destination fields are 9-character callsign strings, the type field is a 0-65535 value and the meta field a free string which can be updated during transmission.
# 'file_format' specifies the version of the GRC yml format used in the file # 'file_format' specifies the version of the GRC yml format used in the file
# and should usually not be changed. # and should usually not be changed.

View File

@ -32,11 +32,10 @@ public:
* class. m17::m17_coder::make is the public interface for * class. m17::m17_coder::make is the public interface for
* creating new instances. * creating new instances.
*/ */
static sptr make(std::string src_id,std::string dst_id,short type,std::string meta,float samp_rate,bool debug); static sptr make(std::string src_id,std::string dst_id,short type,std::string meta,bool debug);
virtual void set_meta(std::string meta)=0; virtual void set_meta(std::string meta)=0;
virtual void set_src_id(std::string src_id)=0; virtual void set_src_id(std::string src_id)=0;
virtual void set_dst_id(std::string dst_id)=0; virtual void set_dst_id(std::string dst_id)=0;
virtual void set_samp_rate(float samp_rate)=0;
virtual void set_debug(bool debug)=0; virtual void set_debug(bool debug)=0;
virtual void set_type(short type)=0; virtual void set_type(short type)=0;
}; };

View File

@ -46,13 +46,12 @@ struct LSF
uint8_t crc[2]; uint8_t crc[2];
} lsf; } lsf;
void send_Preamble(const uint8_t type,float *out, int *counterout, float samp_rate) void send_Preamble(const uint8_t type,float *out, int *counterout)
{ {
float symb; float symb;
if(type) //pre-BERT if(type) //pre-BERT
{ {
// for(uint16_t i=0; i<(int)(40e-3*samp_rate)/2; i++) //40ms * 4800 = 192 TODO JMF
for(uint16_t i=0; i<(int)(192/2); i++) //40ms * 4800 = 192 for(uint16_t i=0; i<(int)(192/2); i++) //40ms * 4800 = 192
{ {
symb=-3.0; symb=-3.0;
@ -67,7 +66,6 @@ void send_Preamble(const uint8_t type,float *out, int *counterout, float samp_ra
} }
else //pre-LSF else //pre-LSF
{ {
// for(uint16_t i=0; i<(int)(40e-3*samp_rate)/2; i++) //40ms * 4800 = 192 TODO JMF
for(uint16_t i=0; i<(int)(192/2); i++) //40ms * 4800 = 192 for(uint16_t i=0; i<(int)(192/2); i++) //40ms * 4800 = 192
{ {
symb=+3.0; symb=+3.0;
@ -261,24 +259,23 @@ uint16_t LSF_CRC(struct LSF *in)
} }
m17_coder::sptr m17_coder::sptr
m17_coder::make(std::string src_id,std::string dst_id,short type,std::string meta, float samp_rate,bool debug) m17_coder::make(std::string src_id,std::string dst_id,short type,std::string meta, bool debug)
{ {
return gnuradio::get_initial_sptr return gnuradio::get_initial_sptr
(new m17_coder_impl(src_id,dst_id,type,meta,samp_rate,debug)); (new m17_coder_impl(src_id,dst_id,type,meta,debug));
} }
/* /*
* The private constructor * The private constructor
*/ */
m17_coder_impl::m17_coder_impl(std::string src_id,std::string dst_id,short type,std::string meta, float samp_rate, bool debug) m17_coder_impl::m17_coder_impl(std::string src_id,std::string dst_id,short type,std::string meta, bool debug)
: gr::block("m17_coder", : gr::block("m17_coder",
gr::io_signature::make(1, 1, sizeof(char)), gr::io_signature::make(1, 1, sizeof(char)),
gr::io_signature::make(1, 1, sizeof(float))) gr::io_signature::make(1, 1, sizeof(float)))
,_samp_rate(samp_rate), _meta(meta),_type(type), _debug(debug) , _meta(meta),_type(type), _debug(debug)
{ set_meta(meta); { set_meta(meta);
set_src_id(src_id); set_src_id(src_id);
set_dst_id(dst_id); set_dst_id(dst_id);
set_samp_rate(samp_rate);
set_type(type); set_type(type);
set_debug(debug); set_debug(debug);
uint16_t ccrc=LSF_CRC(&lsf); uint16_t ccrc=LSF_CRC(&lsf);
@ -288,11 +285,6 @@ uint16_t LSF_CRC(struct LSF *in)
_fn=0; //16-bit Frame Number (for the stream mode) _fn=0; //16-bit Frame Number (for the stream mode)
} }
void m17_coder_impl::set_samp_rate(float samp_rate)
{_samp_rate=samp_rate;
printf("New sampling rate: %f\n",_samp_rate);
}
void m17_coder_impl::set_debug(bool debug) void m17_coder_impl::set_debug(bool debug)
{_debug=debug; {_debug=debug;
if (_debug==true) printf("true\n"); else printf("Debug false\n"); if (_debug==true) printf("true\n"); else printf("Debug false\n");
@ -540,7 +532,7 @@ printf("got_lsf=1\n");
conv_Encode_LSF(enc_bits, &lsf); conv_Encode_LSF(enc_bits, &lsf);
//send out the preamble and LSF //send out the preamble and LSF
send_Preamble(0,out,&countout,_samp_rate); //0 - LSF preamble, as opposed to 1 - BERT preamble send_Preamble(0,out,&countout); //0 - LSF preamble, as opposed to 1 - BERT preamble
//send LSF syncword //send LSF syncword
send_Syncword(SYNC_LSF,out,&countout); send_Syncword(SYNC_LSF,out,&countout);

View File

@ -18,7 +18,6 @@ class m17_coder_impl : public m17_coder
private: private:
std::string _meta; std::string _meta;
unsigned char _src_id[6],_dst_id[6]; unsigned char _src_id[6],_dst_id[6];
float _samp_rate=0.;
short _type; short _type;
int _got_lsf=0; int _got_lsf=0;
uint16_t _fn=0; //16-bit Frame Number (for the stream mode) uint16_t _fn=0; //16-bit Frame Number (for the stream mode)
@ -28,11 +27,10 @@ private:
public: public:
void set_src_id(std::string src_id); void set_src_id(std::string src_id);
void set_dst_id(std::string dst_id); void set_dst_id(std::string dst_id);
void set_samp_rate(float samp_rate);
void set_meta(std::string meta); void set_meta(std::string meta);
void set_type(short type); void set_type(short type);
void set_debug(bool debug); void set_debug(bool debug);
m17_coder_impl(std::string src_id,std::string dst_id,short type,std::string meta,float samp_rate,bool debug); m17_coder_impl(std::string src_id,std::string dst_id,short type,std::string meta,bool debug);
~m17_coder_impl(); ~m17_coder_impl();
// Where all the action really happens // Where all the action really happens

View File

@ -28,8 +28,6 @@ static const char *__doc_gr_m17_m17_coder_set_src_id = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_dst_id = R"doc()doc"; static const char *__doc_gr_m17_m17_coder_set_dst_id = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_samp_rate = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_debug = R"doc()doc"; static const char *__doc_gr_m17_m17_coder_set_debug = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_type = R"doc()doc"; static const char *__doc_gr_m17_m17_coder_set_type = R"doc()doc";

View File

@ -16,7 +16,7 @@
/* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(m17_coder.h) */ /* BINDTOOL_HEADER_FILE(m17_coder.h) */
/* BINDTOOL_HEADER_FILE_HASH(c37cf1a142598d1cf96b7a93c85559f2) */ /* BINDTOOL_HEADER_FILE_HASH(178a26e09118551324bf48782db38a1b) */
/***********************************************************************************/ /***********************************************************************************/
#include <pybind11/complex.h> #include <pybind11/complex.h>
@ -37,8 +37,8 @@ void bind_m17_coder(py::module &m) {
m, "m17_coder", D(m17_coder)) m, "m17_coder", D(m17_coder))
.def(py::init(&m17_coder::make), py::arg("src_id"), py::arg("dst_id"), .def(py::init(&m17_coder::make), py::arg("src_id"), py::arg("dst_id"),
py::arg("type"), py::arg("meta"), py::arg("samp_rate"), py::arg("type"), py::arg("meta"), py::arg("debug"),
py::arg("debug"), D(m17_coder, make)) D(m17_coder, make))
.def("set_meta", &m17_coder::set_meta, py::arg("meta"), .def("set_meta", &m17_coder::set_meta, py::arg("meta"),
D(m17_coder, set_meta)) D(m17_coder, set_meta))
@ -49,9 +49,6 @@ void bind_m17_coder(py::module &m) {
.def("set_dst_id", &m17_coder::set_dst_id, py::arg("dst_id"), .def("set_dst_id", &m17_coder::set_dst_id, py::arg("dst_id"),
D(m17_coder, set_dst_id)) D(m17_coder, set_dst_id))
.def("set_samp_rate", &m17_coder::set_samp_rate, py::arg("samp_rate"),
D(m17_coder, set_samp_rate))
.def("set_debug", &m17_coder::set_debug, py::arg("debug"), .def("set_debug", &m17_coder::set_debug, py::arg("debug"),
D(m17_coder, set_debug)) D(m17_coder, set_debug))