added checkbox to control freedv 700 clipper
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 17 Jun 2015 21:09:21 +0000 (21:09 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 17 Jun 2015 21:09:21 +0000 (21:09 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2203 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2-dev/README.txt
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 4df4cadb0cb3315e0f08dff2092a61f864435ad8..2a452f5a26a43a9f8d4188ceeff6d4e8e91e2f43 100644 (file)
@@ -75,6 +75,7 @@ Quickstart 2
 6/ Build All the libraries and FreeDV:
 
   $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SNDFILE=TRUE -DUSE_STATIC_SAMPLERATE=TRUE -DUSE_STATIC_SOX=TRUE -DUSE_STATIC_CODEC2=FALSE -DCODEC2_INCLUDE_DIRS=/home/david/tmp/codec2-dev/src -DCODEC2_LIBRARY=/home/david/tmp/codec2-dev/build_windows/src/libcodec2.dll.a -DHAMLIB_INCLUDE_DIR=hamlib-win32-1.2.15.3/include -DHAMLIB_LIBRARY=hamlib-win32-1.2.15.3/lib/gcc/libhamlib.dll.a ..
+  $ make
 
 ====================================
  Building and installing on Windows
@@ -142,6 +143,7 @@ configure emacs:
           (function (lambda ()
                       (setq c-basic-offset 4)
                       )))
+
 ====
 TODO
 ====
@@ -152,14 +154,15 @@ TODO
         [X] varicode, codec, modem states
         [X] tx and rx freq shifts
         [X] generic, mode indep, sync, snr, scatter?
-        [ ] text working on 700 and 1600
-        [ ] char by char text appearing
+        [X] text working on 700 and 1600
+        [X] char by char text appearing
     [ ] add 700 to freedv API
         [X] modem signal spectrum and stats consistent with fdmdv
         [X] rx from file works
         [X] cohpsk snr est
         [X] tx works in full duplex
         [ ] clipper a check box, so we can see difference in spectrum
+            + adjustable at run time
         [ ] analog mode
             + complicated by sample rate change
         [ ] squelch
index 35e5f23a4c961d556e7e979caf29c5d174abd33b..39bbed795f7238425c9aacfe8afbf708d50fd706 100644 (file)
@@ -50,6 +50,20 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c
 
     bSizer30->Add(sbSizer_testFrames,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
 
+    //------------------------------
+    // FreeDV 700 Options
+    //------------------------------
+
+    wxStaticBoxSizer* sbSizer_freedv700;
+    wxStaticBox *sb_freedv700 = new wxStaticBox(this, wxID_ANY, _("FreeDV 700 Clipping"));
+    sbSizer_freedv700 = new wxStaticBoxSizer(sb_freedv700, wxHORIZONTAL);
+
+    m_ckboxFreeDV700txClip = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    m_ckboxFreeDV700txClip->SetToolTip(_("Clip FreeDv 700 tx waveform to reduce Peak to Average Power Ratio (PAPR)"));
+    sbSizer_freedv700->Add(m_ckboxFreeDV700txClip, 0, wxALIGN_LEFT, 0);
+
+    bSizer30->Add(sbSizer_freedv700,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
     //------------------------------
     // Txt Msg Text Box
     //------------------------------
@@ -175,6 +189,8 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c
     m_sdbSizer5Cancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnCancel), NULL, this);
     m_sdbSizer5Apply->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnApply), NULL, this);
 
+    m_ckboxFreeDV700txClip->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700txClip), NULL, this);
+
     event_in_serial = 0;
     event_out_serial = 0;
 }
@@ -191,6 +207,7 @@ OptionsDlg::~OptionsDlg()
     m_sdbSizer5OK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnOK), NULL, this);
     m_sdbSizer5Cancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnCancel), NULL, this);
     m_sdbSizer5Apply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnApply), NULL, this);
+    m_ckboxFreeDV700txClip->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700txClip), NULL, this);
 }
 
 
@@ -221,6 +238,8 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
         if (wxGetApp().m_textEncoding == 2)
             m_rb_textEncoding2->SetValue(true);
         m_ckboxEnableChecksum->SetValue(wxGetApp().m_enable_checksum);
+
+        m_ckboxFreeDV700txClip->SetValue(wxGetApp().m_FreeDV700txClip);
     }
 
     if(inout == EXCHANGE_DATA_OUT)
@@ -256,6 +275,8 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
             wxGetApp().m_textEncoding = 2;
         wxGetApp().m_enable_checksum = m_ckboxEnableChecksum->GetValue();
 
