diff --git a/README.md b/README.md index d4428a2..3382732 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ for decoding signals from various scientific and academic sattelites. * CMake ( > 3.1) * G++ (with C++11 support) * VOLK -* libogg +* libogg * libvorbis * libpng +* libpng++ * git **Optional** @@ -34,12 +35,12 @@ If this is the first time you are building the gr-satnogs module run By default, the **SatNOGS** module will use the default installation prefix. This highly depends on the Linux distribution. You can use the `CMAKE_INSTALL_PREFIX` variable to alter the default installation path. -E.g: +E.g: `cmake -DCMAKE_INSTALL_PREFIX=/usr ..` Also, by default the build system enables a set of blocks used for debugging -during the development. The enable/disable switch is controled through the +during the development. The enable/disable switch is controled through the `INCLUDE_DEBUG_BLOCKS` boolean variable. If for example, you want to disable the debugging blocks, the **CMake** command would be: @@ -64,4 +65,4 @@ For more indormation about SatNOGS please visit our [site](https://satnogs.org/) © 2016,2017 [Libre Space Foundation](http://librespacefoundation.org). -Licensed under the [GPLv3](LICENSE). \ No newline at end of file +Licensed under the [GPLv3](LICENSE). diff --git a/lib/noaa_apt_sink_impl.cc b/lib/noaa_apt_sink_impl.cc index e405736..efd61e6 100644 --- a/lib/noaa_apt_sink_impl.cc +++ b/lib/noaa_apt_sink_impl.cc @@ -31,6 +31,8 @@ namespace gr { namespace satnogs { + // Noaa apt sync pattern A + // (see https://sourceforge.isae.fr/attachments/download/1813/apt_synch.gif) const bool SYNCA_SEQ[] = {false, false, false, false, true, true, false, false, // Pulse 1 true, true, false, false, // Pulse 2 @@ -42,6 +44,8 @@ namespace gr false, false, false, false, false, false, false, false}; + // Noaa apt sync pattern B + // (see https://sourceforge.isae.fr/attachments/download/1813/apt_synch.gif) const bool SYNCB_SEQ[] = {false, false, false, false, true, true, true, false, false, true, true, true, false, false, @@ -63,6 +67,7 @@ namespace gr flip)); } + /* * The private constructor */ @@ -90,6 +95,7 @@ namespace gr init_images(); } + void noaa_apt_sink_impl::init_images () { size_t len = d_filename_png.size(); @@ -109,6 +115,7 @@ namespace gr } } + void noaa_apt_sink_impl::write_image (png::image image, std::string filename) { if(d_flip) { @@ -130,6 +137,7 @@ namespace gr } } + void noaa_apt_sink_impl::write_images () { write_image(d_full_image, d_full_filename); @@ -140,6 +148,7 @@ namespace gr } } + noaa_apt_sink_impl::~noaa_apt_sink_impl () { write_images(); } @@ -159,6 +168,7 @@ namespace gr } } + void noaa_apt_sink_impl::skip_to (size_t new_x, size_t pos, const float *samples) { if(new_x > d_current_x) { @@ -170,6 +180,7 @@ namespace gr d_current_x = new_x; } + noaa_apt_sync_marker noaa_apt_sink_impl::is_marker(size_t pos, const float *samples) { size_t count_a = 0; @@ -199,6 +210,7 @@ namespace gr } } + int noaa_apt_sink_impl::work (int noutput_items, gr_vector_const_void_star &input_items, @@ -217,7 +229,6 @@ namespace gr if(d_synchronize_opt) { if(is_marker(i, in) == noaa_apt_sync_marker::SYNC_A) { skip_to(39, i, in); - } else if(is_marker(i, in) == noaa_apt_sync_marker::SYNC_B) { skip_to(d_width / 2 + 39, i, in); diff --git a/lib/noaa_apt_sink_impl.h b/lib/noaa_apt_sink_impl.h index 448add2..60357a5 100644 --- a/lib/noaa_apt_sink_impl.h +++ b/lib/noaa_apt_sink_impl.h @@ -71,21 +71,33 @@ namespace gr gr_vector_void_star &output_items); private: + // Generate empty images and filenames to save them to void init_images (); + /* + * Check if the history portion of the input contains a sync marker. + * Matches the 40 samples before pos against the patterns. + */ noaa_apt_sync_marker is_marker (size_t pos, const float *samples); + // Set the pixel indicated by coordinates in the images (both full and split) void set_pixel (size_t x, size_t y, float sample); + /* + * Updates d_current_x to new_x, + * while using historical samples to fill any resulting gaps in the images. + */ void skip_to (size_t new_x, size_t pos, const float *samples); + // Write the images to disk void write_images (); + // Write a single image to disk, also takes care of flipping void write_image (png::image image, std::string filename); };