1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 09:31:10 -05:00

Freuqency Scanner: Add multiplex mode.

This commit is contained in:
srcejon 2024-11-05 10:09:09 +00:00
parent e277e4fc1f
commit 1235f71388
6 changed files with 116 additions and 32 deletions

View File

@ -377,6 +377,7 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
bool freqInRange = false;
qint64 nextCenterFrequency = m_centerFrequency;
int usableBW = (m_scannerSampleRate * 3 / 4) & ~1;
int nextFrequencyIndex = 0;
do
{
if (nextCenterFrequency + usableBW / 2 > m_stepStopFrequency)
@ -398,13 +399,30 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
&& (m_settings.m_frequencySettings[i].m_frequency < nextCenterFrequency + usableBW / 2))
{
freqInRange = true;
nextFrequencyIndex = i;
// Do we need to realign for frequencies with wider bandwidths than default
if (!m_settings.m_frequencySettings[i].m_channelBandwidth.isEmpty())
{
bool ok;
int channelBW = m_settings.m_frequencySettings[i].m_channelBandwidth.toInt(&ok);
if (ok)
{
if (channelBW >= usableBW) {
nextCenterFrequency = m_settings.m_frequencySettings[i].m_frequency;
} else if (m_settings.m_frequencySettings[i].m_frequency - channelBW / 2 < nextCenterFrequency - usableBW / 2) {
nextCenterFrequency = m_settings.m_frequencySettings[i].m_frequency - channelBW / 2;
}
}
}
break;
}
}
}
while (!complete && !freqInRange);
if (complete)
if (complete || (m_settings.m_mode == FreqScannerSettings::MULTIPLEX))
{
if (m_scanResults.size() > 0)
{
@ -421,7 +439,12 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
FreqScannerSettings::FrequencySettings *frequencySettings = nullptr;
FreqScannerSettings::FrequencySettings *activeFrequencySettings = nullptr;
if (m_settings.m_priority == FreqScannerSettings::MAX_POWER)
if (m_settings.m_mode == FreqScannerSettings::MULTIPLEX)
{
activeFrequencySettings = &m_settings.m_frequencySettings[nextFrequencyIndex];
frequency = activeFrequencySettings->m_frequency;
}
else if (m_settings.m_priority == FreqScannerSettings::MAX_POWER)
{
Real maxPower = -200.0f;
@ -528,6 +551,13 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
}
m_state = IDLE;
}
else if (m_settings.m_mode == FreqScannerSettings::MULTIPLEX)
{
// Wait for user-specified receive time before moving to next frequency
m_timeoutTimer.setSingleShot(true);
m_timeoutTimer.start((int)(m_settings.m_retransmitTime * 1000.0));
m_state = WAIT_FOR_RX_TIME;
}
else
{
// Wait for transmission to finish
@ -605,13 +635,33 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
}
break;
case WAIT_FOR_RX_TIME:
for (int i = 0; i < results.size(); i++)
{
if (results[i].m_frequency == m_activeFrequency)
{
if (m_guiMessageQueue) {
m_guiMessageQueue->push(MsgReportActivePower::create(results[i].m_power));
}
}
}
break;
}
}
void FreqScanner::timeout()
{
// Power hasn't returned above threshold - Restart scan
initScan();
if (m_settings.m_mode == FreqScannerSettings::MULTIPLEX)
{
// Move to next frequency
m_state = SCAN_FOR_MAX_POWER;
}
else
{
// Power hasn't returned above threshold - Restart scan
initScan();
}
}
void FreqScanner::calcScannerSampleRate(int channelBW, int basebandSampleRate, int& scannerSampleRate, int& fftSize, int& binsPerChannel)

View File

@ -399,7 +399,8 @@ private:
START_SCAN,
SCAN_FOR_MAX_POWER,
WAIT_FOR_END_TX,
WAIT_FOR_RETRANSMISSION
WAIT_FOR_RETRANSMISSION,
WAIT_FOR_RX_TIME
} m_state;
QTimer m_timeoutTimer;

View File

@ -364,6 +364,22 @@ void FreqScannerGUI::on_mode_currentIndexChanged(int index)
{
m_settings.m_mode = (FreqScannerSettings::Mode)index;
applySetting("mode");
bool multiplex = m_settings.m_mode == FreqScannerSettings::MULTIPLEX;
ui->threshLabel->setEnabled(!multiplex);
ui->thresh->setEnabled(!multiplex);
ui->threshText->setEnabled(!multiplex);
ui->priorityLabel->setEnabled(!multiplex);
ui->priority->setEnabled(!multiplex);
if (multiplex)
{
ui->retransmitTimeLabel->setText("t<sub>TX</sub>");
ui->retransmitTime->setToolTip("Time in seconds to listen on each frequency");
}
else
{
ui->retransmitTimeLabel->setText("t<sub>RTX</sub>");
ui->retransmitTime->setToolTip("Time in seconds to wait for frequency to become active again, before restarting scan");
}
}
void FreqScannerGUI::onWidgetRolled(QWidget* widget, bool rollDown)

View File

