No more segfault, problem was not in this code. Fixes to the PTT signal polarity...
authorwittend99 <wittend99@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 30 Nov 2012 02:39:08 +0000 (02:39 +0000)
committerwittend99 <wittend99@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 30 Nov 2012 02:39:08 +0000 (02:39 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1090 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/build/fdmdv2.mk
fdmdv2/build/fdmdv2.project
fdmdv2/build/fdmdv2.workspace
fdmdv2/src/fdmdv2_main.cpp
fdmdv2/tests/pa_enum/pa_enum.mk

index 6f14343993e9d7e226e46a125001048a6c876687..8d3cb934fa03f899a2c37e01edd479ecfa7451d6 100644 (file)
@@ -27,7 +27,7 @@ OutputSwitch           :=-o
 LibraryPathSwitch      :=-L\r
 PreprocessorSwitch     :=-D\r
 SourceSwitch           :=-c \r
-OutputFile             :=$(IntermediateDirectory)/$(ProjectName)\r
+OutputFile             :=$(IntermediateDirectory)/freeDV\r
 Preprocessors          :=$(PreprocessorSwitch)__WX__ \r
 ObjectSwitch           :=-o \r
 ArchiveOutputSwitch    := \r
@@ -52,8 +52,8 @@ LibPath                := $(LibraryPathSwitch). $(LibraryPathSwitch)d:/Projects/
 AR       := ar rcus\r
 CXX      := g++\r
 CC       := gcc\r
-CXXFLAGS :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
-CFLAGS   :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
+CXXFLAGS :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1088\"  $(Preprocessors)\r
+CFLAGS   :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1088\"  $(Preprocessors)\r
 \r
 \r
 ##\r
index c501bcca985a42eefba756b44cb055f101092c60..0851d9464953b6bb93a783f4f5a59dd1ba813c81 100644 (file)
@@ -82,7 +82,7 @@
         <Library Value="ctb-0.16.dll"/>
       </Linker>
       <ResourceCompiler Options="$(shell wx-config --rcflags)" Required="no"/>
-      <General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Debug" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="no"/>
+      <General OutputFile="$(IntermediateDirectory)/freeDV" IntermediateDirectory="./Debug" Command="./freeDV.exe" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/>
       <Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
         <![CDATA[]]>
       </Environment>
         <Library Value="ctb-0.16.dll"/>
       </Linker>
       <ResourceCompiler Options="$(shell wx-config --rcflags)" Required="no"/>
-      <General OutputFile="$(IntermediateDirectory)/freeDV" IntermediateDirectory="./Release" Command="./freeDV" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="no"/>
+      <General OutputFile="$(IntermediateDirectory)/freeDV" IntermediateDirectory="./Release" Command="./freeDV.exe" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="no"/>
       <Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
         <![CDATA[]]>
       </Environment>
index 4d780b9d625554fe268ede60157f3812884f7c48..34c1d312c8f91f8a204f3f16a673d125f7ec6a5b 100644 (file)
@@ -16,7 +16,7 @@
       <Project Name="dialogTest" ConfigName="Debug"/>
       <Project Name="bigButtonRig" ConfigName="Debug"/>
     </WorkspaceConfiguration>
-    <WorkspaceConfiguration Name="Release" Selected="yes">
+    <WorkspaceConfiguration Name="Release" Selected="no">
       <Project Name="fdmdv2" ConfigName="Release"/>
       <Project Name="rawbits" ConfigName="Release"/>
       <Project Name="pa_enum" ConfigName="Release"/>
index aac61501f0df41e302f354b8dc6e4d30d42de2f0..9abb37567f47136dd596c032b3ac54d1a7eb500e 100644 (file)
@@ -188,7 +188,9 @@ int MainApp::OnExit()
 MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
 {
     m_zoom              = 1.;
-
+    m_serialPort        = NULL;
+    m_device            = NULL;
+    
     tools->AppendSeparator();
     wxMenuItem* m_menuItemToolsConfigDelete;
     m_menuItemToolsConfigDelete = new wxMenuItem(tools, wxID_ANY, wxString(_("&Restore defaults")) , wxT("Delete config file/keys and restore defaults"), wxITEM_NORMAL);
@@ -837,17 +839,62 @@ void MainFrame::OnTogBtnTXClick(wxCommandEvent& event)
         m_auiNbookCtrl->ChangeSelection(4); // is there a way to avoid hard coding this?
     }
     g_tx = m_btnTogPTT->GetValue();
-    
+    // The following sets and clears may be exactly inverted.  
+    // I don't know and I'm not set up to tell yet.
+    // If so, one just needs to invert the polarity selection
+    // on the Tools>PTT configuration page.
     if(event.IsChecked()) 
     {
-        m_serialPort->SetLineState(ctb::LinestateRts);
+        if(wxGetApp().m_boolUseRTS)
+        {
+            if(wxGetApp().m_boolRTSPos)
+            {
+                m_serialPort->SetLineState(ctb::LinestateRts);
+            }
+            else
+            {
+                m_serialPort->ClrLineState(ctb::LinestateRts);
+            }
+        }
+        else
+        {
+            if(wxGetApp().m_boolRTSPos)
+            {
+                m_serialPort->ClrLineState(ctb::LinestateRts);
+            }
+            else
+            {
+                m_serialPort->SetLineState(ctb::LinestateRts);
+            }
+        }
        // m_btnTogPTT->SetLabel(wxT("PTT"));
     } 
     else 
     {
-        m_serialPort->ClrLineState(ctb::LinestateRts);
+        if(wxGetApp().m_boolUseDTR)
+        {
+            if(wxGetApp().m_boolDTRPos)
+            {
+                m_serialPort->SetLineState(ctb::LinestateDtr);
+            }
+            else
+            {
+                m_serialPort->ClrLineState(ctb::LinestateDtr);
+            }
+        }
+        else
+        {
+            if(wxGetApp().m_boolDTRPos)
+            {
+                m_serialPort->ClrLineState(ctb::LinestateDtr);
+            }
+            else
+            {
+                m_serialPort->SetLineState(ctb::LinestateDtr);
+            }
+        }
        // m_btnTogPTT->SetLabel(wxT("PTT"));
-    }
+    } 
     
     // reset level gauge
     m_maxLevel = 0;
