Skip to content

Commit

Permalink
Merge pull request f4exb#2052 from srcejon/freq_scanner
Browse files Browse the repository at this point in the history
SID (Sudden Ionospheric Disturbance) Feature
  • Loading branch information
f4exb authored Apr 6, 2024
2 parents adfb220 + 9c1b1ab commit b939a98
Show file tree
Hide file tree
Showing 145 changed files with 10,653 additions and 384 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ option(ENABLE_FEATURE_PERTESTER "Enable feature pertester plugin" ON)
option(ENABLE_FEATURE_GS232CONTROLLER "Enable feature gs232controller plugin" ON)
option(ENABLE_FEATURE_REMOTECONTROL "Enable feature remote control plugin" ON)
option(ENABLE_FEATURE_SKYMAP "Enable feature sky map plugin" ON)
option(ENABLE_FEATURE_SID "Enable feature sid plugin" ON)

# on windows always build external libraries
if(WIN32)
Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Depends: ${shlibs:Depends},
qtspeech5-speechd-plugin,
pulseaudio,
ffmpeg,
gstreamer1.0-libav,
qml-module-qtlocation,
qml-module-qtpositioning,
qml-module-qtquick-window2,
Expand Down
Binary file added doc/img/ChannelPower_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.
Binary file added doc/img/SID_plugin.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/SID_plugin_eclipse.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 added doc/img/SID_plugin_paths.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 added 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.
Binary file added doc/img/SID_plugin_settings_dialog.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 added doc/img/SID_plugin_xray.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 added doc/img/SkyMap_Moon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 91 additions & 14 deletions plugins/channelrx/channelpower/channelpowergui.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2023 Jon Beniston, M7RCE //
// Copyright (C) 2023-2024 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
Expand All @@ -18,8 +18,6 @@

#include <QDebug>

#include "channelpowergui.h"

#include "device/deviceuiset.h"
#include "device/deviceapi.h"
#include "dsp/dspengine.h"
Expand All @@ -36,6 +34,7 @@
#include "maincore.h"

#include "channelpower.h"
#include "channelpowergui.h"

ChannelPowerGUI* ChannelPowerGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
{
Expand All @@ -62,11 +61,14 @@ QByteArray ChannelPowerGUI::serialize() const

bool ChannelPowerGUI::deserialize(const QByteArray& data)
{
if(m_settings.deserialize(data)) {
if (m_settings.deserialize(data))
{
displaySettings();
applyAllSettings();
return true;
} else {
}
else
{
resetToDefaults();
return false;
}
Expand All @@ -90,8 +92,7 @@ bool ChannelPowerGUI::handleMessage(const Message& message)
DSPSignalNotification& notif = (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();
ui->rfBW->setValueRange(floor(log10(m_basebandSampleRate))+1, 0, m_basebandSampleRate);
updateAbsoluteCenterFrequency();
return true;
Expand All @@ -115,9 +116,23 @@ void ChannelPowerGUI::handleInputMessages()

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

qint64 value = 0;

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

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

updateAbsoluteCenterFrequency();
applySettings({"frequency", "inputFrequencyOffset"});
}

void ChannelPowerGUI::channelMarkerHighlightedByCursor()
Expand All @@ -127,10 +142,23 @@ void ChannelPowerGUI::channelMarkerHighlightedByCursor()

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

if (m_settings.m_frequencyMode == ChannelPowerSettings::Offset)
{
offset = value;
m_settings.m_frequency = m_deviceCenterFrequency + offset;
}
else if (m_settings.m_frequencyMode == ChannelPowerSettings::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();
applySetting("inputFrequencyOffset");
applySettings({"frequency", "inputFrequencyOffset"});
}

void ChannelPowerGUI::on_rfBW_changed(qint64 value)
Expand Down Expand Up @@ -255,7 +283,6 @@ ChannelPowerGUI::ChannelPowerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet,

connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms

ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);

Expand Down Expand Up @@ -334,7 +361,8 @@ void ChannelPowerGUI::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->rfBW->setValue(m_settings.m_rfBandwidth);

Expand Down Expand Up @@ -427,13 +455,55 @@ void ChannelPowerGUI::tick()
m_tickCount++;
}

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

if (m_settings.m_frequencyMode == ChannelPowerSettings::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 == ChannelPowerSettings::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();
applySetting("frequencyMode");
}

// Calculate input frequency offset, when device center frequency changes
void ChannelPowerGUI::calcOffset()
{
if (m_settings.m_frequencyMode == ChannelPowerSettings::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();
applySetting("inputFrequencyOffset");
}
}

void ChannelPowerGUI::on_clearMeasurements_clicked()
{
m_channelPower->resetMagLevels();
}

void ChannelPowerGUI::makeUIConnections()
{
QObject::connect(ui->frequencyMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ChannelPowerGUI::on_frequencyMode_currentIndexChanged);
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &ChannelPowerGUI::on_deltaFrequency_changed);
QObject::connect(ui->rfBW, &ValueDial::changed, this, &ChannelPowerGUI::on_rfBW_changed);
QObject::connect(ui->pulseTH, QOverload<int>::of(&QDial::valueChanged), this, &ChannelPowerGUI::on_pulseTH_valueChanged);
Expand All @@ -443,5 +513,12 @@ void ChannelPowerGUI::makeUIConnections()

void ChannelPowerGUI::updateAbsoluteCenterFrequency()
{
setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset);
setStatusFrequency(m_settings.m_frequency);
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("");
}
}
2 changes: 2 additions & 0 deletions plugins/channelrx/channelpower/channelpowergui.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,15 @@ public slots:
void displaySettings();
bool handleMessage(const Message& message);
void makeUIConnections();
void calcOffset();
void updateAbsoluteCenterFrequency();
void on_clearMeasurements_clicked();

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

