Skip to content

Commit

Permalink
Merge pull request #2057 from srcejon/freq_scanner
Browse files Browse the repository at this point in the history
Support VOR Localizer on Qt6. Add Add Channels dialog to SID. Add JJY to Radio Clock
  • Loading branch information
f4exb authored Apr 7, 2024
2 parents 98f5e61 + c9632b9 commit a6c1dc5
Show file tree
Hide file tree
Showing 40 changed files with 1,426 additions and 85 deletions.
Binary file added doc/img/SID_plugin_addchannels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/img/SID_plugin_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 29 additions & 2 deletions plugins/channelrx/channelpower/channelpower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,26 @@ int ChannelPower::webapiSettingsPutPatch(
ChannelPowerSettings settings = m_settings;
webapiUpdateChannelSettings(settings, channelSettingsKeys, response);

MsgConfigureChannelPower *msg = MsgConfigureChannelPower::create(settings, channelSettingsKeys, force);
// Ensure inputFrequencyOffset and frequency are consistent
QStringList settingsKeys = channelSettingsKeys;
if (settingsKeys.contains("frequency") && !settingsKeys.contains("inputFrequencyOffset"))
{
settings.m_inputFrequencyOffset = settings.m_frequency - m_centerFrequency;
settingsKeys.append("inputFrequencyOffset");
}
else if (settingsKeys.contains("inputFrequencyOffset") && !settingsKeys.contains("frequency"))
{
settings.m_frequency = m_centerFrequency + settings.m_inputFrequencyOffset;
settingsKeys.append("frequency");
}

MsgConfigureChannelPower *msg = MsgConfigureChannelPower::create(settings, settingsKeys, force);
m_inputMessageQueue.push(msg);

qDebug("ChannelPower::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureChannelPower *msgToGUI = MsgConfigureChannelPower::create(settings, channelSettingsKeys, force);
MsgConfigureChannelPower *msgToGUI = MsgConfigureChannelPower::create(settings, settingsKeys, force);
m_guiMessageQueue->push(msgToGUI);
}

Expand All @@ -312,6 +325,12 @@ void ChannelPower::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
settings.m_inputFrequencyOffset = response.getChannelPowerSettings()->getInputFrequencyOffset();
}
if (channelSettingsKeys.contains("frequencyMode")) {
settings.m_frequencyMode = (ChannelPowerSettings::FrequencyMode) response.getChannelPowerSettings()->getFrequencyMode();
}
if (channelSettingsKeys.contains("frequency")) {
settings.m_frequency = response.getChannelPowerSettings()->getFrequency();
}
if (channelSettingsKeys.contains("rfBandwidth")) {
settings.m_rfBandwidth = response.getChannelPowerSettings()->getRfBandwidth();
}
Expand Down Expand Up @@ -356,6 +375,8 @@ void ChannelPower::webapiUpdateChannelSettings(
void ChannelPower::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const ChannelPowerSettings& settings)
{
response.getChannelPowerSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
response.getChannelPowerSettings()->setFrequencyMode(settings.m_frequencyMode);
response.getChannelPowerSettings()->setFrequency(settings.m_frequency);
response.getChannelPowerSettings()->setRfBandwidth(settings.m_rfBandwidth);
response.getChannelPowerSettings()->setPulseThreshold(settings.m_pulseThreshold);
response.getChannelPowerSettings()->setAveragePeriodUs(settings.m_averagePeriodUS);
Expand Down Expand Up @@ -469,6 +490,12 @@ void ChannelPower::webapiFormatChannelSettings(
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
swgChannelPowerSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
}
if (channelSettingsKeys.contains("frequencyMode") || force) {
swgChannelPowerSettings->setFrequencyMode(settings.m_frequencyMode);
}
if (channelSettingsKeys.contains("inputFrequency") || force) {
swgChannelPowerSettings->setFrequency(settings.m_frequency);
}
if (channelSettingsKeys.contains("rfBandwidth") || force) {
swgChannelPowerSettings->setRfBandwidth(settings.m_rfBandwidth);
}
Expand Down
32 changes: 21 additions & 11 deletions plugins/channelrx/channelpower/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Channel Power Plugin</h1>
<h1>Channel Power Plugin</h1>

<h2>Introduction</h2>

Expand All @@ -10,38 +10,48 @@ The top and bottom bars of the channel window are described [here](../../../sdrg

![Channel power plugin GUI](../../../doc/img/ChannelPower_plugin_settings.png)

<h3>1: Frequency shift from center frequency of reception</h3>
<h3>1: Channel frequency entry mode</h3>

Use the wheels to adjust the channel center frequency as a shift in Hz from the center frequency of reception. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arrows. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2.
Select from one of the following modes to determine how the channel center frequency is calculated:

<h3>2: BW - Channel Bandwidth</h3>
* Δf - Specify an offset in Hz from device center frequency.
* f - Specific a frequency in Hz.

<h3>2: Channel Frequency</h3>

Specifies channel center frequency according to frequency entry mode (1):

* Δf - Offset in Hz from device center frequency.
* f - Absolute frequency in Hz.

<h3>3: BW - Channel Bandwidth</h3>

Bandwidth in Hz of the channel for which power is to be measured.

<h3>3: Tavg - Average Time</h3>
<h3>4: Tavg - Average Time</h3>

Time period overwhich the channel power is averaged. Values range from 10us to 10s in powers of 10. The available values depend upon the sample rate.

<h3>4: THp - Pulse Threshold</h3>
<h3>5: THp - Pulse Threshold</h3>

The pulse threshold sets the power in dB for which the channel power needs to exceed, in order to be included in the pulse average power measurement.

<h3>5: Avg - Average Power</h3>
<h3>6: Avg - Average Power</h3>

Displays the most recent average power measurement in dB.

<h3>6: Max - Max Peak Power</h3>
<h3>7: Max - Max Peak Power</h3>

Displays the maximum instantaneous peak power measurement in dB.

<h3>7: Min - Min Peak Power</h3>
<h3>8: Min - Min Peak Power</h3>

Displays the minimum instantaneous peak power measurement in dB.

<h3>8: Pulse - Pulse Average Power</h3>
<h3>9: Pulse - Pulse Average Power</h3>

Displays the most recent pulse average power measurement in dB.

<h3>9: Clear Data</h3>
<h3>10: Clear Data</h3>

Clears current measurements (min and max values are reset).
2 changes: 0 additions & 2 deletions plugins/channelrx/demodadsb/map/map_6.qml
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ Item {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: (mouse) => {
console.log("AIRPORT CLICKED ************************* ");
if (mouse.button === Qt.RightButton) {
showRangeItem.visible = !rangeGroup.groupVisible
hideRangeItem.visible = rangeGroup.groupVisible
Expand Down Expand Up @@ -508,7 +507,6 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: (mouse) => {
console.log("AIRPORT 2 CLICKED ************************* ");
if (showFreq) {
var freqIdx = Math.floor((mouse.y-5)/((height-10)/airportDataRows))
if (freqIdx == 0) {
Expand Down
27 changes: 27 additions & 0 deletions plugins/channelrx/radioclock/radioclock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,15 @@ void RadioClock::applySettings(const RadioClockSettings& settings, bool force)

QList<QString> reverseAPIKeys;

if ((settings.m_frequencyMode != m_settings.m_frequencyMode) || force) {
reverseAPIKeys.append("frequencyMode");
}
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
reverseAPIKeys.append("inputFrequencyOffset");
}
if ((settings.m_frequency != m_settings.m_frequency) || force) {
reverseAPIKeys.append("frequency");
}
if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) {
reverseAPIKeys.append("rfBandwidth");
}
Expand Down Expand Up @@ -331,6 +337,13 @@ int RadioClock::webapiSettingsPutPatch(
RadioClockSettings settings = m_settings;
webapiUpdateChannelSettings(settings, channelSettingsKeys, response);

// Ensure inputFrequencyOffset and frequency are consistent
if (channelSettingsKeys.contains("frequency") && !channelSettingsKeys.contains("inputFrequencyOffset")) {
settings.m_inputFrequencyOffset = settings.m_frequency - m_centerFrequency;
} else if (channelSettingsKeys.contains("inputFrequencyOffset") && !channelSettingsKeys.contains("frequency")) {
settings.m_frequency = m_centerFrequency + settings.m_inputFrequencyOffset;
}

MsgConfigureRadioClock *msg = MsgConfigureRadioClock::create(settings, force);
m_inputMessageQueue.push(msg);

Expand All @@ -351,9 +364,15 @@ void RadioClock::webapiUpdateChannelSettings(
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response)
{
if (channelSettingsKeys.contains("frequencyMode")) {
settings.m_frequencyMode = (RadioClockSettings::FrequencyMode) response.getRadioClockSettings()->getFrequencyMode();
}
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
settings.m_inputFrequencyOffset = response.getRadioClockSettings()->getInputFrequencyOffset();
}
if (channelSettingsKeys.contains("frequency")) {
settings.m_frequency = response.getRadioClockSettings()->getFrequency();
}
if (channelSettingsKeys.contains("rfBandwidth")) {
settings.m_rfBandwidth = response.getRadioClockSettings()->getRfBandwidth();
}
Expand Down Expand Up @@ -403,7 +422,9 @@ void RadioClock::webapiUpdateChannelSettings(

void RadioClock::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const RadioClockSettings& settings)
{
response.getRadioClockSettings()->setFrequencyMode((int)settings.m_frequencyMode);
response.getRadioClockSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
response.getRadioClockSettings()->setFrequency(settings.m_frequency);
response.getRadioClockSettings()->setRfBandwidth(settings.m_rfBandwidth);
response.getRadioClockSettings()->setThreshold(settings.m_threshold);
response.getRadioClockSettings()->setModulation((int)settings.m_modulation);
Expand Down Expand Up @@ -536,9 +557,15 @@ void RadioClock::webapiFormatChannelSettings(

// transfer data that has been modified. When force is on transfer all data except reverse API data

if (channelSettingsKeys.contains("frequencyMode") || force) {
swgRadioClockSettings->setFrequencyMode(settings.m_frequencyMode);
}
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
swgRadioClockSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
}
if (channelSettingsKeys.contains("frequency") || force) {
swgRadioClockSettings->setFrequency(settings.m_frequency);
}
if (channelSettingsKeys.contains("rfBandwidth") || force) {
swgRadioClockSettings->setRfBandwidth(settings.m_rfBandwidth);
}
Expand Down
89 changes: 82 additions & 7 deletions plugins/channelrx/radioclock/radioclockgui.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2020-2023 Jon Beniston, M7RCE <[email protected]> //
// Copyright (C) 2020-2024 Jon Beniston, M7RCE <[email protected]> //
// Copyright (C) 2020-2022 Edouard Griffiths, F4EXB <[email protected]> //
// //
// This program is free software; you can redistribute it and/or modify //
Expand Down Expand Up @@ -139,15 +139,31 @@ bool RadioClockGUI::handleMessage(const Message& message)
const DSPSignalNotification& notif = (const DSPSignalNotification&) message;
m_deviceCenterFrequency = notif.getCenterFrequency();
m_basebandSampleRate = notif.getSampleRate();
ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2);
ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2));
calcOffset();
updateAbsoluteCenterFrequency();
return true;
}

return false;
}

// Calculate input frequency offset, when device center frequency changes
void RadioClockGUI::calcOffset()
{
if (m_settings.m_frequencyMode == RadioClockSettings::Offset)
{
ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2);
}
else
{
qint64 offset = m_settings.m_frequency - m_deviceCenterFrequency;
m_channelMarker.setCenterFrequency(offset);
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
updateAbsoluteCenterFrequency();
applySettings();
}
}

void RadioClockGUI::handleInputMessages()
{
Message* message;
Expand All @@ -163,8 +179,22 @@ void RadioClockGUI::handleInputMessages()

void RadioClockGUI::channelMarkerChangedByCursor()
{
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
m_settings.m_frequency = m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset;

qint64 value = 0;

if (m_settings.m_frequencyMode == RadioClockSettings::Offset) {
value = m_settings.m_inputFrequencyOffset;
} else if (m_settings.m_frequencyMode == RadioClockSettings::Absolute) {
value = m_settings.m_frequency;
}

ui->deltaFrequency->blockSignals(true);
ui->deltaFrequency->setValue(value);
ui->deltaFrequency->blockSignals(false);

updateAbsoluteCenterFrequency();
applySettings();
}

Expand All @@ -173,9 +203,46 @@ void RadioClockGUI::channelMarkerHighlightedByCursor()
setHighlighted(m_channelMarker.getHighlighted());
}

void RadioClockGUI::on_frequencyMode_currentIndexChanged(int index)
{
m_settings.m_frequencyMode = (RadioClockSettings::FrequencyMode) index;
ui->deltaFrequency->blockSignals(true);

if (m_settings.m_frequencyMode == RadioClockSettings::Offset)
{
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
ui->deltaFrequency->setValue(m_settings.m_inputFrequencyOffset);
ui->deltaUnits->setText("Hz");
}
else if (m_settings.m_frequencyMode == RadioClockSettings::Absolute)
{
ui->deltaFrequency->setValueRange(true, 11, 0, 99999999999, 0);
ui->deltaFrequency->setValue(m_settings.m_frequency);
ui->deltaUnits->setText("Hz");
}

ui->deltaFrequency->blockSignals(false);

updateAbsoluteCenterFrequency();
applySettings();
}

void RadioClockGUI::on_deltaFrequency_changed(qint64 value)
{
m_channelMarker.setCenterFrequency(value);
qint64 offset = 0;

if (m_settings.m_frequencyMode == RadioClockSettings::Offset)
{
offset = value;
m_settings.m_frequency = m_deviceCenterFrequency + offset;
}
else if (m_settings.m_frequencyMode == RadioClockSettings::Absolute)
{
m_settings.m_frequency = value;
offset = m_settings.m_frequency - m_deviceCenterFrequency;
}

m_channelMarker.setCenterFrequency(offset);
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
updateAbsoluteCenterFrequency();
applySettings();
Expand Down Expand Up @@ -300,7 +367,6 @@ RadioClockGUI::RadioClockGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas

ui->status->setText("Looking for minute marker");

ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
Expand Down Expand Up @@ -368,7 +434,8 @@ void RadioClockGUI::displaySettings()

blockApplySettings(true);

ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->frequencyMode->setCurrentIndex((int) m_settings.m_frequencyMode);
on_frequencyMode_currentIndexChanged((int) m_settings.m_frequencyMode);

ui->rfBWText->setText(QString("%1 Hz").arg((int)m_settings.m_rfBandwidth));
ui->rfBW->setValue(m_settings.m_rfBandwidth);
Expand Down Expand Up @@ -420,6 +487,7 @@ void RadioClockGUI::tick()

void RadioClockGUI::makeUIConnections()
{
QObject::connect(ui->frequencyMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &RadioClockGUI::on_frequencyMode_currentIndexChanged);
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &RadioClockGUI::on_deltaFrequency_changed);
QObject::connect(ui->rfBW, &QSlider::valueChanged, this, &RadioClockGUI::on_rfBW_valueChanged);
QObject::connect(ui->threshold, &QDial::valueChanged, this, &RadioClockGUI::on_threshold_valueChanged);
Expand All @@ -430,4 +498,11 @@ void RadioClockGUI::makeUIConnections()
void RadioClockGUI::updateAbsoluteCenterFrequency()
{
setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset);
if ( (m_basebandSampleRate > 1)
&& ( (m_settings.m_inputFrequencyOffset >= m_basebandSampleRate / 2)
|| (m_settings.m_inputFrequencyOffset < -m_basebandSampleRate / 2))) {
setStatusText("Frequency out of band");
} else {
setStatusText("");
}
}
4 changes: 3 additions & 1 deletion plugins/channelrx/radioclock/radioclockgui.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2020-2022 Jon Beniston, M7RCE <[email protected]> //
// Copyright (C) 2020-2024 Jon Beniston, M7RCE <[email protected]> //
// Copyright (C) 2020, 2022 Edouard Griffiths, F4EXB <[email protected]> //
// //
// This program is free software; you can redistribute it and/or modify //
Expand Down Expand Up @@ -93,13 +93,15 @@ public slots:
bool handleMessage(const Message& message);
void makeUIConnections();
void updateAbsoluteCenterFrequency();
void calcOffset();

void displayDateTime();

void leaveEvent(QEvent*);
void enterEvent(EnterEventType*);

private slots:
void on_frequencyMode_currentIndexChanged(int index);
void on_deltaFrequency_changed(qint64 value);
void on_rfBW_valueChanged(int index);
void on_threshold_valueChanged(int value);
Expand Down
Loading

0 comments on commit a6c1dc5

Please sign in to comment.