Add ENABLE_DIGITAL_LAB def

This commit is contained in:
Charles J. Cliffe 2015-11-15 13:52:54 -05:00
parent a96a3b2234
commit 6b3467e5c8
4 changed files with 35 additions and 6 deletions

View File

@ -17,8 +17,14 @@ ADD_DEFINITIONS(
-DCUBICSDR_VERSION="${CUBICSDR_VERSION}-${VERSION_SUFFIX}" -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) macro(configure_files srcDir destDir globStr)
message(STATUS "Copying ${srcDir}/${globStr} to directory ${destDir}") message(STATUS "Copying ${srcDir}/${globStr} to directory ${destDir}")

View File

@ -77,6 +77,7 @@ AppFrame::AppFrame() :
demodModeSelector->setHelpTip("Choose modulation type: Frequency Modulation, Amplitude Modulation and Lower, Upper or Double Side-Band."); demodModeSelector->setHelpTip("Choose modulation type: Frequency Modulation, Amplitude Modulation and Lower, Upper or Double Side-Band.");
demodTray->Add(demodModeSelector, 2, wxEXPAND | wxALL, 0); demodTray->Add(demodModeSelector, 2, wxEXPAND | wxALL, 0);
#ifdef ENABLE_DIGITAL_LAB
demodModeSelectorAdv = new ModeSelectorCanvas(this, attribList); demodModeSelectorAdv = new ModeSelectorCanvas(this, attribList);
demodModeSelectorAdv->addChoice(DEMOD_TYPE_ASK, "ASK"); demodModeSelectorAdv->addChoice(DEMOD_TYPE_ASK, "ASK");
demodModeSelectorAdv->addChoice(DEMOD_TYPE_APSK, "APSK"); demodModeSelectorAdv->addChoice(DEMOD_TYPE_APSK, "APSK");
@ -103,6 +104,7 @@ AppFrame::AppFrame() :
demodModeSelectorCons->addChoice(256, "256"); demodModeSelectorCons->addChoice(256, "256");
demodModeSelectorCons->setHelpTip("Choose number of constallations types."); demodModeSelectorCons->setHelpTip("Choose number of constallations types.");
demodTray->Add(demodModeSelectorCons, 2, wxEXPAND | wxALL, 0); demodTray->Add(demodModeSelectorCons, 2, wxEXPAND | wxALL, 0);
#endif
wxGetApp().getDemodSpectrumProcessor()->setup(1024); wxGetApp().getDemodSpectrumProcessor()->setup(1024);
demodSpectrumCanvas = new SpectrumCanvas(demodPanel, attribList); demodSpectrumCanvas = new SpectrumCanvas(demodPanel, attribList);
@ -854,10 +856,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
scopeCanvas->setDeviceName(outputDevices[outputDevice].name); scopeCanvas->setDeviceName(outputDevices[outputDevice].name);
outputDeviceMenuItems[outputDevice]->Check(true); outputDeviceMenuItems[outputDevice]->Check(true);
int dType = demod->getDemodulatorType(); int dType = demod->getDemodulatorType();
int dCons = demod->getDemodulatorCons();
demodModeSelector->setSelection(dType); demodModeSelector->setSelection(dType);
#ifdef ENABLE_DIGITAL_LAB
int dCons = demod->getDemodulatorCons();
demodModeSelectorAdv->setSelection(dType); demodModeSelectorAdv->setSelection(dType);
demodModeSelectorCons->setSelection(dCons); demodModeSelectorCons->setSelection(dCons);
#endif
demodMuteButton->setSelection(demod->isMuted()?1:-1); demodMuteButton->setSelection(demod->isMuted()?1:-1);
} }
if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) { if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
@ -886,6 +890,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
demodSpectrumCanvas->setCenterFrequency(centerFreq); demodSpectrumCanvas->setCenterFrequency(centerFreq);
} }
int dSelection = demodModeSelector->getSelection(); int dSelection = demodModeSelector->getSelection();
#ifdef ENABLE_DIGITAL_LAB
int dSelectionadv = demodModeSelectorAdv->getSelection(); int dSelectionadv = demodModeSelectorAdv->getSelection();
int dSelectionCons = demodModeSelectorCons->getSelection(); int dSelectionCons = demodModeSelectorCons->getSelection();
@ -904,6 +909,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
if (dSelectionCons != demod->getDemodulatorCons()) { if (dSelectionCons != demod->getDemodulatorCons()) {
demod->setDemodulatorCons(dSelectionCons); demod->setDemodulatorCons(dSelectionCons);
} }
#else
// basic demodulators
if (dSelection != -1 && dSelection != demod->getDemodulatorType()) {
demod->setDemodulatorType(dSelection);
}
#endif
int muteMode = demodMuteButton->getSelection(); int muteMode = demodMuteButton->getSelection();
if (demodMuteButton->modeChanged()) { if (demodMuteButton->modeChanged()) {
@ -941,6 +952,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr(); DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
int dSelection = demodModeSelector->getSelection(); int dSelection = demodModeSelector->getSelection();
#ifdef ENABLE_DIGITAL_LAB
int dSelectionadv = demodModeSelectorAdv->getSelection(); int dSelectionadv = demodModeSelectorAdv->getSelection();
int dSelectionCons = demodModeSelectorCons->getSelection(); int dSelectionCons = demodModeSelectorCons->getSelection();
@ -959,7 +971,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
if (dSelectionCons != mgr->getLastDemodulatorCons()) { if (dSelectionCons != mgr->getLastDemodulatorCons()) {
mgr->setLastDemodulatorCons(dSelectionCons); mgr->setLastDemodulatorCons(dSelectionCons);
} }
#else
// basic demodulators
if (dSelection != -1 && dSelection != mgr->getLastDemodulatorType()) {
mgr->setLastDemodulatorType(dSelection);
}
#endif
demodGainMeter->setLevel(mgr->getLastGain()); demodGainMeter->setLevel(mgr->getLastGain());
if (demodSignalMeter->inputChanged()) { if (demodSignalMeter->inputChanged()) {
mgr->setLastSquelchLevel(demodSignalMeter->getInputValue()); mgr->setLastSquelchLevel(demodSignalMeter->getInputValue());

View File

@ -79,8 +79,10 @@ private:
SpectrumCanvas *spectrumCanvas; SpectrumCanvas *spectrumCanvas;
WaterfallCanvas *waterfallCanvas; WaterfallCanvas *waterfallCanvas;
ModeSelectorCanvas *demodModeSelector; ModeSelectorCanvas *demodModeSelector;
#ifdef ENABLE_DIGITAL_LAB
ModeSelectorCanvas *demodModeSelectorAdv; ModeSelectorCanvas *demodModeSelectorAdv;
ModeSelectorCanvas *demodModeSelectorCons; ModeSelectorCanvas *demodModeSelectorCons;
#endif
SpectrumCanvas *demodSpectrumCanvas; SpectrumCanvas *demodSpectrumCanvas;
WaterfallCanvas *demodWaterfallCanvas; WaterfallCanvas *demodWaterfallCanvas;
MeterCanvas *demodSignalMeter; MeterCanvas *demodSignalMeter;

View File

@ -20,6 +20,7 @@
IMPLEMENT_APP(CubicSDR) IMPLEMENT_APP(CubicSDR)
#ifdef ENABLE_DIGITAL_LAB
// console output buffer for windows // console output buffer for windows
#ifdef _WINDOWS #ifdef _WINDOWS
class outbuf : public std::streambuf { class outbuf : public std::streambuf {
@ -32,6 +33,7 @@ class outbuf : public std::streambuf {
} }
}; };
#endif #endif
#endif
#ifdef MINGW_PATCH #ifdef MINGW_PATCH
FILE _iob[] = { *stdin, *stdout, *stderr }; FILE _iob[] = { *stdin, *stdout, *stderr };
@ -147,6 +149,7 @@ bool CubicSDR::OnInit() {
return false; return false;
} }
#ifdef ENABLE_DIGITAL_LAB
// console output for windows // console output for windows
#ifdef _WINDOWS #ifdef _WINDOWS
if (AllocConsole()) { if (AllocConsole()) {
@ -157,6 +160,7 @@ bool CubicSDR::OnInit() {
std::streambuf *sb = std::cout.rdbuf(&ob); std::streambuf *sb = std::cout.rdbuf(&ob);
std::cout.rdbuf(sb); std::cout.rdbuf(sb);
#endif #endif
#endif
wxApp::SetAppName("CubicSDR"); wxApp::SetAppName("CubicSDR");