From ed29f8322268c39e53633aae39e4224e3ce64a3d Mon Sep 17 00:00:00 2001 From: drowe67 Date: Wed, 24 Oct 2012 00:20:06 +0000 Subject: [PATCH] fixed axis labels on waterfall and tweaked those on spectrum git-svn-id: https://svn.code.sf.net/p/freetel/code@801 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2/src/fdmdv2_defines.h | 12 +++--- fdmdv2/src/fdmdv2_plot_spectrum.cpp | 16 ++++---- fdmdv2/src/fdmdv2_plot_waterfall_linux.cpp | 44 +++++++++++++++++++--- 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/fdmdv2/src/fdmdv2_defines.h b/fdmdv2/src/fdmdv2_defines.h index 637bd890..96bc9c41 100644 --- a/fdmdv2/src/fdmdv2_defines.h +++ b/fdmdv2/src/fdmdv2_defines.h @@ -32,13 +32,13 @@ #define FDMDV_NSPEC 512 -#define MIN_DB -40.0 // minimum of spectram/waterfall DB axis -#define MAX_DB 0.0 -#define STEP_DB 10.0 +#define MIN_AMP_DB -40.0 // min of spectrogram/waterfall amplitude axis +#define MAX_AMP_DB 0.0 // max of spectrogram/waterfall amplitude axis +#define STEP_AMP_DB 5.0 // amplitude axis step #define BETA 0.1 // constant for time averageing spectrum data -#define MIN_HZ 0 // min freq on Waterfall and Spectrum -#define MAX_HZ 4000 // max freq on Waterfall and Spectrum -#define STEP_HZ 500 // freq step on Waterfall and Spectrum graticule +#define MIN_F_HZ 0 // min freq on Waterfall and Spectrum +#define MAX_F_HZ 4000 // max freq on Waterfall and Spectrum +#define STEP_F_HZ 500 // freq step on Waterfall and Spectrum graticule #define WATERFALL_SECS_Y 5 // number of seconds respresented by y axis of waterfall #define DT 0.1 // time between Waterfall updates #define FS 8000 // FDMDV modem sample rate diff --git a/fdmdv2/src/fdmdv2_plot_spectrum.cpp b/fdmdv2/src/fdmdv2_plot_spectrum.cpp index 2f278681..263f8697 100644 --- a/fdmdv2/src/fdmdv2_plot_spectrum.cpp +++ b/fdmdv2/src/fdmdv2_plot_spectrum.cpp @@ -69,7 +69,6 @@ PlotSpectrum::~PlotSpectrum() // OnSize() //---------------------------------------------------------------- void PlotSpectrum::OnSize(wxSizeEvent& event) { - printf("PlotSpectrum::OnSize\n"); } //---------------------------------------------------------------- @@ -77,7 +76,6 @@ void PlotSpectrum::OnSize(wxSizeEvent& event) { //---------------------------------------------------------------- void PlotSpectrum::OnPaint(wxPaintEvent& event) { - printf("PlotSpectrum::OnPaint\n"); wxAutoBufferedPaintDC dc(this); draw(dc); } @@ -179,7 +177,7 @@ void PlotSpectrum::drawGraticule(wxAutoBufferedPaintDC& dc) int x, y, text_w, text_h; char buf[15]; wxString s; - float f, dB, freq_hz_to_px, ampl_dB_to_px; + float f, amplitude, freq_hz_to_px, ampl_dB_to_py; wxBrush ltGraphBkgBrush; ltGraphBkgBrush.SetStyle(wxBRUSHSTYLE_TRANSPARENT); @@ -187,8 +185,8 @@ void PlotSpectrum::drawGraticule(wxAutoBufferedPaintDC& dc) dc.SetBrush(ltGraphBkgBrush); dc.SetPen(wxPen(BLACK_COLOR, 1)); - freq_hz_to_px = (float)m_rGrid.GetWidth()/(MAX_HZ-MIN_HZ); - ampl_dB_to_px = (float)m_rGrid.GetHeight()/(MAX_DB-MIN_DB); + freq_hz_to_px = (float)m_rGrid.GetWidth()/(MAX_F_HZ-MIN_F_HZ); + ampl_dB_to_py = (float)m_rGrid.GetHeight()/(MAX_AMP_DB-MIN_AMP_DB); // upper LH coords of plot area are (PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER) // lower RH coords of plot area are (PLOT_BORDER + XLEFT_OFFSET + m_rGrid.GetWidth(), @@ -198,7 +196,7 @@ void PlotSpectrum::drawGraticule(wxAutoBufferedPaintDC& dc) dc.SetPen(m_penShortDash); - for(f=STEP_HZ; f 255) intensity = 255; if (intensity < 0) intensity = 0; //printf("%d %f %d \n", index, g_avmag[index], intensity); -- 2.25.1