1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Morse Decoder: added scope from RTTY decoder

This commit is contained in:
f4exb 2024-05-17 18:51:13 +02:00
parent 39bc799509
commit 112cd4cac4
8 changed files with 371 additions and 2 deletions

View File

@ -122,6 +122,7 @@ void MorseDecoder::start()
&QThread::deleteLater
);
m_worker->setScopeVis(&m_scopeVis);
m_worker->setMessageQueueToFeature(getInputMessageQueue());
m_worker->startWork();
m_state = StRunning;

View File

@ -27,6 +27,7 @@
#include "feature/feature.h"
#include "util/message.h"
#include "availablechannelorfeaturehandler.h"
#include "dsp/scopevis.h"
#include "morsedecodersettings.h"
@ -213,6 +214,8 @@ public:
const QStringList& featureSettingsKeys,
SWGSDRangel::SWGFeatureSettings& response);
ScopeVis *getScopeVis() { return &m_scopeVis; }
static const char* const m_featureIdURI;
static const char* const m_featureId;
@ -222,6 +225,7 @@ private:
bool m_running;
MorseDecoderWorker *m_worker;
MorseDecoderSettings m_settings;
ScopeVis m_scopeVis;
AvailableChannelOrFeatureList m_availableChannels;
AvailableChannelOrFeatureHandler m_availableChannelOrFeatureHandler;
ChannelAPI *m_selectedChannel;

View File

@ -86,6 +86,7 @@ bool MorseDecoderGUI::handleMessage(const Message& message)
}
blockApplySettings(true);
ui->scopeGUI->updateSettings();
displaySettings();
blockApplySettings(false);
@ -192,7 +193,10 @@ MorseDecoderGUI::MorseDecoderGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISe
m_morseDecoder = reinterpret_cast<MorseDecoder*>(feature);
m_morseDecoder->setMessageQueueToGUI(&m_inputMessageQueue);
m_scopeVis = m_morseDecoder->getScopeVis();
m_scopeVis->setGLScope(ui->glScope);
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
m_scopeVis->setLiveRate(4000);
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
@ -204,6 +208,7 @@ MorseDecoderGUI::MorseDecoderGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISe
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
m_settings.setScopeGUI(ui->scopeGUI);
m_settings.setRollupState(&m_rollupState);
displaySettings();

View File