private slots:
void on_frequencyMode_currentIndexChanged(int index);
void on_deltaFrequency_changed(qint64 value);
void on_rfBW_changed(qint64 value);
void on_clearChannelPower_clicked();
Expand Down
24 changes: 20 additions & 4 deletions plugins/channelrx/channelpower/channelpowergui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,32 @@
<number>2</number>
</property>
<item>
<widget class="QLabel" name="deltaFrequencyLabel">
<widget class="QComboBox" name="frequencyMode">
<property name="minimumSize">
<size>
<width>16</width>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Df</string>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Select frequency entry mode.</string>
</property>
<item>
<property name="text">
<string>Δf</string>
</property>
</item>
<item>
<property name="text">
<string>f</string>
</property>
</item>
</widget>
</item>
<item>
Expand Down
26 changes: 25 additions & 1 deletion plugins/channelrx/channelpower/channelpowersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ void ChannelPowerSettings::resetToDefaults()
m_rfBandwidth = 10000.0f;
m_pulseThreshold= -50.0f;
m_averagePeriodUS = 100000;
m_frequencyMode = Offset;
m_frequency = 0;
m_rgbColor = QColor(102, 40, 220).rgb();
m_title = "Channel Power";
m_streamIndex = 0;
Expand All @@ -56,6 +58,8 @@ QByteArray ChannelPowerSettings::serialize() const
s.writeFloat(2, m_rfBandwidth);
s.writeFloat(3, m_pulseThreshold);
s.writeS32(4, m_averagePeriodUS);
s.writeS32(5, (int) m_frequencyMode);
s.writeS64(6, m_frequency);

s.writeU32(21, m_rgbColor);
s.writeString(22, m_title);
Expand Down Expand Up @@ -102,6 +106,8 @@ bool ChannelPowerSettings::deserialize(const QByteArray& data)
d.readFloat(2, &m_rfBandwidth, 10000.0f);
d.readFloat(3, &m_pulseThreshold, 50.0f);
d.readS32(4, &m_averagePeriodUS, 100000);
d.readS32(5, (int *) &m_frequencyMode, (int) Offset);
d.readS64(6, &m_frequency);

