1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

Tidy up. Add docs.

This commit is contained in:
srcejon 2023-09-07 09:43:12 +01:00
parent 75c04ef9e7
commit 3f906baf1f
9 changed files with 33 additions and 76 deletions

BIN
doc/img/PSK31Mod_plugin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -113,7 +113,6 @@ bool PSK31GUI::handleMessage(const Message& message)
}
ui->txButton->setToolTip(tooltip);
s = s.replace(">", ""); // Don't display LTRS
s = s.replace("\r", ""); // Don't display carriage returns
if (!s.isEmpty())
@ -186,7 +185,7 @@ void PSK31GUI::on_deltaFrequency_changed(qint64 value)
void PSK31GUI::on_rfBW_valueChanged(int value)
{
int bw = value;
ui->rfBWText->setText(formatFrequency(bw));
ui->rfBWText->setText(QString("%1 Hz").arg(bw));
m_channelMarker.setBandwidth(bw);
m_settings.m_rfBandwidth = bw;
applySettings();
@ -444,15 +443,6 @@ void PSK31GUI::applySettings(bool force)
}
}
QString PSK31GUI::formatFrequency(int frequency) const
{
QString suffix = "";
if (width() > 450) {
suffix = " Hz";
}
return QString("%1%2").arg(frequency).arg(suffix);
}
QString PSK31GUI::substitute(const QString& text)
{
const MainSettings& mainSettings = MainCore::instance()->getSettings();
@ -483,14 +473,14 @@ void PSK31GUI::displaySettings()
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->rfBWText->setText(formatFrequency(m_settings.m_rfBandwidth));
ui->rfBWText->setText(QString("%1 Hz").arg(m_settings.m_rfBandwidth));
ui->rfBW->setValue(m_settings.m_rfBandwidth);
ui->udpEnabled->setChecked(m_settings.m_udpEnabled);
ui->udpAddress->setText(m_settings.m_udpAddress);
ui->udpPort->setText(QString::number(m_settings.m_udpPort));
ui->gainText->setText(QString("%1").arg((double)m_settings.m_gain, 0, 'f', 1));
ui->gainText->setText(QString("%1dB").arg((double)m_settings.m_gain, 0, 'f', 1));
ui->gain->setValue(m_settings.m_gain);
ui->channelMute->setChecked(m_settings.m_channelMute);

View File

@ -77,7 +77,7 @@ private:
QString m_initialToolTip;
PSK31* m_psk31Mod;
MovingAverageUtil<double, double, 2> m_channelPowerDbAvg; // Less than other mods, as packets are short
MovingAverageUtil<double, double, 20> m_channelPowerDbAvg;
MessageQueue m_inputMessageQueue;
@ -88,7 +88,6 @@ private:
void blockApplySettings(bool block);
void applySettings(bool force = false);
void displaySettings();
QString formatFrequency(int frequency) const;
bool handleMessage(const Message& message);
void makeUIConnections();
void updateAbsoluteCenterFrequency();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>396</width>
<height>702</height>
<height>700</height>
</rect>
</property>
<property name="sizePolicy">
@ -43,7 +43,7 @@
<x>2</x>
<y>2</y>
<width>391</width>
<height>211</height>
<height>161</height>
</rect>
</property>
<property name="minimumSize">
@ -213,19 +213,19 @@
<string>RF bandwidth</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>2000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>100</number>
<number>10</number>
</property>
<property name="value">
<number>340</number>
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -241,7 +241,7 @@
</size>
</property>
<property name="text">
<string>1700</string>
<string>500 Hz</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -429,30 +429,6 @@
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="callsignLayout">
<item>
<spacer name="horizontalSpacerSettings">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="ButtonSwitch" name="repeat">
<property name="toolTip">
@ -483,6 +459,13 @@
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="packetDataLayout">
<item>

View File

@ -36,7 +36,7 @@ void PSK31Settings::resetToDefaults()
{
m_inputFrequencyOffset = 0;
m_baud = 31.25;
m_rfBandwidth = 340;
m_rfBandwidth = 100;
m_gain = 0.0f;
m_channelMute = false;
m_repeat = false;
@ -52,7 +52,7 @@ void PSK31Settings::resetToDefaults()
"UR 599 QTH IS ${location}",
"TU DE ${callsign} CQ"
});
m_rgbColor = QColor(180, 205, 130).rgb();
m_rgbColor = QColor(25, 180, 200).rgb();
m_title = "PSK31 Modulator";
m_streamIndex = 0;
m_useReverseAPI = false;
@ -139,7 +139,7 @@ bool PSK31Settings::deserialize(const QByteArray& data)
d.readS32(1, &tmp, 0);
m_inputFrequencyOffset = tmp;
d.readReal(2, &m_baud, 31.25f);
d.readS32(3, &m_rfBandwidth, 340);
d.readS32(3, &m_rfBandwidth, 100);
d.readReal(5, &m_gain, 0.0f);
d.readBool(6, &m_channelMute, false);
d.readBool(7, &m_repeat, false);

View File