@@ -1291,12 +1338,13 @@ void MainFrame::OnToolsComCfg(wxCommandEvent& event)
 {
     wxUnusedVar(event);
     int rv = 0;
+
+    CloseSerialPort();
     ComPortsDlg *dlg = new ComPortsDlg(NULL);
     rv = dlg->ShowModal();
     if(rv == wxID_OK)
     {
         dlg->ExchangeData(EXCHANGE_DATA_OUT);
-        CloseSerialPort();
         SetupSerialPort();
     }
     delete dlg;
@@ -2452,10 +2500,11 @@ void MainFrame::SetupSerialPort(void)
 //----------------------------------------------------------------
 void MainFrame::CloseSerialPort(void)
 {
-    if(m_serialPort->IsOpen())
+    if((m_serialPort != NULL) && m_serialPort->IsOpen())
     {
         m_serialPort->Close();
-        m_device = NULL; 
+        m_serialPort = NULL;
+        m_device     = NULL; 
         //m_btnTogPTT->SetLabel(wxT("PTT"));
         m_btnTogPTT->Enable(false);
     }
index 0b2ab7ae763a3188af12757f9841dc46208bd349..a969d7863608f9b0fd09968004423a4b428299a0 100644 (file)
@@ -2,12 +2,12 @@
 ## Auto Generated makefile by CodeLite IDE\r
 ## any manual changes will be erased      \r
 ##\r
-## Debug\r
+## Release\r
 ProjectName            :=pa_enum\r
-ConfigurationName      :=Debug\r
+ConfigurationName      :=Release\r
 WorkspacePath          := "D:\Projects\Radio\fdmdv2\build"\r
 ProjectPath            := "D:\Projects\Radio\fdmdv2\tests\pa_enum"\r
-IntermediateDirectory  :=./Debug\r
+IntermediateDirectory  :=./Release\r
 OutDir                 := $(IntermediateDirectory)\r
 CurrentFileName        :=\r
 CurrentFilePath        :=\r
@@ -37,7 +37,7 @@ PCHCompileFlags        :=
 MakeDirCommand         :=makedir\r
 RcCmpOptions           := $(shell wx-config --rcflags)\r
 RcCompilerName         :=windres\r
-LinkOptions            :=  -mwindows $(shell wx-config --debug=yes --libs --unicode=yes)\r
+LinkOptions            :=  -mwindows -s $(shell wx-config --debug=no --libs --unicode=yes)\r
 IncludePath            :=  $(IncludeSwitch). $(IncludeSwitch)/bin/MinGW-4.6.1/msys/1.0/local/include $(IncludeSwitch)../../codec2-dev/src $(IncludeSwitch)/bin/Projects/Audio/libsndfile/ \r
 IncludePCH             := \r
 RcIncludePath          := \r
@@ -52,8 +52,8 @@ LibPath                := $(LibraryPathSwitch). $(LibraryPathSwitch)/bin/MinGW-4
 AR       := ar rcus\r
 CXX      := g++\r
 CC       := gcc\r
-CXXFLAGS :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
-CFLAGS   :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
+CXXFLAGS :=  -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
+CFLAGS   :=  -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
 \r
 \r
 ##\r
@@ -79,7 +79,7 @@ $(OutputFile): $(IntermediateDirectory)/.d $(Objects)
        $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)\r
 \r
 $(IntermediateDirectory)/.d:\r
-       @$(MakeDirCommand) "./Debug"\r
+       @$(MakeDirCommand) "./Release"\r
 \r
 PreBuild:\r
 \r
@@ -128,6 +128,6 @@ clean:
        $(RM) $(IntermediateDirectory)/AudioOptsDialog$(PreprocessSuffix)\r
        $(RM) $(OutputFile)\r
        $(RM) $(OutputFile).exe\r
-       $(RM) "D:\Projects\Radio\fdmdv2\build\.build-debug\pa_enum"\r
+       $(RM) "D:\Projects\Radio\fdmdv2\build\.build-release\pa_enum"\r
 \r
 \r