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

Fix M17 FM frequency deviation to work at +/-2.4kHz.

This commit is contained in:
srcejon 2023-11-17 16:44:47 +00:00
parent 66351cff30
commit c7436c946f
5 changed files with 8 additions and 8 deletions

View File

@ -34,7 +34,7 @@ void M17DemodSettings::resetToDefaults()
{
m_inputFrequencyOffset = 0;
m_rfBandwidth = 12500.0;
m_fmDeviation = 3500.0;
m_fmDeviation = 2400.0;
m_volume = 2.0;
m_baudRate = 4800;
m_squelchGate = 5; // 10s of ms at 48000 Hz sample rate. Corresponds to 2400 for AGC attack

View File

@ -334,7 +334,7 @@ void M17DemodSink::applySettings(const M17DemodSettings& settings, const QList<Q
}
if (settingsKeys.contains("fmDeviation") || force) {
m_phaseDiscri.setFMScaling(48000.0f / (2.0f*settings.m_fmDeviation));
m_phaseDiscri.setFMScaling(48000.0f / (2.0f*M_PI*settings.m_fmDeviation));
}
if (settingsKeys.contains("squelchGate") || force)

View File

@ -164,7 +164,7 @@ void M17ModGUI::on_rfBW_valueChanged(int value)
void M17ModGUI::on_fmDev_valueChanged(int value)
{
ui->fmDevText->setText(QString("%1%2k").arg(QChar(0xB1, 0x00)).arg(value / 10.0, 0, 'f', 1));
m_settings.m_fmDeviation = value * 200.0;
m_settings.m_fmDeviation = value * 100.0;
applySettings(QList<QString>{"fmDeviation"});
}
@ -570,8 +570,8 @@ void M17ModGUI::displaySettings()
ui->rfBWText->setText(QString("%1k").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1));
ui->rfBW->setValue(m_settings.m_rfBandwidth / 100.0);
ui->fmDevText->setText(QString("%1%2k").arg(QChar(0xB1, 0x00)).arg(m_settings.m_fmDeviation / 2000.0, 0, 'f', 1));
ui->fmDev->setValue(m_settings.m_fmDeviation / 200.0);
ui->fmDevText->setText(QString("%1%2k").arg(QChar(0xB1, 0x00)).arg(m_settings.m_fmDeviation / 1000.0, 0, 'f', 1));
ui->fmDev->setValue(m_settings.m_fmDeviation / 100.0);
ui->volumeText->setText(QString("%1").arg(m_settings.m_volumeFactor, 0, 'f', 1));
ui->volume->setValue(m_settings.m_volumeFactor * 10.0);

View File

@ -35,7 +35,7 @@ void M17ModSettings::resetToDefaults()
{
m_inputFrequencyOffset = 0;
m_rfBandwidth = 16000.0f;
m_fmDeviation = 10000.0f; //!< full deviation
m_fmDeviation = 2400.0; //!< peak deviation
m_toneFrequency = 1000.0f;
m_volumeFactor = 1.0f;
m_channelMute = false;
@ -146,7 +146,7 @@ bool M17ModSettings::deserialize(const QByteArray& data)
d.readS32(1, &tmp, 0);
m_inputFrequencyOffset = tmp;
d.readReal(2, &m_rfBandwidth, 12500.0);
d.readReal(4, &m_fmDeviation, 10000.0);
d.readReal(4, &m_fmDeviation, 2400.0);
d.readU32(5, &m_rgbColor);
d.readReal(6, &m_toneFrequency, 1000.0);
d.readReal(7, &m_volumeFactor, 1.0);

View File

@ -177,7 +177,7 @@ void M17ModSource::modulateSample()
calculateLevel(t);
t1 = m_lowpass.filter(t) * 1.5f;
m_modPhasor += (m_settings.m_fmDeviation / (float) m_audioSampleRate) * t1;
m_modPhasor += ((2.0f * M_PI * m_settings.m_fmDeviation) / (float) m_audioSampleRate) * t1;
// limit phasor range to ]-pi,pi]
if (m_modPhasor > M_PI) {