diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index 01034c8..d56f76a 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -24,7 +24,7 @@ list(APPEND debug_blocks
satnogs_debug_msg_source.xml
satnogs_debug_msg_source_raw.xml
satnogs_leo_channel.xml
- satnogs_cw_encoder.xml
+ satnogs_cw_encoder.xml
)
list(APPEND enabled_blocks
@@ -36,11 +36,11 @@ list(APPEND enabled_blocks
satnogs_fox_telem_mm.xml
satnogs_frame_file_sink.xml
satnogs_iq_sink.xml
- satnogs_lrpt_decoder.xml
- satnogs_lrpt_sync.xml
+ satnogs_lrpt_decoder.xml
+ satnogs_lrpt_sync.xml
satnogs_morse_decoder.xml
satnogs_multi_format_msg_sink.xml
- satnogs_ogg_encoder.xml
+ satnogs_ogg_encoder.xml
satnogs_cw_to_symbol.xml
satnogs_udp_msg_source.xml
satnogs_tcp_rigctl_msg_source.xml
@@ -53,6 +53,7 @@ list(APPEND enabled_blocks
satnogs_noaa_apt_sink.xml
satnogs_whitening.xml
satnogs_frame_acquisition.xml
+ satnogs_sstv_pd120_sink.xml
)
if(${INCLUDE_DEBUG_BLOCKS})
diff --git a/grc/satnogs_sstv_pd120_sink.xml b/grc/satnogs_sstv_pd120_sink.xml
new file mode 100644
index 0000000..95f830a
--- /dev/null
+++ b/grc/satnogs_sstv_pd120_sink.xml
@@ -0,0 +1,31 @@
+
+ SSTV PD120 sink
+ satnogs_sstv_pd120_sink
+ [SATNOGS]
+ import satnogs
+ satnogs.sstv_pd120_sink($filename_png, $split)
+
+ Output PNG Filename
+ filename_png
+
+ file_save
+
+
+ Split
+ split
+ False
+ bool
+
+
+
+
+ in
+ float
+
+
diff --git a/include/satnogs/CMakeLists.txt b/include/satnogs/CMakeLists.txt
index 7af04b4..0ec4861 100644
--- a/include/satnogs/CMakeLists.txt
+++ b/include/satnogs/CMakeLists.txt
@@ -24,7 +24,7 @@ list(APPEND DEBUG_HEADER_FILES
morse_debug_source.h
debug_msg_source_raw.h
debug_msg_source.h
- cw_encoder.h
+ cw_encoder.h
)
list(APPEND HEADER_FILES
@@ -37,7 +37,7 @@ list(APPEND HEADER_FILES
morse.h
morse_decoder.h
multi_format_msg_sink.h
- ogg_encoder.h
+ ogg_encoder.h
cw_to_symbol.h
utils.h
udp_msg_source.h
@@ -59,6 +59,7 @@ list(APPEND HEADER_FILES
noaa_apt_sink.h
frame_file_sink.h
iq_sink.h
+ sstv_pd120_sink.h
)
if(${INCLUDE_DEBUG_BLOCKS})
@@ -76,4 +77,4 @@ install(FILES
frame_acquisition.h
shift_reg.h
golay24.h DESTINATION include/satnogs
-)
\ No newline at end of file
+)
diff --git a/include/satnogs/sstv_pd120_sink.h b/include/satnogs/sstv_pd120_sink.h
new file mode 100644
index 0000000..f1a47e4
--- /dev/null
+++ b/include/satnogs/sstv_pd120_sink.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
+ *
+ * Copyright (C) 2017, Libre Space Foundation
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+
+
+#ifndef INCLUDED_SATNOGS_SSTV_PD120_SINK_H
+#define INCLUDED_SATNOGS_SSTV_PD120_SINK_H
+
+#include
+#include
+
+namespace gr {
+ namespace satnogs {
+
+ /*!
+ * \brief <+description of block+>
+ * \ingroup satnogs
+ *
+ */
+ class SATNOGS_API sstv_pd120_sink : virtual public gr::sync_block
+ {
+ public:
+ typedef boost::shared_ptr sptr;
+
+ /*!
+ * \brief Return a shared_ptr to a new instance of satnogs::sstv_pd120_sink.
+ *
+ * To avoid accidental use of raw pointers, satnogs::sstv_pd120_sink's
+ * constructor is in a private implementation
+ * class. satnogs::sstv_pd120_sink::make is the public interface for
+ * creating new instances.
+ */
+ static sptr make(const char *filename_png, bool split);
+ };
+
+ } // namespace satnogs
+} // namespace gr
+
+#endif /* INCLUDED_SATNOGS_SSTV_PD120_SINK_H */
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 998fa24..e71ce2d 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -74,7 +74,8 @@ list(APPEND satnogs_sources
lrpt_decoder_impl.cc
frame_acquisition_impl.cc
shift_reg.cc
- golay24.cc)
+ golay24.cc
+ sstv_pd120_sink_impl.cc)
if(${INCLUDE_DEBUG_BLOCKS})
list(APPEND satnogs_sources ${satnogs_debug_sources})
diff --git a/lib/sstv_pd120_sink_impl.cc b/lib/sstv_pd120_sink_impl.cc
new file mode 100644
index 0000000..8750ae5
--- /dev/null
+++ b/lib/sstv_pd120_sink_impl.cc
@@ -0,0 +1,123 @@
+/* -*- c++ -*- */
+/*
+ * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
+ *
+ * Copyright (C) 2018, Libre Space Foundation
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include
+#include "sstv_pd120_sink_impl.h"
+
+namespace gr {
+ namespace satnogs {
+
+ const size_t image_width = 640;
+ const size_t sync_length = 105;
+ const size_t sync_thresh = 100;
+ const size_t porch_length = 10;
+ const size_t line_length = sync_length + porch_length + 4 * image_width;
+
+ const float max_dev = 600;
+ const float center = 1750;
+ const float min_freq = 1200;
+ const float max_freq = 2300;
+
+ const float color_low = 1500;
+ const float color_high = max_freq;
+
+
+ sstv_pd120_sink::sptr
+ sstv_pd120_sink::make(const char *filename_png, bool split)
+ {
+ return gnuradio::get_initial_sptr
+ (new sstv_pd120_sink_impl(filename_png, split));
+ }
+
+ /*
+ * The private constructor
+ */
+ sstv_pd120_sink_impl::sstv_pd120_sink_impl(const char *filename_png, bool split)
+ : gr::sync_block("sstv_pd120_sink",
+ gr::io_signature::make (1, 1, sizeof(float)),
+ gr::io_signature::make (0, 0, 0)),
+ d_filename_png (filename_png),
+ d_split (split),
+ d_has_sync(false)
+ {
+ set_history(sync_length);
+ d_line = new float[line_length];
+ }
+
+ /*
+ * Our virtual destructor.
+ */
+ sstv_pd120_sink_impl::~sstv_pd120_sink_impl()
+ {
+ delete[] d_line;
+ }
+
+ float
+ sstv_pd120_sink_impl::to_frequency(float sample) {
+ float freq = center + sample * max_dev;
+ freq = std::max(min_freq, freq);
+ freq = std::min(max_freq, freq);
+ return freq;
+ }
+
+ bool
+ sstv_pd120_sink_impl::is_sync(size_t pos, const float *samples) {
+ size_t count = 0;
+ for(size_t i = 0; i < sync_length; i++) {
+ float sample = to_frequency(samples[pos - (sync_length - 1) + i]);
+ if(sample < color_low) {
+ count += 1;
+ }
+ }
+
+ bool res = count > sync_length && !d_has_sync;
+ d_has_sync = count > sync_length;
+
+ std::cout << "Count: " << count << " " << d_has_sync << std::endl;
+
+ return res;
+ }
+
+ int
+ sstv_pd120_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *) input_items[0];
+
+ std::cout << "foo" << std::endl;
+ for (size_t i = sync_length - 1;
+ i < noutput_items + sync_length - 1; i++) {
+
+ if(is_sync(i, in)) {
+ std::cout << "Sync: " << i << std::endl;
+ }
+ }
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+ }
+
+ } /* namespace satnogs */
+} /* namespace gr */
diff --git a/lib/sstv_pd120_sink_impl.h b/lib/sstv_pd120_sink_impl.h
new file mode 100644
index 0000000..b831563
--- /dev/null
+++ b/lib/sstv_pd120_sink_impl.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
+ *
+ * Copyright (C) 2018, Libre Space Foundation
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+
+#ifndef INCLUDED_SATNOGS_SSTV_PD120_SINK_IMPL_H
+#define INCLUDED_SATNOGS_SSTV_PD120_SINK_IMPL_H
+
+#include
+
+namespace gr {
+ namespace satnogs {
+
+ class sstv_pd120_sink_impl : public sstv_pd120_sink
+ {
+ private:
+ std::string d_filename_png;
+ bool d_split;
+ bool d_has_sync;
+
+ float *d_line;
+
+ float to_frequency(float sample);
+ bool is_sync(size_t pos, const float *samples);
+
+ public:
+ sstv_pd120_sink_impl(const char *filename_png, bool split);
+ ~sstv_pd120_sink_impl();
+
+ // Where all the action really happens
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } // namespace satnogs
+} // namespace gr
+
+#endif /* INCLUDED_SATNOGS_SSTV_PD120_SINK_IMPL_H */
diff --git a/swig/satnogs_swig0.i b/swig/satnogs_swig0.i
index 40d4064..b9933b9 100644
--- a/swig/satnogs_swig0.i
+++ b/swig/satnogs_swig0.i
@@ -33,6 +33,7 @@
#include "satnogs/ogg_encoder.h"
#include "satnogs/ogg_source.h"
#include "satnogs/noaa_apt_sink.h"
+#include "satnogs/sstv_pd120_sink.h"
#include "satnogs/frame_file_sink.h"
#include "satnogs/iq_sink.h"
#include "satnogs/quad_demod_filter_ff.h"
@@ -103,6 +104,9 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, ogg_source);
%include "satnogs/noaa_apt_sink.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, noaa_apt_sink);
+%include "satnogs/sstv_pd120_sink.h"
+GR_SWIG_BLOCK_MAGIC2(satnogs, sstv_pd120_sink);
+
%include "satnogs/frame_file_sink.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, frame_file_sink);