@ -30,7 +30,6 @@ PSK31Source::PSK31Source() :
m_channelSampleRate(48000),
m_channelFrequencyOffset(0),
m_spectrumRate(2000),
m_fmPhase(0.0),
m_spectrumSink(nullptr),
m_specSampleBufferIndex(0),
m_magsq(0.0),
@ -42,8 +41,8 @@ PSK31Source::PSK31Source() :
m_bitCount(0)
{
m_bits.append(0);
m_lowpass.create(301, m_channelSampleRate, 400.0 / 2.0);
m_pulseShape.create(0.5, 6, m_channelSampleRate / 45.45, true);
m_lowpass.create(301, m_channelSampleRate, 100.0 / 2.0);
m_pulseShape.create(0.5, 6, m_channelSampleRate / 31.25, true);
m_demodBuffer.resize(1<<12);
m_demodBufferFill = 0;
@ -258,8 +257,6 @@ void PSK31Source::applySettings(const PSK31Settings& settings, bool force)
m_settings = settings;
// Precalculate FM sensensity and linear gain to save doing it in the loop
m_phaseSensitivity = 2.0f * M_PI * 1100 / (double)m_channelSampleRate;
m_linearGain = powf(10.0f, m_settings.m_gain/20.0f);
}
@ -303,9 +300,6 @@ void PSK31Source::applyChannelSettings(int channelSampleRate, int channelFrequen
m_samplesPerSymbol = m_channelSampleRate / m_settings.m_baud;
qDebug() << "m_samplesPerSymbol: " << m_samplesPerSymbol << " (" << m_channelSampleRate << "/" << m_settings.m_baud << ")";
// Precalculate FM sensensity to save doing it in the loop
m_phaseSensitivity = 2.0f * M_PI * 1100 / (double)m_channelSampleRate;
QList<ObjectPipe*> pipes;
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
@ -349,7 +343,6 @@ void PSK31Source::addBit(int bit)
m_bits[m_byteIdx] |= bit << m_bitIdx;
m_bitIdx++;
m_bitCount++;
m_bitCountTotal++;
if (m_bitIdx == 8)
{
m_byteIdx++;
@ -364,8 +357,6 @@ void PSK31Source::initTX()
{
m_byteIdx = 0;
m_bitIdx = 0;
m_bitCount = m_bitCountTotal; // Reset to allow retransmission
m_bit = 0;
}
void PSK31Source::addTXText(QString text)
@ -377,7 +368,7 @@ void PSK31Source::addTXText(QString text)
QString s = text;
if (m_settings.m_prefixCRLF) {
s.prepend("\r\r\n>"); // '>' switches to letters
s.prepend("\r\r\n");
}
if (m_settings.m_postfixCRLF) {
s.append("\r\r\n");
@ -393,7 +384,6 @@ void PSK31Source::encodeText(const QString& text)
m_byteIdx = 0;
m_bitIdx = 0;
m_bitCount = 0;
m_bitCountTotal = 0;
for (int i = 0; i < m_bits.size(); i++) {
m_bits[i] = 0;
}
@ -423,12 +413,9 @@ void PSK31Source::encodeIdle()
m_byteIdx = 0;
m_bitIdx = 0;
m_bitCount = 0;
m_bitCountTotal = 0;
for (int i = 0; i < m_bits.size(); i++) {
m_bits[i] = 0;
}
addBit(0);
addBit(0);
addBit(0);
addBit(0);
}

View File

@ -70,15 +70,12 @@ private:
ChannelAPI *m_channel;
NCO m_carrierNco;
double m_fmPhase; // Double gives cleaner spectrum than Real
double m_phaseSensitivity;
Real m_linearGain;
Complex m_modSample;
int m_bit; // Current bit
int m_prevBit; // Previous bit, for differential encoding
int m_symbol; // Current symbol
int m_prevSymbol;
int m_prevSymbol; // Previous symbol for differential encoding
RaisedCosine<Real> m_pulseShape; // Pulse shaping filter
Lowpass<Complex> m_lowpass; // Low pass filter to limit RF bandwidth
@ -113,7 +110,6 @@ private:
int m_byteIdx; // Index in to m_bits
int m_bitIdx; // Index in to current byte of m_bits
int m_bitCount; // Count of number of valid bits in m_bits
int m_bitCountTotal;
QVector<qint16> m_demodBuffer;
int m_demodBufferFill;

View File

@ -29,10 +29,10 @@
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="prefixCRLF">
<property name="toolTip">
<string>Prefix text with carriage returns, line feed and switch to letters</string>
<string>Prefix text with carriage returns and line feed</string>
</property>
<property name="text">
<string>Prefix CR+CR+LF+LTRS</string>
<string>Prefix CR+CR+LF</string>
</property>
</widget>
</item>

View File

@ -63,6 +63,8 @@ Enter text to transmit. Pressing return will transmit the text and clear this fi
The list of pre-defined text can be customised via the Transmit Settings dialog (13).
PSK31 supports the extended ASCII character set.
<h3>13: TX</h3>
Press to transmit the current text. The text field will not be cleared.