From 6b3467e5c8ec697f4da192a321865ae863f96485 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Sun, 15 Nov 2015 13:52:54 -0500 Subject: [PATCH] Add ENABLE_DIGITAL_LAB def --- CMakeLists.txt | 8 +++++++- src/AppFrame.cpp | 25 +++++++++++++++++++++---- src/AppFrame.h | 2 ++ src/CubicSDR.cpp | 6 +++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3ce07b..18d7fea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,14 @@ ADD_DEFINITIONS( -DCUBICSDR_VERSION="${CUBICSDR_VERSION}-${VERSION_SUFFIX}" ) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +SET (ENABLE_DIGITAL_LAB OFF CACHE BOOL "Enable 'Digital Lab' testing features.") +IF(ENABLE_DIGITAL_LAB) +ADD_DEFINITIONS( + -DENABLE_DIGITAL_LAB=1 +) +ENDIF() +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") macro(configure_files srcDir destDir globStr) message(STATUS "Copying ${srcDir}/${globStr} to directory ${destDir}") diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index 79ee1ef..51f86ef 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -77,6 +77,7 @@ AppFrame::AppFrame() : demodModeSelector->setHelpTip("Choose modulation type: Frequency Modulation, Amplitude Modulation and Lower, Upper or Double Side-Band."); demodTray->Add(demodModeSelector, 2, wxEXPAND | wxALL, 0); +#ifdef ENABLE_DIGITAL_LAB demodModeSelectorAdv = new ModeSelectorCanvas(this, attribList); demodModeSelectorAdv->addChoice(DEMOD_TYPE_ASK, "ASK"); demodModeSelectorAdv->addChoice(DEMOD_TYPE_APSK, "APSK"); @@ -103,7 +104,8 @@ AppFrame::AppFrame() : demodModeSelectorCons->addChoice(256, "256"); demodModeSelectorCons->setHelpTip("Choose number of constallations types."); demodTray->Add(demodModeSelectorCons, 2, wxEXPAND | wxALL, 0); - +#endif + wxGetApp().getDemodSpectrumProcessor()->setup(1024); demodSpectrumCanvas = new SpectrumCanvas(demodPanel, attribList); demodSpectrumCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000); @@ -854,10 +856,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) { scopeCanvas->setDeviceName(outputDevices[outputDevice].name); outputDeviceMenuItems[outputDevice]->Check(true); int dType = demod->getDemodulatorType(); - int dCons = demod->getDemodulatorCons(); demodModeSelector->setSelection(dType); +#ifdef ENABLE_DIGITAL_LAB + int dCons = demod->getDemodulatorCons(); demodModeSelectorAdv->setSelection(dType); demodModeSelectorCons->setSelection(dCons); +#endif demodMuteButton->setSelection(demod->isMuted()?1:-1); } if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) { @@ -886,6 +890,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) { demodSpectrumCanvas->setCenterFrequency(centerFreq); } int dSelection = demodModeSelector->getSelection(); +#ifdef ENABLE_DIGITAL_LAB int dSelectionadv = demodModeSelectorAdv->getSelection(); int dSelectionCons = demodModeSelectorCons->getSelection(); @@ -893,7 +898,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) { if (dSelection != -1 && dSelection != demod->getDemodulatorType()) { demod->setDemodulatorType(dSelection); demodModeSelectorAdv->setSelection(-1); - } + } // advanced demodulators else if (dSelectionadv != -1 && dSelectionadv != demod->getDemodulatorType()) { demod->setDemodulatorType(dSelectionadv); @@ -904,6 +909,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) { if (dSelectionCons != demod->getDemodulatorCons()) { demod->setDemodulatorCons(dSelectionCons); } +#else + // basic demodulators + if (dSelection != -1 && dSelection != demod->getDemodulatorType()) { + demod->setDemodulatorType(dSelection); + } +#endif int muteMode = demodMuteButton->getSelection(); if (demodMuteButton->modeChanged()) { @@ -941,6 +952,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) { DemodulatorMgr *mgr = &wxGetApp().getDemodMgr(); int dSelection = demodModeSelector->getSelection(); +#ifdef ENABLE_DIGITAL_LAB int dSelectionadv = demodModeSelectorAdv->getSelection(); int dSelectionCons = demodModeSelectorCons->getSelection(); @@ -959,7 +971,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) { if (dSelectionCons != mgr->getLastDemodulatorCons()) { mgr->setLastDemodulatorCons(dSelectionCons); } - +#else + // basic demodulators + if (dSelection != -1 && dSelection != mgr->getLastDemodulatorType()) { + mgr->setLastDemodulatorType(dSelection); + } +#endif demodGainMeter->setLevel(mgr->getLastGain()); if (demodSignalMeter->inputChanged()) { mgr->setLastSquelchLevel(demodSignalMeter->getInputValue()); diff --git a/src/AppFrame.h b/src/AppFrame.h index d41c679..694d8c7 100644 --- a/src/AppFrame.h +++ b/src/AppFrame.h @@ -79,8 +79,10 @@ private: SpectrumCanvas *spectrumCanvas; WaterfallCanvas *waterfallCanvas; ModeSelectorCanvas *demodModeSelector; +#ifdef ENABLE_DIGITAL_LAB ModeSelectorCanvas *demodModeSelectorAdv; ModeSelectorCanvas *demodModeSelectorCons; +#endif SpectrumCanvas *demodSpectrumCanvas; WaterfallCanvas *demodWaterfallCanvas; MeterCanvas *demodSignalMeter; diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index 3be8344..3081026 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -20,6 +20,7 @@ IMPLEMENT_APP(CubicSDR) +#ifdef ENABLE_DIGITAL_LAB // console output buffer for windows #ifdef _WINDOWS class outbuf : public std::streambuf { @@ -32,6 +33,7 @@ class outbuf : public std::streambuf { } }; #endif +#endif #ifdef MINGW_PATCH FILE _iob[] = { *stdin, *stdout, *stderr }; @@ -147,6 +149,7 @@ bool CubicSDR::OnInit() { return false; } +#ifdef ENABLE_DIGITAL_LAB // console output for windows #ifdef _WINDOWS if (AllocConsole()) { @@ -157,7 +160,8 @@ bool CubicSDR::OnInit() { std::streambuf *sb = std::cout.rdbuf(&ob); std::cout.rdbuf(sb); #endif - +#endif + wxApp::SetAppName("CubicSDR"); frequency = wxGetApp().getConfig()->getCenterFreq();