From ee73b6df1b8c0d3071be8708518bd5682cc2a2b0 Mon Sep 17 00:00:00 2001 From: wittend99 Date: Fri, 30 Nov 2012 02:39:08 +0000 Subject: [PATCH] No more segfault, problem was not in this code. Fixes to the PTT signal polarity, should work now, but not properly tested. git-svn-id: https://svn.code.sf.net/p/freetel/code@1090 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2/build/fdmdv2.mk | 6 +-- fdmdv2/build/fdmdv2.project | 4 +- fdmdv2/build/fdmdv2.workspace | 2 +- fdmdv2/src/fdmdv2_main.cpp | 65 +++++++++++++++++++++++++++++---- fdmdv2/tests/pa_enum/pa_enum.mk | 16 ++++---- 5 files changed, 71 insertions(+), 22 deletions(-) diff --git a/fdmdv2/build/fdmdv2.mk b/fdmdv2/build/fdmdv2.mk index 6f143439..8d3cb934 100644 --- a/fdmdv2/build/fdmdv2.mk +++ b/fdmdv2/build/fdmdv2.mk @@ -27,7 +27,7 @@ OutputSwitch :=-o LibraryPathSwitch :=-L PreprocessorSwitch :=-D SourceSwitch :=-c -OutputFile :=$(IntermediateDirectory)/$(ProjectName) +OutputFile :=$(IntermediateDirectory)/freeDV Preprocessors :=$(PreprocessorSwitch)__WX__ ObjectSwitch :=-o ArchiveOutputSwitch := @@ -52,8 +52,8 @@ LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)d:/Projects/ AR := ar rcus CXX := g++ CC := gcc -CXXFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) -DSVN_REVISION=\"1083\" $(Preprocessors) -CFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) -DSVN_REVISION=\"1083\" $(Preprocessors) +CXXFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) -DSVN_REVISION=\"1088\" $(Preprocessors) +CFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) -DSVN_REVISION=\"1088\" $(Preprocessors) ## diff --git a/fdmdv2/build/fdmdv2.project b/fdmdv2/build/fdmdv2.project index c501bcca..0851d946 100644 --- a/fdmdv2/build/fdmdv2.project +++ b/fdmdv2/build/fdmdv2.project @@ -82,7 +82,7 @@ - + @@ -135,7 +135,7 @@ - + diff --git a/fdmdv2/build/fdmdv2.workspace b/fdmdv2/build/fdmdv2.workspace index 4d780b9d..34c1d312 100644 --- a/fdmdv2/build/fdmdv2.workspace +++ b/fdmdv2/build/fdmdv2.workspace @@ -16,7 +16,7 @@ - + diff --git a/fdmdv2/src/fdmdv2_main.cpp b/fdmdv2/src/fdmdv2_main.cpp index aac61501..9abb3756 100644 --- a/fdmdv2/src/fdmdv2_main.cpp +++ b/fdmdv2/src/fdmdv2_main.cpp @@ -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); } diff --git a/fdmdv2/tests/pa_enum/pa_enum.mk b/fdmdv2/tests/pa_enum/pa_enum.mk index 0b2ab7ae..a969d786 100644 --- a/fdmdv2/tests/pa_enum/pa_enum.mk +++ b/fdmdv2/tests/pa_enum/pa_enum.mk @@ -2,12 +2,12 @@ ## Auto Generated makefile by CodeLite IDE ## any manual changes will be erased ## -## Debug +## Release ProjectName :=pa_enum -ConfigurationName :=Debug +ConfigurationName :=Release WorkspacePath := "D:\Projects\Radio\fdmdv2\build" ProjectPath := "D:\Projects\Radio\fdmdv2\tests\pa_enum" -IntermediateDirectory :=./Debug +IntermediateDirectory :=./Release OutDir := $(IntermediateDirectory) CurrentFileName := CurrentFilePath := @@ -37,7 +37,7 @@ PCHCompileFlags := MakeDirCommand :=makedir RcCmpOptions := $(shell wx-config --rcflags) RcCompilerName :=windres -LinkOptions := -mwindows $(shell wx-config --debug=yes --libs --unicode=yes) +LinkOptions := -mwindows -s $(shell wx-config --debug=no --libs --unicode=yes) IncludePath := $(IncludeSwitch). $(IncludeSwitch)/bin/MinGW-4.6.1/msys/1.0/local/include $(IncludeSwitch)../../codec2-dev/src $(IncludeSwitch)/bin/Projects/Audio/libsndfile/ IncludePCH := RcIncludePath := @@ -52,8 +52,8 @@ LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/bin/MinGW-4 AR := ar rcus CXX := g++ CC := gcc -CXXFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) -DSVN_REVISION=\"1083\" $(Preprocessors) -CFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) -DSVN_REVISION=\"1083\" $(Preprocessors) +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -DSVN_REVISION=\"1083\" $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -DSVN_REVISION=\"1083\" $(Preprocessors) ## @@ -79,7 +79,7 @@ $(OutputFile): $(IntermediateDirectory)/.d $(Objects) $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) $(IntermediateDirectory)/.d: - @$(MakeDirCommand) "./Debug" + @$(MakeDirCommand) "./Release" PreBuild: @@ -128,6 +128,6 @@ clean: $(RM) $(IntermediateDirectory)/AudioOptsDialog$(PreprocessSuffix) $(RM) $(OutputFile) $(RM) $(OutputFile).exe - $(RM) "D:\Projects\Radio\fdmdv2\build\.build-debug\pa_enum" + $(RM) "D:\Projects\Radio\fdmdv2\build\.build-release\pa_enum" -- 2.25.1