Added minimal documentation

This commit is contained in:
Sebastian 2018-01-03 00:34:32 +01:00 committed by Sebastian
parent dc2cb5ca29
commit 932369429a
3 changed files with 29 additions and 5 deletions

View File

@ -12,6 +12,7 @@ for decoding signals from various scientific and academic sattelites.
* libogg * libogg
* libvorbis * libvorbis
* libpng * libpng
* libpng++
* git * git
**Optional** **Optional**

View File

@ -31,6 +31,8 @@ namespace gr
{ {
namespace satnogs 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, const bool SYNCA_SEQ[] = {false, false, false, false,
true, true, false, false, // Pulse 1 true, true, false, false, // Pulse 1
true, true, false, false, // Pulse 2 true, true, false, false, // Pulse 2
@ -42,6 +44,8 @@ namespace gr
false, false, false, false, false, false, false, false,
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, const bool SYNCB_SEQ[] = {false, false, false, false,
true, true, true, false, false, true, true, true, false, false,
true, true, true, false, false, true, true, true, false, false,
@ -63,6 +67,7 @@ namespace gr
flip)); flip));
} }
/* /*
* The private constructor * The private constructor
*/ */
@ -90,6 +95,7 @@ namespace gr
init_images(); init_images();
} }
void void
noaa_apt_sink_impl::init_images () { noaa_apt_sink_impl::init_images () {
size_t len = d_filename_png.size(); size_t len = d_filename_png.size();
@ -109,6 +115,7 @@ namespace gr
} }
} }
void void
noaa_apt_sink_impl::write_image (png::image<png::gray_pixel> image, std::string filename) { noaa_apt_sink_impl::write_image (png::image<png::gray_pixel> image, std::string filename) {
if(d_flip) { if(d_flip) {
@ -130,6 +137,7 @@ namespace gr
} }
} }
void void
noaa_apt_sink_impl::write_images () { noaa_apt_sink_impl::write_images () {
write_image(d_full_image, d_full_filename); write_image(d_full_image, d_full_filename);
@ -140,6 +148,7 @@ namespace gr
} }
} }
noaa_apt_sink_impl::~noaa_apt_sink_impl () { noaa_apt_sink_impl::~noaa_apt_sink_impl () {
write_images(); write_images();
} }
@ -159,6 +168,7 @@ namespace gr
} }
} }
void void
noaa_apt_sink_impl::skip_to (size_t new_x, size_t pos, const float *samples) { noaa_apt_sink_impl::skip_to (size_t new_x, size_t pos, const float *samples) {
if(new_x > d_current_x) { if(new_x > d_current_x) {
@ -170,6 +180,7 @@ namespace gr
d_current_x = new_x; d_current_x = new_x;
} }
noaa_apt_sync_marker noaa_apt_sync_marker
noaa_apt_sink_impl::is_marker(size_t pos, const float *samples) { noaa_apt_sink_impl::is_marker(size_t pos, const float *samples) {
size_t count_a = 0; size_t count_a = 0;
@ -199,6 +210,7 @@ namespace gr
} }
} }
int int
noaa_apt_sink_impl::work (int noutput_items, noaa_apt_sink_impl::work (int noutput_items,
gr_vector_const_void_star &input_items, gr_vector_const_void_star &input_items,
@ -217,7 +229,6 @@ namespace gr
if(d_synchronize_opt) { if(d_synchronize_opt) {
if(is_marker(i, in) == noaa_apt_sync_marker::SYNC_A) { if(is_marker(i, in) == noaa_apt_sync_marker::SYNC_A) {
skip_to(39, i, in); skip_to(39, i, in);
} }
else if(is_marker(i, in) == noaa_apt_sync_marker::SYNC_B) { else if(is_marker(i, in) == noaa_apt_sync_marker::SYNC_B) {
skip_to(d_width / 2 + 39, i, in); skip_to(d_width / 2 + 39, i, in);

View File

@ -71,21 +71,33 @@ namespace gr
gr_vector_void_star &output_items); gr_vector_void_star &output_items);
private: private:
// Generate empty images and filenames to save them to
void void
init_images (); 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 noaa_apt_sync_marker
is_marker (size_t pos, const float *samples); is_marker (size_t pos, const float *samples);
// Set the pixel indicated by coordinates in the images (both full and split)
void void
set_pixel (size_t x, size_t y, float sample); 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 void
skip_to (size_t new_x, size_t pos, const float *samples); skip_to (size_t new_x, size_t pos, const float *samples);
// Write the images to disk
void void
write_images (); write_images ();
// Write a single image to disk, also takes care of flipping
void void
write_image (png::image<png::gray_pixel> image, std::string filename); write_image (png::image<png::gray_pixel> image, std::string filename);
}; };