1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 10:33:29 -05:00

DATV demod: removed leansdr dependency in DATV demod settings and GUI

This commit is contained in:
f4exb 2019-07-16 18:40:00 +02:00
parent 354b59c793
commit 35cd053485
5 changed files with 97 additions and 38 deletions

View File

@ -556,7 +556,7 @@ void DATVDemod::InitDATVFramework()
m_objCfg.standard = m_settings.m_standard;
m_objCfg.fec = m_settings.m_fec;
m_objCfg.fec = (leansdr::code_rate) getLeanDVBCodeRateFromDATV(m_settings.m_fec);
m_objCfg.Fs = (float) m_sampleRate;
m_objCfg.Fm = (float) m_settings.m_symbolRate;
m_objCfg.fastlock = m_settings.m_fastLock;
@ -888,7 +888,7 @@ void DATVDemod::InitDATVS2Framework()
m_objCfg.standard = m_settings.m_standard;
m_objCfg.fec = m_settings.m_fec;
m_objCfg.fec = (leansdr::code_rate) getLeanDVBCodeRateFromDATV(m_settings.m_fec);
m_objCfg.Fs = (float) m_sampleRate;
m_objCfg.Fm = (float) m_settings.m_symbolRate;
m_objCfg.fastlock = m_settings.m_fastLock;
@ -1444,40 +1444,40 @@ int DATVDemod::GetSampleRate()
return m_sampleRate;
}
DATVDemodSettings::DATVCodeRates getCodeRateFromLeanDVBCode(int leanDVBCodeRate)
DATVDemodSettings::DATVCodeRate DATVDemod::getCodeRateFromLeanDVBCode(int leanDVBCodeRate)
{
if (leanDVBCodeRate == leansdr::code_rate::FEC12) {
return DATVDemodSettings::DATVCodeRates::FEC12;
return DATVDemodSettings::DATVCodeRate::FEC12;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC13) {
return DATVDemodSettings::DATVCodeRates::FEC13;
return DATVDemodSettings::DATVCodeRate::FEC13;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC14) {
return DATVDemodSettings::DATVCodeRates::FEC14;
return DATVDemodSettings::DATVCodeRate::FEC14;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC23) {
return DATVDemodSettings::DATVCodeRates::FEC23;
return DATVDemodSettings::DATVCodeRate::FEC23;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC25) {
return DATVDemodSettings::DATVCodeRates::FEC25;
return DATVDemodSettings::DATVCodeRate::FEC25;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC34) {
return DATVDemodSettings::DATVCodeRates::FEC34;
return DATVDemodSettings::DATVCodeRate::FEC34;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC35) {
return DATVDemodSettings::DATVCodeRates::FEC35;
return DATVDemodSettings::DATVCodeRate::FEC35;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC45) {
return DATVDemodSettings::DATVCodeRates::FEC45;
return DATVDemodSettings::DATVCodeRate::FEC45;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC46) {
return DATVDemodSettings::DATVCodeRates::FEC46;
return DATVDemodSettings::DATVCodeRate::FEC46;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC56) {
return DATVDemodSettings::DATVCodeRates::FEC56;
return DATVDemodSettings::DATVCodeRate::FEC56;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC78) {
return DATVDemodSettings::DATVCodeRates::FEC78;
return DATVDemodSettings::DATVCodeRate::FEC78;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC89) {
return DATVDemodSettings::DATVCodeRates::FEC89;
return DATVDemodSettings::DATVCodeRate::FEC89;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC910) {
return DATVDemodSettings::DATVCodeRates::FEC910;
return DATVDemodSettings::DATVCodeRate::FEC910;
} else {
return DATVDemodSettings::DATVCodeRates::FEC12;
return DATVDemodSettings::DATVCodeRate::FEC12;
}
}
DATVDemodSettings::DATVModulation getModulationFromLeanDVBCode(int leanDVBModulation)
DATVDemodSettings::DATVModulation DATVDemod::getModulationFromLeanDVBCode(int leanDVBModulation)
{
if (leanDVBModulation == leansdr::cstln_base::predef::APSK16) {
return DATVDemodSettings::DATVModulation::APSK16;
@ -1501,3 +1501,61 @@ DATVDemodSettings::DATVModulation getModulationFromLeanDVBCode(int leanDVBModula
return DATVDemodSettings::DATVModulation::BPSK;
}
}
int DATVDemod::getLeanDVBCodeRateFromDATV(DATVDemodSettings::DATVCodeRate datvCodeRate)
{
if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC12) {
return (int) leansdr::code_rate::FEC12;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC13) {
return (int) leansdr::code_rate::FEC13;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC14) {
return (int) leansdr::code_rate::FEC14;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC23) {
return (int) leansdr::code_rate::FEC23;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC25) {
return (int) leansdr::code_rate::FEC25;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC34) {
return (int) leansdr::code_rate::FEC34;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC35) {
return (int) leansdr::code_rate::FEC35;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC45) {
return (int) leansdr::code_rate::FEC45;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC46) {
return (int) leansdr::code_rate::FEC46;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC56) {
return (int) leansdr::code_rate::FEC56;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC78) {
return (int) leansdr::code_rate::FEC78;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC89) {
return (int) leansdr::code_rate::FEC89;
} else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC910) {
return (int) leansdr::code_rate::FEC910;
} else {
return (int) leansdr::code_rate::FEC12;
}
}
int DATVDemod::getLeanDVBModulationFromDATV(DATVDemodSettings::DATVModulation datvModulation)
{
if (datvModulation == DATVDemodSettings::DATVModulation::APSK16) {
return (int) leansdr::cstln_base::predef::APSK16;
} else if (datvModulation == DATVDemodSettings::DATVModulation::APSK32) {
return (int) leansdr::cstln_base::predef::APSK32;
} else if (datvModulation == DATVDemodSettings::DATVModulation::APSK64E) {
return (int) leansdr::cstln_base::predef::APSK64E;
} else if (datvModulation == DATVDemodSettings::DATVModulation::BPSK) {
return (int) leansdr::cstln_base::predef::BPSK;
} else if (datvModulation == DATVDemodSettings::DATVModulation::PSK8) {
return (int) leansdr::cstln_base::predef::PSK8;
} else if (datvModulation == DATVDemodSettings::DATVModulation::QAM16) {
return (int) leansdr::cstln_base::predef::QAM16;
} else if (datvModulation == DATVDemodSettings::DATVModulation::QAM64) {
return (int) leansdr::cstln_base::predef::QAM64;
} else if (datvModulation == DATVDemodSettings::DATVModulation::QAM256) {
return (int) leansdr::cstln_base::predef::QAM256;
} else if (datvModulation == DATVDemodSettings::DATVModulation::QPSK) {
return (int) leansdr::cstln_base::predef::QPSK;
} else {
return (int) leansdr::cstln_base::predef::BPSK;
}
}

