diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.cpp b/plugins/channelrx/demodadsb/adsbdemodgui.cpp index 738b5229d..c0a320943 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodgui.cpp @@ -350,10 +350,12 @@ void ADSBDemodGUI::handleADSB(const QByteArray data, const QDateTime dateTime, f aircraft->m_adsbFrameCount++; aircraft->m_adsbFrameCountItem->setText(QString("%1").arg(aircraft->m_adsbFrameCount)); - aircraft->m_minCorrelation = correlationZeros; + m_correlationZerosAvg(correlationZeros); + aircraft->m_minCorrelation = m_correlationZerosAvg.instantAverage(); if (correlationOnes > aircraft->m_maxCorrelation) aircraft->m_maxCorrelation = correlationOnes; - aircraft->m_correlation = correlationOnes; + m_correlationOnesAvg(correlationOnes); + aircraft->m_correlation = m_correlationOnesAvg.instantAverage(); aircraft->m_correlationItem->setText(QString("%1/%2/%3") .arg(CalcDb::dbPower(aircraft->m_minCorrelation), 3, 'f', 1) .arg(CalcDb::dbPower(aircraft->m_correlation), 3, 'f', 1) @@ -756,7 +758,7 @@ void ADSBDemodGUI::on_adsbData_cellDoubleClicked(int row, int column) void ADSBDemodGUI::on_spb_currentIndexChanged(int value) { - m_settings.m_samplesPerBit = (value + 2) * 2; + m_settings.m_samplesPerBit = (value + 1) * 2; applySettings(); } @@ -937,7 +939,7 @@ void ADSBDemodGUI::displaySettings() ui->rfBWText->setText(QString("%1M").arg(m_settings.m_rfBandwidth / 1000000.0, 0, 'f', 1)); ui->rfBW->setValue((int)m_settings.m_rfBandwidth); - ui->spb->setCurrentIndex(m_settings.m_samplesPerBit/2-2); + ui->spb->setCurrentIndex(m_settings.m_samplesPerBit/2-1); ui->thresholdText->setText(QString("%1").arg(m_settings.m_correlationThreshold, 0, 'f', 1)); ui->threshold->setValue((int)(m_settings.m_correlationThreshold*10)); diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.h b/plugins/channelrx/demodadsb/adsbdemodgui.h index 4680330c0..c2719bc5d 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.h +++ b/plugins/channelrx/demodadsb/adsbdemodgui.h @@ -30,6 +30,7 @@ #include "dsp/movingaverage.h" #include "util/messagequeue.h" #include "util/azel.h" +#include "util/movingaverage.h" #include "adsbdemodsettings.h" @@ -237,6 +238,8 @@ private: AzEl m_azEl; // Position of station Aircraft *m_trackAircraft; // Aircraft we want to track in Channel Report + MovingAverageUtil m_correlationOnesAvg; + MovingAverageUtil m_correlationZerosAvg; explicit ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0); virtual ~ADSBDemodGUI(); diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.ui b/plugins/channelrx/demodadsb/adsbdemodgui.ui index 55cb28bba..1f4170f4d 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.ui +++ b/plugins/channelrx/demodadsb/adsbdemodgui.ui @@ -280,6 +280,11 @@ Demodulator sample rate. This should ideally be matched to baseband sample rate + + + 2 + + 4 diff --git a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp index e46082241..1c3804bf4 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp @@ -35,7 +35,7 @@ void ADSBDemodSettings::resetToDefaults() m_inputFrequencyOffset = 0; m_rfBandwidth = 2*1300000; m_correlationThreshold = -50.0f; - m_samplesPerBit = 6; + m_samplesPerBit = 4; m_removeTimeout = 60; m_beastEnabled = false; m_beastHost = "feed.adsbexchange.com"; @@ -103,7 +103,7 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data) m_inputFrequencyOffset = tmp; d.readReal(2, &m_rfBandwidth, 2*1300000); d.readReal(3, &m_correlationThreshold, -50.0f); - d.readS32(4, &m_samplesPerBit, 6); + d.readS32(4, &m_samplesPerBit, 4); d.readS32(5, &m_removeTimeout, 60); d.readBool(6, &m_beastEnabled, false); d.readString(7, &m_beastHost, "feed.adsbexchange.com"); diff --git a/plugins/channelrx/demodadsb/readme.md b/plugins/channelrx/demodadsb/readme.md index 3beb65eec..90f5f749d 100644 --- a/plugins/channelrx/demodadsb/readme.md +++ b/plugins/channelrx/demodadsb/readme.md @@ -28,7 +28,9 @@ This is the bandwidth in MHz of the channel signal before demodulation.

5: SR - Channel Sample Rate

-This specifies the channel sample rate the demodulator uses. Values of 4M-12MSa/s are supported, 2MSa/s steps. Ideally, this should be set to the same value as the baseband sample rate (the sample rate received from the radio). If it is different from the baseband sample rate, interpolation or decimation will be performed as needed to match the rates. However, interpolation currently requires a significant amount of processing power and may result in dropped samples. +This specifies the channel sample rate the demodulator uses. Values of 2M-12MSa/s are supported, 2MSa/s steps. Ideally, this should be set to the same value as the baseband sample rate (the sample rate received from the radio). If it is different from the baseband sample rate, interpolation or decimation will be performed as needed to match the rates. However, interpolation currently requires a significant amount of processing power and may result in dropped samples. + +2 MSa/s should give decent decodes. Higher rates may be experienced with if your hardware allows it (radio device and processing power). However the higher the rate the more processing power required. Higher channel sample rates may help decode more frames, but will require more processing power.