d.readU32(21, &m_rgbColor, QColor(102, 40, 220).rgb());
d.readString(22, &m_title, "Channel Power");
Expand Down Expand Up @@ -161,6 +167,18 @@ void ChannelPowerSettings::applySettings(const QStringList& settingsKeys, const
if (settingsKeys.contains("averagePeriodUS")) {
m_averagePeriodUS = settings.m_averagePeriodUS;
}
if (settingsKeys.contains("frequencyMode")) {
m_frequencyMode = settings.m_frequencyMode;
}
if (settingsKeys.contains("frequency")) {
m_frequency = settings.m_frequency;
}
if (settingsKeys.contains("rgbColor")) {
m_rgbColor = settings.m_rgbColor;
}
if (settingsKeys.contains("title")) {
m_title = settings.m_title;
}
if (settingsKeys.contains("useReverseAPI")) {
m_useReverseAPI = settings.m_useReverseAPI;
}
Expand Down Expand Up @@ -191,6 +209,12 @@ QString ChannelPowerSettings::getDebugString(const QStringList& settingsKeys, bo
if (settingsKeys.contains("averagePeriodUS") || force) {
ostr << " m_averagePeriodUS: " << m_averagePeriodUS;
}
if (settingsKeys.contains("frequencyMode") || force) {
ostr << " m_frequencyMode: " << m_frequencyMode;
}
if (settingsKeys.contains("frequency") || force) {
ostr << " m_frequency: " << m_frequency;
}
if (settingsKeys.contains("useReverseAPI") || force) {
ostr << " m_useReverseAPI: " << m_useReverseAPI;
}
Expand All @@ -200,7 +224,7 @@ QString ChannelPowerSettings::getDebugString(const QStringList& settingsKeys, bo
if (settingsKeys.contains("reverseAPIPort") || force) {
ostr << " m_reverseAPIPort: " << m_reverseAPIPort;
}
if (settingsKeys.contains("everseAPIDeviceIndex") || force) {
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
}

Expand Down
7 changes: 6 additions & 1 deletion plugins/channelrx/channelpower/channelpowersettings.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB. //
// Copyright (C) 2023 Jon Beniston, M7RCE //
// Copyright (C) 2023-2024 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
Expand Down Expand Up @@ -32,6 +32,11 @@ struct ChannelPowerSettings
Real m_rfBandwidth;
float m_pulseThreshold;
int m_averagePeriodUS;
enum FrequencyMode {
Offset,
Absolute
} m_frequencyMode;
qint64 m_frequency;

quint32 m_rgbColor;
QString m_title;
Expand Down
3 changes: 1 addition & 2 deletions plugins/channelrx/demodais/aisdemodsink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ void AISDemodSink::applySettings(const AISDemodSettings& settings, bool force)
m_interpolator.create(16, m_channelSampleRate, settings.m_rfBandwidth / 2.2);
m_interpolatorDistance = (Real) m_channelSampleRate / (Real) AISDemodSettings::AISDEMOD_CHANNEL_SAMPLE_RATE;
m_interpolatorDistanceRemain = m_interpolatorDistance;
m_lowpass.create(301, AISDemodSettings::AISDEMOD_CHANNEL_SAMPLE_RATE, settings.m_rfBandwidth / 2.0f);
}
if ((settings.m_fmDeviation != m_settings.m_fmDeviation) || force)
{
Expand All @@ -423,7 +422,7 @@ void AISDemodSink::applySettings(const AISDemodSettings& settings, bool force)
if ((settings.m_baud != m_settings.m_baud) || force)
{
m_samplesPerSymbol = AISDemodSettings::AISDEMOD_CHANNEL_SAMPLE_RATE / settings.m_baud;
qDebug() << "ISDemodSink::applySettings: m_samplesPerSymbol: " << m_samplesPerSymbol << " baud " << settings.m_baud;
qDebug() << "AISDemodSink::applySettings: m_samplesPerSymbol: " << m_samplesPerSymbol << " baud " << settings.m_baud;
m_pulseShape.create(0.5, 3, m_samplesPerSymbol);

// Recieve buffer, long enough for one max length message
Expand Down
1 change: 0 additions & 1 deletion plugins/channelrx/demodais/aisdemodsink.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ class AISDemodSink : public ChannelSampleSink {

MovingAverageUtil<Real, double, 16> m_movingAverage;

Lowpass<Complex> m_lowpass; // RF input filter
PhaseDiscriminators m_phaseDiscri; // FM demodulator
Gaussian<Real> m_pulseShape; // Pulse shaping filter
Real *m_rxBuf; // Receive sample buffer, large enough for one max length messsage
Expand Down
4 changes: 1 addition & 3 deletions plugins/channelrx/demodam/amdemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void AMDemodGUI::channelMarkerChangedByCursor()
}

m_settings.m_frequency = m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset;
int value = 0;
qint64 value = 0;

if (m_settings.m_frequencyMode == AMDemodSettings::Offset) {
value = m_settings.m_inputFrequencyOffset;
Expand All @@ -292,8 +292,6 @@ void AMDemodGUI::channelMarkerChangedByCursor()

void AMDemodGUI::on_deltaFrequency_changed(qint64 value)
{
(void) value;

qint64 offset = 0;

if (m_settings.m_frequencyMode == AMDemodSettings::Offset)
Expand Down
Loading

0 comments on commit b939a98

Please sign in to comment.