View File

@ -185,8 +185,10 @@ public:
void InitDATVFramework();
void InitDATVS2Framework();
double getMagSq() const { return m_objMagSqAverage; } //!< Beware this is scaled to 2^30
static DATVDemodSettings::DATVCodeRates getCodeRateFromLeanDVBCode(int leanDVBCodeRate);
static DATVDemodSettings::DATVCodeRate getCodeRateFromLeanDVBCode(int leanDVBCodeRate);
static DATVDemodSettings::DATVModulation getModulationFromLeanDVBCode(int leanDVBModulation);
static int getLeanDVBCodeRateFromDATV(DATVDemodSettings::DATVCodeRate datvCodeRate);
static int getLeanDVBModulationFromDATV(DATVDemodSettings::DATVModulation datvModulation);
static const QString m_channelIdURI;
static const QString m_channelId;

View File

@ -314,23 +314,23 @@ void DATVDemodGUI::applySettings(bool force)
strFEC = ui->cmbFEC->currentText();
if (strFEC == "1/2") {
m_settings.m_fec = leansdr::FEC12;
m_settings.m_fec = DATVDemodSettings::FEC12;
} else if (strFEC == "2/3") {
m_settings.m_fec = leansdr::FEC23;
m_settings.m_fec = DATVDemodSettings::FEC23;
} else if (strFEC == "3/4") {
m_settings.m_fec = leansdr::FEC34;
m_settings.m_fec = DATVDemodSettings::FEC34;
} else if (strFEC == "5/6") {
m_settings.m_fec = leansdr::FEC56;
m_settings.m_fec = DATVDemodSettings::FEC56;
} else if (strFEC == "7/8") {
m_settings.m_fec = leansdr::FEC78;
m_settings.m_fec = DATVDemodSettings::FEC78;
} else if (strFEC == "4/5") {
m_settings.m_fec = leansdr::FEC45;
m_settings.m_fec = DATVDemodSettings::FEC45;
} else if (strFEC == "8/9") {
m_settings.m_fec = leansdr::FEC89;
m_settings.m_fec = DATVDemodSettings::FEC89;
} else if (strFEC == "9/10") {
m_settings.m_fec = leansdr::FEC910;
m_settings.m_fec = DATVDemodSettings::FEC910;
} else {
m_settings.m_fec = leansdr::FEC12;
m_settings.m_fec = DATVDemodSettings::FEC12;
}
if (ui->cmbFilter->currentIndex() == 0) {

View File

@ -38,7 +38,7 @@ void DATVDemodSettings::resetToDefaults()
m_centerFrequency = 0;
m_standard = DVB_S;
m_modulation = BPSK;
m_fec = leansdr::FEC12;
m_fec = FEC12;
m_symbolRate = 250000;
m_notchFilters = 1;
m_allowDrift = false;
@ -122,9 +122,9 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
d.readU32(7, &m_rgbColor, QColor(Qt::magenta).rgb());
d.readString(8, &m_title, "DATV Demodulator");
d.readS32(9, &tmp, (int) leansdr::code_rate::FEC12);
tmp = tmp < 0 ? 0 : tmp >= (int) leansdr::code_rate::FEC_COUNT ? (int) leansdr::code_rate::FEC_COUNT - 1 : tmp;
m_fec = (leansdr::code_rate) tmp;
d.readS32(9, &tmp, (int) FEC12);
tmp = tmp < 0 ? 0 : tmp >= (int) FEC_COUNT ? (int) FEC_COUNT - 1 : tmp;
m_fec = (DATVCodeRate) tmp;
d.readBool(10, &m_audioMute, false);
d.readS32(11, &m_symbolRate, 250000);
@ -156,7 +156,7 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
void DATVDemodSettings::debug(const QString& msg) const
{
qDebug() << msg
<< " m_standard: " << m_standard
<< " m_standard: " << m_standard
<< " m_allowDrift: " << m_allowDrift
<< " m_rfBandwidth: " << m_rfBandwidth
<< " m_centerFrequency: " << m_centerFrequency

View File

@ -22,8 +22,6 @@
#include <QString>
#include <stdint.h>
#include "leansdr/dvb.h"
class Serializable;
struct DATVDemodSettings
@ -47,7 +45,7 @@ struct DATVDemodSettings
QAM256
};
enum DATVCodeRates
enum DATVCodeRate
{
FEC12,
FEC23,
@ -61,7 +59,8 @@ struct DATVDemodSettings
FEC14,
FEC13,
FEC25,
FEC35
FEC35,
FEC_COUNT
};
enum dvb_sampler
@ -78,7 +77,7 @@ struct DATVDemodSettings
int m_centerFrequency;
dvb_version m_standard;
DATVModulation m_modulation;
leansdr::code_rate m_fec;
DATVCodeRate m_fec;
bool m_audioMute;
QString m_audioDeviceName;
int m_symbolRate;