Window number to dot duration should be sufficient enough
This commit is contained in:
parent
f560f16af3
commit
5d7af423a8
|
@ -41,7 +41,11 @@ list(APPEND enabled_blocks
|
|||
satnogs_coarse_doppler_correction_cc.xml
|
||||
satnogs_ax25_encoder_mb.xml
|
||||
satnogs_ax25_decoder_bm.xml
|
||||
satnogs_waterfall_sink.xml
|
||||
satnogs_waterfall_sink.xml
|
||||
satnogs_ogg_source.xml
|
||||
satnogs_noaa_apt_sink.xml
|
||||
satnogs_frame_file_sink.xml
|
||||
satnogs_iq_sink.xml
|
||||
)
|
||||
|
||||
if(${INCLUDE_DEBUG_BLOCKS})
|
||||
|
@ -49,8 +53,5 @@ if(${INCLUDE_DEBUG_BLOCKS})
|
|||
endif()
|
||||
install(FILES
|
||||
${enabled_blocks}
|
||||
satnogs_ogg_source.xml
|
||||
satnogs_noaa_apt_sink.xml
|
||||
satnogs_frame_file_sink.xml DESTINATION share/gnuradio/grc/blocks
|
||||
satnogs_iq_sink.xml
|
||||
DESTINATION share/gnuradio/grc/blocks
|
||||
)
|
||||
|
|
|
@ -4,7 +4,14 @@
|
|||
<key>satnogs_morse_debug_source</key>
|
||||
<category>[SatNOGS]/Debug</category>
|
||||
<import>import satnogs</import>
|
||||
<make>satnogs.morse_debug_source($debug_seq, $errors, $p)</make>
|
||||
<make>satnogs.morse_debug_source($wpm, $debug_seq, $errors, $p, $seq_pause_ms)</make>
|
||||
|
||||
<param>
|
||||
<name>WPM</name>
|
||||
<key>wpm</key>
|
||||
<value>20</value>
|
||||
<type>int</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Sentence</name>
|
||||
|
@ -33,6 +40,13 @@
|
|||
<value>0.1</value>
|
||||
<type>real</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Sequence Pause (millis)</name>
|
||||
<key>seq_pause_ms</key>
|
||||
<value>1000</value>
|
||||
<type>int</type>
|
||||
</param>
|
||||
|
||||
<source>
|
||||
<name>out</name>
|
||||
|
|
|
@ -55,16 +55,18 @@ list(APPEND HEADER_FILES
|
|||
ax25_encoder_mb.h
|
||||
ax25_decoder_bm.h
|
||||
qb50_deframer.h
|
||||
waterfall_sink.h
|
||||
waterfall_sink.h
|
||||
ogg_source.h
|
||||
noaa_apt_sink.h
|
||||
frame_file_sink.h
|
||||
iq_sink.h
|
||||
)
|
||||
|
||||
if(${INCLUDE_DEBUG_BLOCKS})
|
||||
list(APPEND HEADER_FILES ${DEBUG_HEADER_FILES})
|
||||
endif()
|
||||
|
||||
install(FILES
|
||||
${HEADER_FILES}
|
||||
ogg_source.h
|
||||
noaa_apt_sink.h
|
||||
frame_file_sink.h DESTINATION include/satnogs
|
||||
iq_sink.h DESTINATION
|
||||
DESTINATION include/satnogs
|
||||
)
|
|
@ -2,7 +2,8 @@
|
|||
/*
|
||||
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
||||
*
|
||||
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
|
||||
* Copyright (C) 2016,2017
|
||||
* Libre Space Foundation <http://librespacefoundation.org/>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,8 +25,10 @@
|
|||
#include <satnogs/api.h>
|
||||
#include <gnuradio/block.h>
|
||||
|
||||
namespace gr {
|
||||
namespace satnogs {
|
||||
namespace gr
|
||||
{
|
||||
namespace satnogs
|
||||
{
|
||||
|
||||
/*!
|
||||
* \brief A Morse debug source block that supports injection of random
|
||||
|
@ -36,7 +39,7 @@ namespace gr {
|
|||
*/
|
||||
class SATNOGS_API morse_debug_source : virtual public gr::block
|
||||
{
|
||||
public:
|
||||
public:
|
||||
typedef boost::shared_ptr<morse_debug_source> sptr;
|
||||
|
||||
/*!
|
||||
|
@ -45,13 +48,21 @@ namespace gr {
|
|||
* This block can also inject random errors, based on a Bernoulli
|
||||
* distribution.
|
||||
*
|
||||
* @param wpm words per minute
|
||||
* @param debug_seq A string containing the debug sentence
|
||||
* @param inject_errors if set the debug source block will produce
|
||||
* errors that follow a Bernoulli distribution
|
||||
* @param error_prob the probability p of error for the Bernulli distribution
|
||||
* @param seq_pause_ms pause in milliseconds between concecutive debug
|
||||
* sequences. For simplicity the pause duration will be scaled to multiple
|
||||
* dot durations.
|
||||
*/
|
||||
static sptr make(const std::string& debug_seq, bool inject_errors = false,
|
||||
float error_prob = 0.1);
|
||||
static sptr
|
||||
make (const size_t wpm,
|
||||
const std::string& debug_seq,
|
||||
bool inject_errors = false,
|
||||
float error_prob = 0.1,
|
||||
size_t seq_pause_ms = 1000);
|
||||
};
|
||||
|
||||
} // namespace satnogs
|
||||
|
|
|
@ -63,8 +63,8 @@ list(APPEND satnogs_sources
|
|||
waterfall_sink_impl.cc
|
||||
ogg_source_impl.cc
|
||||
noaa_apt_sink_impl.cc
|
||||
frame_file_sink_impl.cc)
|
||||
iq_sink_impl.cc
|
||||
frame_file_sink_impl.cc
|
||||
iq_sink_impl.cc)
|
||||
|
||||
if(${INCLUDE_DEBUG_BLOCKS})
|
||||
list(APPEND satnogs_sources ${satnogs_debug_sources})
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace gr
|
|||
*/
|
||||
size_t i = 1;
|
||||
d_window_size = d_dot_samples / i;
|
||||
while(d_window_size > 256) {
|
||||
while(d_window_size > 64) {
|
||||
i++;
|
||||
d_window_size = d_dot_samples / i;
|
||||
}
|
||||
|
@ -202,13 +202,17 @@ namespace gr
|
|||
gr_vector_void_star &output_items)
|
||||
{
|
||||
bool triggered;
|
||||
int i;
|
||||
size_t i;
|
||||
const float *in_old = (const float *) input_items[0];
|
||||
const float *in = in_old + history() - 1;
|
||||
|
||||
if(noutput_items < 0) {
|
||||
return noutput_items;
|
||||
}
|
||||
|
||||
/* During idle state search for a possible trigger */
|
||||
if(d_dec_state == NO_SYNC) {
|
||||
for(i = 0; i < noutput_items; i++) {
|
||||
for(i = 0; i < (size_t)noutput_items; i++) {
|
||||
/*
|
||||
* Clamp the input so the window mean is not affected by strong spikes
|
||||
* Good luck understanding this black magic shit!
|
||||
|
@ -224,7 +228,7 @@ namespace gr
|
|||
}
|
||||
|
||||
/* From now one, we handle the input in multiples of a window */
|
||||
for (i = 0; i < noutput_items / d_window_size; i++) {
|
||||
for (i = 0; i < (size_t)noutput_items / d_window_size; i++) {
|
||||
triggered = is_triggered(in + i * d_window_size, d_window_size);
|
||||
switch(d_dec_state) {
|
||||
case SEARCH_DOT:
|
||||
|
@ -312,8 +316,8 @@ namespace gr
|
|||
volk_32f_binary_slicer_32i(d_out, d_tmp, len);
|
||||
}
|
||||
|
||||
inline int32_t
|
||||
cw_to_symbol_impl::hadd (const int32_t* in, size_t len)
|
||||
static inline int32_t
|
||||
hadd (const int32_t* in, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
int32_t cnt = 0;
|
||||
|
|
|
@ -67,9 +67,6 @@ namespace gr
|
|||
inline void
|
||||
set_search_space ();
|
||||
|
||||
inline int32_t
|
||||
hadd (const int32_t *in, size_t len);
|
||||
|
||||
inline void
|
||||
clamp_input (int32_t *out, const float *in, size_t len);
|
||||
|
||||
|
|
|
@ -34,24 +34,31 @@ namespace gr
|
|||
{
|
||||
|
||||
morse_debug_source::sptr
|
||||
morse_debug_source::make (const std::string& debug_seq, bool inject_errors,
|
||||
float error_prob)
|
||||
morse_debug_source::make (const size_t wpm,
|
||||
const std::string& debug_seq, bool inject_errors,
|
||||
float error_prob,
|
||||
size_t seq_pause_ms)
|
||||
{
|
||||
return gnuradio::get_initial_sptr (
|
||||
new morse_debug_source_impl (debug_seq, inject_errors, error_prob));
|
||||
new morse_debug_source_impl (wpm, debug_seq, inject_errors,
|
||||
error_prob, seq_pause_ms));
|
||||
}
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
morse_debug_source_impl::morse_debug_source_impl (std::string debug_seq,
|
||||
morse_debug_source_impl::morse_debug_source_impl (const size_t wpm,
|
||||
std::string debug_seq,
|
||||
bool inject_errors,
|
||||
float error_prob) :
|
||||
float error_prob,
|
||||
size_t seq_pause_ms) :
|
||||
gr::block ("morse_debug_source",
|
||||
gr::io_signature::make (0, 0, 0),
|
||||
gr::io_signature::make (0, 0, 0)),
|
||||
d_wpm (wpm),
|
||||
d_inject_errors (inject_errors),
|
||||
d_p (error_prob),
|
||||
d_seq_pause_ms (seq_pause_ms),
|
||||
d_run (true),
|
||||
d_chars
|
||||
{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
||||
|
@ -142,7 +149,13 @@ namespace gr
|
|||
}
|
||||
}
|
||||
message_port_pub (port, pmt::from_long (MORSE_L_SPACE));
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds (1000));
|
||||
|
||||
for(i = 0; i < d_seq_pause_ms / (1200/d_wpm); i++) {
|
||||
message_port_pub (port, pmt::from_long (MORSE_INTRA_SPACE));
|
||||
}
|
||||
|
||||
/* Perform a true sleep, to avoid message overload */
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds (d_seq_pause_ms));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
/*
|
||||
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
||||
*
|
||||
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
|
||||
* Copyright (C) 2016, 2017
|
||||
* Libre Space Foundation <http://librespacefoundation.org/>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,26 +27,31 @@
|
|||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace gr {
|
||||
namespace satnogs {
|
||||
namespace gr
|
||||
{
|
||||
namespace satnogs
|
||||
{
|
||||
|
||||
class morse_debug_source_impl : public morse_debug_source
|
||||
{
|
||||
private:
|
||||
private:
|
||||
const size_t d_wpm;
|
||||
const bool d_inject_errors;
|
||||
const float d_p;
|
||||
const size_t d_seq_pause_ms;
|
||||
bool d_run;
|
||||
const char d_chars[36];
|
||||
const std::vector<std::string> d_symbols;
|
||||
std::thread d_thread;
|
||||
|
||||
void
|
||||
send_debug_msg(std::string sentence);
|
||||
send_debug_msg (std::string sentence);
|
||||
|
||||
public:
|
||||
morse_debug_source_impl(std::string debug_seq, bool inject_errors,
|
||||
float error_prob);
|
||||
~morse_debug_source_impl();
|
||||
public:
|
||||
morse_debug_source_impl (const size_t wpm, std::string debug_seq,
|
||||
bool inject_errors,
|
||||
float error_prob, size_t seq_pause_ms);
|
||||
~morse_debug_source_impl ();
|
||||
};
|
||||
|
||||
} // namespace satnogs
|
||||
|
|
Loading…
Reference in New Issue