+        wxGetApp().m_FreeDV700txClip = m_ckboxFreeDV700txClip->GetValue();
+
         if (storePersistent) {
             pConfig->Write(wxT("/Data/CallSign"), wxGetApp().m_callSign);
             pConfig->Write(wxT("/Data/TextEncoding"), wxGetApp().m_textEncoding);
@@ -269,6 +290,8 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
             pConfig->Write(wxT("/UDP/enable"), wxGetApp().m_udp_enable);
             pConfig->Write(wxT("/UDP/port"),  wxGetApp().m_udp_port);
 
+            pConfig->Write(wxT("/FreeDV700/txClip"), wxGetApp().m_FreeDV700txClip);
+
             pConfig->Flush();
         }
     }
@@ -310,6 +333,12 @@ void OptionsDlg::OnInitDialog(wxInitDialogEvent& event)
     ExchangeData(EXCHANGE_DATA_IN, false);
 }
 
+// immediately change flags rather using ExchangeData() so we can switch on and off at run time
+
+void OptionsDlg::OnFreeDV700txClip(wxScrollEvent& event) {
+    wxGetApp().m_FreeDV700txClip = m_ckboxFreeDV700txClip->GetValue();
+}
+
 
 void OptionsDlg::updateEventLog(wxString event_in, wxString event_out) {
     wxString event_in_with_serial, event_out_with_serial; 
index 2191de1a5bca8a5e420062f0415f7bc1474a2e17..fe355ac253c5a0387b40100a9ff57c1507dbd37f 100644 (file)
@@ -33,7 +33,7 @@ class OptionsDlg : public wxDialog
     public:
     OptionsDlg( wxWindow* parent,
                wxWindowID id = wxID_ANY, const wxString& title = _("Options"), 
-                const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,600), 
+                const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,630), 
                long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
         ~OptionsDlg();
 
@@ -65,9 +65,12 @@ class OptionsDlg : public wxDialog
         void    OnClose(wxCloseEvent& event);
         void    OnInitDialog(wxInitDialogEvent& event);
  
+        void    OnFreeDV700txClip(wxScrollEvent& event);
+
         wxTextCtrl   *m_txtCtrlCallSign; // TODO: this should be renamed to tx_txtmsg, and rename all related incl persis strge
         wxCheckBox   *m_ckboxTestFrame;
         wxCheckBox   *m_ckboxChannelNoise;
+        wxCheckBox   *m_ckboxFreeDV700txClip;
 
         wxRadioButton *m_rb_textEncoding1;
         wxRadioButton *m_rb_textEncoding2;
index 6755c796c6dfb7d937391db4aad0f1bcc9d42c58..cf3b3be3a8019adf92cc3704672ced62deb114fd 100644 (file)
@@ -394,6 +394,8 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
     wxGetApp().m_udp_enable = (float)pConfig->Read(wxT("/UDP/enable"), f);
     wxGetApp().m_udp_port = (int)pConfig->Read(wxT("/UDP/port"), 3000);
 
+    wxGetApp().m_FreeDV700txClip = (float)pConfig->Read(wxT("/FreeDV700/txClip"), t);
+
     pConfig->SetPath(wxT("/"));
 
 //    this->Connect(m_menuItemHelpUpdates->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnHelpCheckUpdatesUI));
@@ -579,6 +581,8 @@ MainFrame::~MainFrame()
 
         pConfig->Write(wxT("/Filter/MicInEQEnable"), wxGetApp().m_MicInEQEnable);
         pConfig->Write(wxT("/Filter/SpkOutEQEnable"), wxGetApp().m_SpkOutEQEnable);
+
+        pConfig->Write(wxT("/FreeDV700/txClip"), wxGetApp().m_FreeDV700txClip);
     }
 
     //m_togRxID->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnRxIDUI), NULL, this);
@@ -1042,6 +1046,11 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
     g_rxUserdata->micInEQEnable = wxGetApp().m_MicInEQEnable;
     g_rxUserdata->spkOutEQEnable = wxGetApp().m_SpkOutEQEnable;
 
+    // Run time update of FreeDV 700 tx clipper
+
+    g_pfreedv->clip = (int)wxGetApp().m_FreeDV700txClip;
+    //fprintf(stderr, "g_pfreedv->clip: %d\n",  g_pfreedv->clip);
+
     // Test Frame Bit Error Updates ------------------------------------
 
     // Toggle test frame mode at run time
index fe33346a1285a63ece1998668f37bcc54e03157e..72e3e270a2a9f1ba205e38e6d535317c8fb33e63 100644 (file)
@@ -252,6 +252,8 @@ class MainApp : public wxApp
 
         int        FilterEvent(wxEvent& event);
         MainFrame *frame;
+
+        bool       m_FreeDV700txClip;
     protected:
 };
 
@@ -596,6 +598,8 @@ void per_frame_rx_processing(
                                         FIFO    *input_fifo     // modem samples input to demod
                                     );
 
+// FreeDv API calls these puppies when it needs/receives a text char 
+
 char my_get_next_tx_char(void *callback_state);
 void my_put_next_rx_char(void *callback_state, char c);