minor changes to defaults, re-enabled support for changing callsign when running...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 13 Aug 2013 02:22:40 +0000 (02:22 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 13 Aug 2013 02:22:40 +0000 (02:22 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1328 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/src/fdmdv2_main.cpp
fdmdv2/src/fdmdv2_main.h
fdmdv2/src/hamlib.cpp
fdmdv2/src/hamlib.h
fdmdv2/src/version.h

index fbdc8ca225b0e63d8691a8992f9ff8b2bfbd2f39..5d7a8de753a955a66a2e302b8710dfffede2b17b 100644 (file)
@@ -318,9 +318,9 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
     wxGetApp().m_strHamlibSerialPort = pConfig->Read("/Hamlib/SerialPort", "");
     
     wxGetApp().m_boolUseSerialPTT   = pConfig->ReadBool(wxT("/Rig/UseSerialPTT"),   false);
-    wxGetApp().m_strRigCtrlPort     = pConfig->Read(wxT("/Rig/Port"),               wxT("COM3"));
+    wxGetApp().m_strRigCtrlPort     = pConfig->Read(wxT("/Rig/Port"),               wxT(""));
     wxGetApp().m_boolUseRTS         = pConfig->ReadBool(wxT("/Rig/UseRTS"),         true);
-    wxGetApp().m_boolRTSPos         = pConfig->ReadBool(wxT("/Rig/RTSPolarity"),    false);
+    wxGetApp().m_boolRTSPos         = pConfig->ReadBool(wxT("/Rig/RTSPolarity"),    true);
     wxGetApp().m_boolUseDTR         = pConfig->ReadBool(wxT("/Rig/UseDTR"),         false);
     wxGetApp().m_boolDTRPos         = pConfig->ReadBool(wxT("/Rig/DTRPolarity"),    false);
 
@@ -445,6 +445,8 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
     g_total_bit_errors = 0;
     g_total_bits = 0;
     wxGetApp().m_testFrames = false;
+
+    m_modal = false;
 }
 
 //-------------------------------------------------------------------------
@@ -906,13 +908,18 @@ int MainApp::FilterEvent(wxEvent& event)
     if ((event.GetEventType() == wxEVT_KEY_DOWN) && 
         (((wxKeyEvent&)event).GetKeyCode() == WXK_SPACE))
         {
-            if (frame->m_RxRunning) {
+            // only use space to toggle PTT if we are running and no modal dialogs (like options) up
+
+            if (frame->m_RxRunning && !frame->m_modal) {
                 if (frame->m_btnTogPTT->GetValue())
                     frame->m_btnTogPTT->SetValue(false);
                 else
                     frame->m_btnTogPTT->SetValue(true);
 
                 frame->togglePTT();
+
+                return true; // absorb space so we don't toggle control with focus (e.g. Start)
+
             }
         }
 
@@ -949,9 +956,9 @@ void MainFrame::togglePTT(void) {
     // Hamlib PTT
 
     if (wxGetApp().m_boolHamlibUseForPTT) {        
-        Hamlib *rig = wxGetApp().m_hamlib; 
-        if (wxGetApp().m_boolHamlibUseForPTT && rig != NULL) {
-            rig->ptt(g_tx);
+        Hamlib *hamlib = wxGetApp().m_hamlib; 
+        if (wxGetApp().m_boolHamlibUseForPTT && hamlib != NULL) {
+            hamlib->ptt(g_tx);
         }
     }
 
@@ -1437,7 +1444,9 @@ void MainFrame::OnToolsOptions(wxCommandEvent& event)
 {
     wxUnusedVar(event);
     OptionsDlg *dlg = new OptionsDlg(NULL);
+    m_modal=true;
     dlg->ShowModal();
+    m_modal=false;
     delete dlg;
 }
 
@@ -1446,7 +1455,6 @@ void MainFrame::OnToolsOptions(wxCommandEvent& event)
 //-------------------------------------------------------------------------
 void MainFrame::OnToolsOptionsUI(wxUpdateUIEvent& event)
 {
-    event.Enable(!m_RxRunning);
 }
 
 //-------------------------------------------------------------------------
@@ -1466,6 +1474,7 @@ void MainFrame::OnToolsComCfg(wxCommandEvent& event)
     {
         if (wxGetApp().m_boolHamlibUseForPTT) {
             OpenHamlibRig();
+            wxGetApp().m_hamlib->close();
         }
         if (wxGetApp().m_boolUseSerialPTT) {
             SetupSerialPort();
@@ -1586,7 +1595,7 @@ bool MainFrame::OpenHamlibRig() {
     bool status = wxGetApp().m_hamlib->connect(rig, port.mb_str(wxConvUTF8));
     if (status == false)
         wxMessageBox("Couldn't connect to Radio with hamlib", wxT("About"), wxOK | wxICON_ERROR, this);
-
     return status;
 } 
 
@@ -1735,9 +1744,10 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
         // ensure we are not transmitting and shut down audio processing
 
         if (wxGetApp().m_boolHamlibUseForPTT) {
-            Hamlib *rig = wxGetApp().m_hamlib; 
-            if (wxGetApp().m_boolHamlibUseForPTT && rig != NULL) {
-                rig->ptt(false);
+            Hamlib *hamlib = wxGetApp().m_hamlib; 
+            if (wxGetApp().m_boolHamlibUseForPTT && hamlib != NULL) {
+                hamlib->ptt(false);
+                hamlib->close();
             }
         }
 
index 57f7db95d06340bc87c4bb5c0e0b10027e69888a..dcddff8772e3c54d03b12e540f5e8e53add8abef 100644 (file)
@@ -339,6 +339,8 @@ class MainFrame : public TopFrame
         void                    CloseSerialPort(void);
         void                    SerialPTTRx(void);
 
+        bool                    m_modal;
+
 #ifdef _USE_TIMER
         wxTimer                 m_plotTimer;
 #endif
index 254b8d55a887b31386c97d2474276afa967a595a..547fd0c955d64392b9d5c715c129eae8b5b5530a 100644 (file)
@@ -45,8 +45,6 @@ Hamlib::Hamlib() : m_rig(NULL) {
 }
 
 Hamlib::~Hamlib() {
-    rig_close(m_rig);
-    rig_cleanup(m_rig);
 }
 
 static int build_list(const struct rig_caps *rig, rig_ptr_t rigList) {
@@ -108,3 +106,9 @@ bool Hamlib::ptt(bool press) {
     /* TODO(Joel): what should the VFO option be? */
     return rig_set_ptt(m_rig, RIG_VFO_CURR, on) == RIG_OK;
 }
+
+void Hamlib::close(void) {
+    rig_close(m_rig);
+    rig_cleanup(m_rig);
+    free(m_rig);
+}
index b5942b3b5bb8c184461a523fcf4ea7ac230dc871..fe3496ff26ece41b36d31e9b479cced9a7c033f6 100644 (file)
@@ -15,6 +15,7 @@ class Hamlib {
         void populateComboBox(wxComboBox *cb);
         bool connect(unsigned int rig_index, const char *serial_port);
         bool ptt(bool press);
+        void close(void);
 
         typedef std::vector<const struct rig_caps *> riglist_t;
 
index 5a39f0ddf5b25524ba37fa41358a132771c6255a..9337e2bb5500a08fef8d24e26596598307009c5e 100644 (file)
@@ -3,9 +3,9 @@
 
 #define FREEDV_VERSION_MAJOR 0
 #define FREEDV_VERSION_MINOR 96
-#define FREEDV_VERSION_PATCH 3
+#define FREEDV_VERSION_PATCH 5
 #define FREEDV_VERSION_SUFFIX "Beta"
 
-#define FREEDV_VERSION "0.96.3 Beta"
+#define FREEDV_VERSION "0.96.5 Beta"
 
 #endif //FREEDV_VER_DOT_H