@ -32,6 +32,7 @@ class PluginAPI;
class FeatureUISet;
class MorseDecoder;
class Feature;
class ScopeVis;
namespace Ui {
class MorseDecoderGUI;
@ -63,6 +64,7 @@ private:
bool m_doApplySettings;
MorseDecoder* m_morseDecoder;
ScopeVis* m_scopeVis;
MessageQueue m_inputMessageQueue;
QTimer m_statusTimer;
int m_lastFeatureState;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>422</width>
<height>810</height>
<height>754</height>
</rect>
</property>
<property name="sizePolicy">
@ -443,6 +443,335 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="scopeContainer" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>400</y>
<width>420</width>
<height>341</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>420</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Waveforms</string>
</property>
<layout class="QVBoxLayout" name="transmittedLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<layout class="QHBoxLayout" name="scopelLayout">
<item>
<widget class="QLabel" name="channel1Label">
<property name="text">
<string>Real</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="channel1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>I</string>
</property>
</item>
<item>
<property name="text">
<string>Q</string>
</property>
</item>
<item>
<property name="text">
<string>Mag Sq</string>
</property>
</item>
<item>
<property name="text">
<string>Sample Idx</string>
</property>
</item>
<item>
<property name="text">
<string>abs(Sum1)</string>
</property>
</item>
<item>
<property name="text">
<string>abs(Sum2)</string>
</property>
</item>
<item>
<property name="text">
<string>Bit</string>
</property>
</item>
<item>
<property name="text">
<string>Bit Cnt</string>
</property>
</item>
<item>
<property name="text">
<string>Got SOP</string>
</property>
</item>
<item>
<property name="text">
<string>Real(exp)</string>
</property>
</item>
<item>
<property name="text">
<string>Imag(exp)</string>
</property>
</item>
<item>
<property name="text">
<string>abs(sum1)Filt</string>
</property>
</item>
<item>
<property name="text">
<string>abs(sum2)Filt</string>
</property>
</item>
<item>
<property name="text">
<string>Diff</string>
</property>
</item>
<item>
<property name="text">
<string>DiffFilt</string>
</property>
</item>
<item>
<property name="text">
<string>data</string>
</property>
</item>
<item>
<property name="text">
<string>clock</string>
</property>
</item>
<item>
<property name="text">
<string>Env1</string>
</property>
</item>
<item>
<property name="text">
<string>Env2</string>
</property>
</item>
<item>
<property name="text">
<string>Bias1</string>
</property>
</item>
<item>
<property name="text">
<string>Bias2</string>
</property>
</item>
<item>
<property name="text">
<string>Unbiased data</string>
</property>
</item>
<item>
<property name="text">
<string>Biased data</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="channel2Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Imag</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="channel2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>I</string>
</property>
</item>
<item>
<property name="text">
<string>Q</string>
</property>
</item>
<item>
<property name="text">
<string>Mag Sq</string>
</property>
</item>
<item>
<property name="text">
<string>Sample Idx</string>
</property>
</item>
<item>
<property name="text">
<string>abs(Sum1)</string>
</property>
</item>
<item>
<property name="text">
<string>abs(Sum2)</string>
</property>
</item>
<item>
<property name="text">
<string>Bit</string>
</property>
</item>
<item>
<property name="text">
<string>Bit Cnt</string>
</property>
</item>
<item>
<property name="text">
<string>Got SOP</string>
</property>
</item>
<item>
<property name="text">
<string>Real(exp)</string>
</property>
</item>
<item>
<property name="text">
<string>imag(exp)</string>
</property>
</item>
<item>
<property name="text">
<string>abs(sum1)Filt</string>
</property>
</item>
<item>
<property name="text">
<string>abs(sum2)Filt</string>
</property>
</item>
<item>
<property name="text">
<string>Diff</string>
</property>
</item>
<item>
<property name="text">
<string>DiffFilt</string>
</property>
</item>
<item>
<property name="text">
<string>data</string>
</property>
</item>
<item>
<property name="text">
<string>clock</string>
</property>
</item>
<item>
<property name="text">
<string>Env1</string>
</property>
</item>
<item>
<property name="text">
<string>Env2</string>
</property>
</item>
<item>
<property name="text">
<string>Bias1</string>
</property>
</item>
<item>
<property name="text">
<string>Bias2</string>
</property>
</item>
<item>
<property name="text">
<string>Unbiased data</string>
</property>
</item>
<item>
<property name="text">
<string>Biased data</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="GLScope" name="glScope" native="true">
<property name="minimumSize">
<size>
<width>200</width>
<height>250</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>8</pointsize>
</font>
</property>
</widget>
</item>
<item>
<widget class="GLScopeGUI" name="scopeGUI" native="true"/>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
@ -456,6 +785,18 @@
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScope</class>
<extends>QWidget</extends>
<header>gui/glscope.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScopeGUI</class>
<extends>QWidget</extends>
<header>gui/glscopegui.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>

View File

@ -58,6 +58,10 @@ QByteArray MorseDecoderSettings::serialize() const
{
SimpleSerializer s(1);
if (m_scopeGUI) {
s.writeBlob(2, m_scopeGUI->serialize());
}
s.writeString(5, m_title);
s.writeU32(6, m_rgbColor);
s.writeBool(7, m_useReverseAPI);
@ -99,6 +103,12 @@ bool MorseDecoderSettings::deserialize(const QByteArray& data)
uint32_t utmp;
QString strtmp;
if (m_scopeGUI)
{
d.readBlob(2, &bytetmp);
m_scopeGUI->deserialize(bytetmp);
}
d.readString(5, &m_title, "Demod Analyzer");
d.readU32(6, &m_rgbColor, QColor(0, 255, 0).rgb());
d.readBool(7, &m_useReverseAPI, false);

View File

@ -32,6 +32,7 @@ struct MorseDecoderSettings
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIFeatureSetIndex;
uint16_t m_reverseAPIFeatureIndex;
Serializable *m_scopeGUI;
Serializable *m_rollupState;
int m_workspaceIndex;
QByteArray m_geometryBytes;
@ -47,6 +48,7 @@ struct MorseDecoderSettings
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
void setScopeGUI(Serializable *scopeGUI) { m_scopeGUI = scopeGUI; }
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
void applySettings(const QStringList& settingsKeys, const MorseDecoderSettings& settings);
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;

View File

@ -33,6 +33,8 @@
#include "morsedecodersettings.h"
class ScopeVis;
class MorseDecoderWorker : public QObject {
Q_OBJECT
public:
@ -89,6 +91,7 @@ public:
void stopWork();
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
void setMessageQueueToFeature(MessageQueue *messageQueue) { m_msgQueueToFeature = messageQueue; }
void setScopeVis(ScopeVis* scopeVis) { m_scopeVis = scopeVis; }
void applySampleRate(int sampleRate);
void applySettings(const MorseDecoderSettings& settings, const QList<QString>& settingsKeys, bool force = false);
@ -111,6 +114,7 @@ private:
bool m_auto;
float m_pitchHz;
float m_speedWPM;
ScopeVis* m_scopeVis;
void feedPart(
const QByteArray::const_iterator& begin,