basic channel simulation feaure to check txt messaging in noise
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 10 Jul 2014 06:18:28 +0000 (06:18 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 10 Jul 2014 06:18:28 +0000 (06:18 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1751 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2-dev/src/dlg_options.cpp
fdmdv2-dev/src/dlg_options.h
fdmdv2-dev/src/fdmdv2_main.cpp
fdmdv2-dev/src/fdmdv2_main.h

index 6acca1182ec307a11c3a1ab0ce3ba047746b6f58..a2a52a78564d8a5557e026f575a7dd463ddf9636 100644 (file)
@@ -44,6 +44,10 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c
     sb_testFrames->SetToolTip(_("Send frames of known bits instead of compressed voice"));
     sbSizer_testFrames->Add(m_ckboxTestFrame, 0, wxALIGN_LEFT, 0);
 
+    m_ckboxChannelNoise = new wxCheckBox(this, wxID_ANY, _("Channel Noise"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    sb_testFrames->SetToolTip(_("Add simulated AWGN channel noise to received signal"));
+    sbSizer_testFrames->Add(m_ckboxChannelNoise, 0, wxALIGN_LEFT, 0);
+
     bSizer30->Add(sbSizer_testFrames,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
 
     //------------------------------
@@ -197,6 +201,7 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
     {
         m_txtCtrlCallSign->SetValue(wxGetApp().m_callSign);
         m_ckboxTestFrame->SetValue(wxGetApp().m_testFrames);
+        m_ckboxChannelNoise->SetValue(wxGetApp().m_channel_noise);
 
         m_ckbox_events->SetValue(wxGetApp().m_events);
         m_txt_spam_timer->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_events_spam_timer));
@@ -217,6 +222,7 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
     {
         wxGetApp().m_callSign      = m_txtCtrlCallSign->GetValue();
         wxGetApp().m_testFrames    = m_ckboxTestFrame->GetValue();
+        wxGetApp().m_channel_noise = m_ckboxChannelNoise->GetValue();
 
         wxGetApp().m_events        = m_ckbox_events->GetValue();
         long spam_timer;
index 498804d59eac2a65e8eabc4881a948b9614fb5da..731532c4db9eadd755b337f2abead15459ce4498 100644 (file)
@@ -67,6 +67,7 @@ class OptionsDlg : public wxDialog
  
         wxTextCtrl   *m_txtCtrlCallSign; // TODO: this should be renamed to tx_txtmsg, and rename all related incl persis strge
         wxCheckBox   *m_ckboxTestFrame;
+        wxCheckBox   *m_ckboxChannelNoise;
 
         wxRadioButton *m_rb_textEncoding1;
         wxRadioButton *m_rb_textEncoding2;
index 6b28cb0ae3247d7f78fc7c70885d29091e69e176..aaaad7b71d7c6afe1111301342b3eec3a3e6df79 100644 (file)
@@ -51,6 +51,7 @@ int                 g_total_bit_errors;
 int                 g_sz_error_pattern;
 short              *g_error_pattern;
 struct FIFO        *g_errorFifo;
+int                 g_channel_noise;
 
 // time averaged magnitude spectrum used for waterfall and spectrum display
 float               g_avmag[FDMDV_NSPEC];
@@ -1041,6 +1042,7 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
         g_total_bit_errors = 0;
     }
     g_testFrames =  wxGetApp().m_testFrames;
+    g_channel_noise =  wxGetApp().m_channel_noise;
 
     if (g_State) {
         char bits[80], errors[80], ber[80];
@@ -3166,6 +3168,11 @@ void per_frame_rx_processing(
             rx_fdm[i].real = (float)input_buf[i] / FDMDV_SCALE;
             rx_fdm[i].imag = 0.0;
         }
+
+        
+        if (g_channel_noise) {
+            fdmdv_simulate_channel(g_pFDMDV, rx_fdm, *nin, 2.0);
+        }
         fdmdv_freq_shift(rx_fdm_offset, rx_fdm, g_RxFreqOffsetHz,  &g_RxFreqOffsetPhaseRect, *nin);
         fdmdv_demod(g_pFDMDV, rx_bits, &reliable_sync_bit, rx_fdm_offset, nin);
 
index c7d1f7dc94554cd5918d35fbf58869aba9019eea..49d4c90cbf9b5b91d9d69a4383cbc2e67326056a 100644 (file)
@@ -243,7 +243,9 @@ class MainApp : public wxApp
 
         // misc
 
-        bool        m_testFrames;
+        bool       m_testFrames;
+        bool       m_channel_noise;
+        float      m_channel_snr_dB;
 
         int        FilterEvent(wxEvent& event);
         MainFrame *frame;