hooked up sync LED, changed SNR text box to static text to prevent it getting focus
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 8 Nov 2012 01:35:43 +0000 (01:35 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 8 Nov 2012 01:35:43 +0000 (01:35 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@949 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/src/fdmdv2_main.cpp
fdmdv2/src/topFrame.cpp
fdmdv2/src/topFrame.h

index 02f06baf9662c4f1505ab8c5a4754d0d51ad3618..f52652c26fe9378ad54f60ab503b7b571a5627ad 100644 (file)
@@ -42,24 +42,32 @@ struct CODEC2      *g_pCodec2;
 struct FDMDV       *g_pFDMDV;
 struct FDMDV_STATS  g_stats;
 
+// time averaged magnitude spectrum used for waterfall and spectrum display
+float               g_avmag[FDMDV_NSPEC];
+
+// rx processing states
+int                 g_nRxIn = FDMDV_NOM_SAMPLES_PER_FRAME;
+int                 g_CodecBits[2 * FDMDV_BITS_PER_FRAME];
+int                 g_State = 0;
+
 // FIFOs used for plotting waveforms
-struct FIFO  *g_plotDemodInFifo;
-struct FIFO  *g_plotSpeechOutFifo;
-struct FIFO  *g_plotSpeechInFifo;
+struct FIFO        *g_plotDemodInFifo;
+struct FIFO        *g_plotSpeechOutFifo;
+struct FIFO        *g_plotSpeechInFifo;
 
 // Soundcard config
-int g_nSoundCards = 2;
-int g_soundCard1InDeviceNum = 0;
-int g_soundCard1OutDeviceNum = 0;
-int g_soundCard1SampleRate = 48000;
-int g_soundCard2InDeviceNum = 1;
-int g_soundCard2OutDeviceNum = 1;
-int g_soundCard2SampleRate = 44100;
+int                 g_nSoundCards = 1;
+int                 g_soundCard1InDeviceNum = 0;
+int                 g_soundCard1OutDeviceNum = 0;
+int                 g_soundCard1SampleRate = 48000;
+int                 g_soundCard2InDeviceNum = 1;
+int                 g_soundCard2OutDeviceNum = 1;
+int                 g_soundCard2SampleRate = 44100;
 
 // Click to tune rx frequency offset states
-float g_RxFreqOffsetHz;
-COMP  g_RxFreqOffsetPhaseRect;
-COMP  g_RxFreqOffsetFreqRect;
+float               g_RxFreqOffsetHz;
+COMP                g_RxFreqOffsetPhaseRect;
+COMP                g_RxFreqOffsetFreqRect;
 
 // DRs debug variables, will be cleaned up eventually
 int cb_cnt, cb1, cb2;
@@ -71,9 +79,10 @@ FILE *g_write_file;
 int sc1, sc2;
 int g_outfifo2_empty;
 
+// experimental mutex to make sound card callbacks mutually exclusive
 wxMutex g_mutexProtectingCallbackData;
 
-// initialize the application
+// WxWidgets - initialize the application
 IMPLEMENT_APP(MainApp);
 
 //-------------------------------------------------------------------------
@@ -344,9 +353,13 @@ MainFrame::~MainFrame()
 //----------------------------------------------------------------
 // OnTimer()
 //----------------------------------------------------------------
+
+// when the timer fires every DT seconds we update the GUI displays
+// On the tabbed display that is visible actually gets updated, this
+// keeps CPU load reasonable
+
 void MainFrame::OnTimer(wxTimerEvent &evt)
 {
-    // when the timer fires every DT seconds we update the GUI displays
 
     m_panelWaterfall->m_newdata = true;
     m_panelWaterfall->Refresh();
@@ -363,6 +376,8 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
     m_panelFreqOffset->add_new_sample(g_stats.foff);
     m_panelFreqOffset->Refresh();
 
+    // Oscilliscope type speech plots -------------------------------------------------------
+
     short speechInPlotSamples[WAVEFORM_PLOT_BUF];
     fifo_read(g_plotSpeechInFifo, speechInPlotSamples, WAVEFORM_PLOT_BUF);
     m_panelSpeechIn->add_new_short_samples(speechInPlotSamples, WAVEFORM_PLOT_BUF, 32767);
@@ -378,16 +393,27 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
     m_panelDemodIn->add_new_short_samples(demodInPlotSamples, WAVEFORM_PLOT_BUF, 32767);
     m_panelDemodIn->Refresh();
 
+    // SNR text box and guage ------------------------------------------------------------
+
     char snr[15];
     sprintf(snr, "%2.1f", g_stats.snr_est);
     wxString snr_string(snr);
-    m_textSNR->ChangeValue(snr_string);
+    //m_textSNR->ChangeValue(snr_string);
+    m_textSNR->SetLabel(snr_string);
 
-    m_gaugeSNR->SetRange(20);
+    m_gaugeSNR->SetRange(20); // 0 to 20dB seems sensible
     int snr_limited = g_stats.snr_est;
     if (snr_limited < 0) snr_limited = 0;
     if (snr_limited > 20) snr_limited = 20;
     m_gaugeSNR->SetValue(snr_limited);
+
+    // sync LED
+
+    if (g_State)
+        m_rbSync->SetForegroundColour( wxColour( 0, 255, 0 ) );
+    else
+        m_rbSync->SetForegroundColour( wxColour( 255, 0, 0 ) );
+
 }
 #endif
 
@@ -1004,17 +1030,6 @@ void MainFrame::OnTogBtnLoopTx( wxCommandEvent& event )
 
 }
 
-//----------------------------------------------------------
-// Rx processing loop states (globals).
-//----------------------------------------------------------
-
-int             g_nRxIn = FDMDV_NOM_SAMPLES_PER_FRAME;
-float           g_Ts = 0.0;
-
-int             g_CodecBits[2 * FDMDV_BITS_PER_FRAME];
-int             g_State = 0;
-
-float           g_avmag[FDMDV_NSPEC];
 
 void MainFrame::destroy_fifos(void)
 {
index d6425badd73a3e97346b9ab1e8575fdc05d1bb94..fd09a907e14d4ec7c5443d65884ddb03e9b1a402 100644 (file)
@@ -157,7 +157,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     //------------------------------
     // Box for S/N ratio (Numeric)
     //------------------------------
-    m_textSNR = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxPoint(-1,-1), wxSize(35,25), wxTE_READONLY);
+    m_textSNR = new wxStaticText(this, wxID_ANY, wxEmptyString, wxPoint(-1,-1), wxSize(35,25), wxTE_READONLY);
     m_textSNR->SetToolTip(_("Show S/N ratio numerically."));
     m_textSNR->SetMinSize(wxSize(35,25));
     bSizer29->Add(m_textSNR, 0, wxALIGN_CENTER|wxALL, 1);
index 3a144210e5efde1d52e6eae40d8711732daebe79..3bb5885696104d6a97f90fbaf4ec96acb16bb943 100644 (file)
@@ -67,7 +67,7 @@ class TopFrame : public wxFrame
         wxMenu* tools;
         wxMenu* help;
         wxGauge* m_gaugeSNR;
-        wxTextCtrl* m_textSNR;
+        wxStaticText* m_textSNR;
         wxGauge* m_gaugeLevel;
         wxTextCtrl* m_txtCtrl;
         wxSlider* m_sliderSQ;