@ -29,7 +29,7 @@
</font>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
<enum>Qt::FocusPolicy::StrongFocus</enum>
</property>
<property name="windowTitle">
<string>Frequency Scanner</string>
@ -102,7 +102,7 @@
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
</widget>
</item>
@ -143,7 +143,7 @@
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
<enum>Qt::FocusPolicy::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Minimum demod shift frequency from center in Hz</string>
@ -160,14 +160,14 @@
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -191,13 +191,13 @@
<string>Active frequency power </string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string>-120.0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
@ -215,7 +215,7 @@
<item>
<widget class="Line" name="line_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -266,7 +266,7 @@
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -279,7 +279,7 @@
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
</widget>
</item>
@ -328,7 +328,7 @@
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
</widget>
</item>
@ -377,7 +377,7 @@
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
</widget>
</item>
@ -428,7 +428,7 @@
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -465,7 +465,7 @@
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
<enum>Qt::FocusPolicy::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Channel bandwidth</string>
@ -482,7 +482,7 @@
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -551,7 +551,7 @@
<item>
<widget class="Line" name="filterLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -569,7 +569,7 @@
<string>Run mode</string>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<item>
<property name="text">
@ -586,6 +586,11 @@
<string>Scan-only</string>
</property>
</item>
<item>
<property name="text">
<string>Multiplex</string>
</property>
</item>
</widget>
</item>
<item>
@ -597,7 +602,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<iconset resource="../../../../srcejon_sdrangel/sdrgui/resources/res.qrc">
<normaloff>:/play.png</normaloff>
<normalon>:/stop.png</normalon>:/play.png</iconset>
</property>
@ -621,7 +626,7 @@
<item>
<widget class="Line" name="line_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -767,7 +772,7 @@ Leave blank for no adjustment</string>
<string>Up</string>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<iconset resource="../../../../srcejon_sdrangel/sdrgui/resources/res.qrc">
<normaloff>:/arrow_up.png</normaloff>:/arrow_up.png</iconset>
</property>
</widget>
@ -781,7 +786,7 @@ Leave blank for no adjustment</string>
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<iconset resource="../../../../srcejon_sdrangel/sdrgui/resources/res.qrc">
<normaloff>:/arrow_down.png</normaloff>:/arrow_down.png</iconset>
</property>
</widget>
@ -789,7 +794,7 @@ Leave blank for no adjustment</string>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -808,7 +813,7 @@ Leave blank for no adjustment</string>
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<iconset resource="../../../../srcejon_sdrangel/sdrgui/resources/res.qrc">
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
</property>
</widget>
@ -843,7 +848,7 @@ Leave blank for no adjustment</string>
<tabstop>deltaFrequency</tabstop>
</tabstops>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>
<include location="../../../../srcejon_sdrangel/sdrgui/resources/res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -64,7 +64,8 @@ struct FreqScannerSettings
enum Mode {
SINGLE,
CONTINUOUS,
SCAN_ONLY
SCAN_ONLY,
MULTIPLEX
} m_mode; //!< Whether to run a single or many scans
QList<int> m_columnIndexes;//!< How the columns are ordered in the table

View File

@ -6,6 +6,14 @@ This plugin can be used to scan a range of frequencies looking for a transmissio
[Tutorial Video](https://www.youtube.com/watch?v=IpKP3t4Bmmg)
With the Run Mode (11) set to Multiplex, it can also repeatedly cycle through frequencies listening for a fixed period of time. This can be used, for example, to
receive both AIS and ADS-B data via a single SDR.
Note that when scanning, the device centre frequency will often not be set exactly to the frequencies you enter.
The Frequency Scanner will typically try to set the device centre frequency in order to
scan as many frequencies simultanously as possible, and also avoid having a DC offset within the bandwidth of a scanned frequency.
The demodulator channel's frequency offset option will be used so that it receives at the specified frequency.
<h2>Interface</h2>
The top and bottom bars of the channel window are described [here](../../../sdrgui/channel/readme.md)
@ -40,11 +48,13 @@ that corresponds to the set frequency is being received.
Specifies the time in seconds that the Frequency Scanner will average its power measurement over.
<h3>7: t_rtx - Retransmission Time</h3>
<h3>7: t_rtx - Retransmission Time / t_rx Receive Time</h3>
Specifies the time in seconds that the Frequency Scanner will wait after the power on the active frequency falls below the threshold, before restarting
t_rtx: When Run Mode (11) is not Multiplex, specifies the time in seconds that the Frequency Scanner will wait after the power on the active frequency falls below the threshold, before restarting
scanning. This enables the channel to remain tuned to a single frequency while there is a temporary break in transmission.
t_rx: When Run Mode (11) is Multiplex, specifies the time in seconds the channel will be tuned to each frequency.
<h3>8: Ch BW - Channel Bandwidth</h3>
This specifies the bandwidth of the channels to be scanned.
@ -75,6 +85,7 @@ Specifies the run mode:
- Single: All frequencies are scanned once. Channel (1) is tuned to the active frequency at the end of the scan. The scan does not repeat.
- Continuous: All frequencies scanned, with channel (1) being tuned to active frequency at the end of the scan. Scan repeats once the power on the active frequency falls below the threshold (4) for longer than the retransmission time (7).
- Scan only: All frequencies are scanned repeatedly. The channel will not be tuned. This mode is just for counting how often frequencies are active, which can be seen in the Active Count column in the frequency table (14).
- Multiplex: Frequencies will be stepped through sequentially and repeatedly, with the channel (1) being tuned for the time specified by t_rx (7).
<h3>12: Start/Stop Scanning</h3>