Functional waterfall speed control from 1->1024 lines per second

This commit is contained in:
Charles J. Cliffe 2015-08-11 23:52:03 -04:00
parent a9181594e2
commit 706a113459
6 changed files with 55 additions and 18 deletions

View File

@ -63,8 +63,6 @@ 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);
// demodTray->AddSpacer(2);
wxGetApp().getDemodSpectrumProcesor()->setup(1024);
demodSpectrumCanvas = new SpectrumCanvas(this, attribList);
demodSpectrumCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000);
@ -114,24 +112,49 @@ AppFrame::AppFrame() :
vbox->Add(demodTray, 12, wxEXPAND | wxALL, 0);
vbox->AddSpacer(1);
wxBoxSizer *spectrumSizer = new wxBoxSizer(wxHORIZONTAL);
wxGetApp().getSpectrumProcesor()->setup(2048);
spectrumCanvas = new SpectrumCanvas(this, attribList);
vbox->Add(spectrumCanvas, 5, wxEXPAND | wxALL, 0);
vbox->AddSpacer(1);
wxGetApp().getSpectrumProcesor()->attachOutput(spectrumCanvas->getVisualDataQueue());
spectrumAvgMeter = new MeterCanvas(this, attribList);
spectrumAvgMeter->setMax(3.0);
spectrumAvgMeter->setInputValue(1.0);
spectrumSizer->Add(spectrumCanvas, 63, wxEXPAND | wxALL, 0);
spectrumSizer->AddSpacer(1);
spectrumSizer->Add(spectrumAvgMeter, 1, wxEXPAND | wxALL, 0);
vbox->Add(spectrumSizer, 5, wxEXPAND | wxALL, 0);
vbox->AddSpacer(1);
wxBoxSizer *wfSizer = new wxBoxSizer(wxHORIZONTAL);
wxGetApp().getWaterfallProcesor()->setup(2048);
waterfallCanvas = new WaterfallCanvas(this, attribList);
waterfallCanvas->setup(2048, 512);
waterfallCanvas->attachSpectrumCanvas(spectrumCanvas);
spectrumCanvas->attachWaterfallCanvas(waterfallCanvas);
vbox->Add(waterfallCanvas, 20, wxEXPAND | wxALL, 0);
// wxGetApp().getSpectrumProcesor()->attachOutput(waterfallCanvas->getVisualDataQueue());
fftDistrib.setInput(wxGetApp().getWaterfallVisualQueue());
fftDistrib.attachOutput(&fftQueue);
wxGetApp().getWaterfallProcesor()->setInput(&fftQueue);
wxGetApp().getWaterfallProcesor()->attachOutput(waterfallCanvas->getVisualDataQueue());
waterfallSpeedMeter = new MeterCanvas(this, attribList);
waterfallSpeedMeter->setMax(sqrt(1024));
waterfallSpeedMeter->setInputValue(sqrt(DEFAULT_WATERFALL_LPS));
wfSizer->Add(waterfallCanvas, 63, wxEXPAND | wxALL, 0);
wfSizer->AddSpacer(1);
wfSizer->Add(waterfallSpeedMeter, 1, wxEXPAND | wxALL, 0);
vbox->Add(wfSizer, 20, wxEXPAND | wxALL, 0);
// TODO: refactor these..
waterfallCanvas->attachSpectrumCanvas(spectrumCanvas);
spectrumCanvas->attachWaterfallCanvas(waterfallCanvas);
/*
vbox->AddSpacer(1);
testCanvas = new UITestCanvas(this, attribList);
@ -722,8 +745,13 @@ void AppFrame::OnTimer(wxTimerEvent& event) {
} else {
fftDistrib.setFFTSize(DEFAULT_FFT_SIZE);
}
fftDistrib.setLinesPerSecond(24);
wxGetApp().getWaterfallVisualQueue()->set_max_num_items(24);
if (waterfallSpeedMeter->inputChanged()) {
int val = (int)waterfallSpeedMeter->getInputValue();
fftDistrib.setLinesPerSecond((int)ceil(val*val));
wxGetApp().getWaterfallVisualQueue()->set_max_num_items((int)ceil(val*val));
}
fftDistrib.run();
wproc->setView(waterfallCanvas->getViewState());
@ -752,6 +780,12 @@ void AppFrame::OnTimer(wxTimerEvent& event) {
if (demodModeSelector->getMouseTracker()->mouseInView()) {
demodModeSelector->Refresh();
}
if (waterfallSpeedMeter->getMouseTracker()->mouseInView()) {
waterfallSpeedMeter->Refresh();
}
if (spectrumAvgMeter->getMouseTracker()->mouseInView()) {
spectrumAvgMeter->Refresh();
}
event.Skip();
}

View File

@ -80,7 +80,9 @@ private:
MeterCanvas *demodSignalMeter;
MeterCanvas *demodGainMeter;
TuningCanvas *demodTuner;
UITestCanvas *testCanvas;
// UITestCanvas *testCanvas;
MeterCanvas *spectrumAvgMeter;
MeterCanvas *waterfallSpeedMeter;
DemodulatorInstance *activeDemodulator;

View File

@ -64,7 +64,7 @@ bool CubicSDR::OnInit() {
pipeSpectrumIQVisualData->set_max_num_items(1);
pipeWaterfallIQVisualData = new DemodulatorThreadInputQueue();
pipeWaterfallIQVisualData->set_max_num_items(512);
pipeWaterfallIQVisualData->set_max_num_items(DEFAULT_WATERFALL_LPS);
spectrumDistributor.attachOutput(pipeDemodIQVisualData);
spectrumDistributor.attachOutput(pipeSpectrumIQVisualData);

View File

@ -33,3 +33,4 @@ const char filePathSeparator =
#define DEFAULT_DEMOD_TYPE 1
#define DEFAULT_DEMOD_BW 200000
#define DEFAULT_WATERFALL_LPS 24

View File

@ -113,16 +113,16 @@ void SpectrumPanel::drawPanelContents() {
long double mhzStep = (100000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
double mhzVisualStep = 0.1f;
if (mhzStep * 0.5 * viewWidth > 400) {
mhzStep = (10000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
mhzVisualStep = 0.01f;
}
if (mhzStep * 0.5 * viewWidth < 40) {
mhzStep = (250000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
mhzVisualStep = 0.25f;
}
if (mhzStep * 0.5 * viewWidth > 400) {
mhzStep = (10000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
mhzVisualStep = 0.01f;
}
long double currentMhz = trunc(floor(firstMhz / 1000000.0));
std::stringstream label;

View File

@ -68,7 +68,7 @@ private:
class FFTDataDistributor : public VisualProcessor<DemodulatorThreadIQData, DemodulatorThreadIQData> {
public:
FFTDataDistributor() : linesPerSecond(30), lineRateAccum(0.0) {
FFTDataDistributor() : linesPerSecond(DEFAULT_WATERFALL_LPS), lineRateAccum(0.0) {
}
void setFFTSize(int fftSize) {