Handle any frequency offset in the oscillator.
This commit is contained in:
parent
dc08c18db7
commit
a3c25766c0
6 changed files with 26 additions and 9 deletions
8
Conf.cpp
8
Conf.cpp
|
@ -69,6 +69,7 @@ m_modemTXDelay(100U),
|
|||
m_modemDMRDelay(0U),
|
||||
m_modemRXLevel(100U),
|
||||
m_modemTXLevel(100U),
|
||||
m_modemOscOffset(0),
|
||||
m_modemDebug(false),
|
||||
m_dstarEnabled(true),
|
||||
m_dstarModule("C"),
|
||||
|
@ -212,6 +213,8 @@ bool CConf::read()
|
|||
m_modemRXLevel = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "TXLevel") == 0)
|
||||
m_modemTXLevel = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "OscOffset") == 0)
|
||||
m_modemOscOffset = ::atoi(value);
|
||||
else if (::strcmp(key, "Debug") == 0)
|
||||
m_modemDebug = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_DSTAR) {
|
||||
|
@ -416,6 +419,11 @@ unsigned int CConf::getModemTXLevel() const
|
|||
return m_modemTXLevel;
|
||||
}
|
||||
|
||||
int CConf::getModemOscOffset() const
|
||||
{
|
||||
return m_modemOscOffset;
|
||||
}
|
||||
|
||||
bool CConf::getModemDebug() const
|
||||
{
|
||||
return m_modemDebug;
|
||||
|
|
2
Conf.h
2
Conf.h
|
@ -62,6 +62,7 @@ public:
|
|||
unsigned int getModemDMRDelay() const;
|
||||
unsigned int getModemRXLevel() const;
|
||||
unsigned int getModemTXLevel() const;
|
||||
int getModemOscOffset() const;
|
||||
bool getModemDebug() const;
|
||||
|
||||
// The D-Star section
|
||||
|
@ -139,6 +140,7 @@ private:
|
|||
unsigned int m_modemDMRDelay;
|
||||
unsigned int m_modemRXLevel;
|
||||
unsigned int m_modemTXLevel;
|
||||
int m_modemOscOffset;
|
||||
bool m_modemDebug;
|
||||
|
||||
bool m_dstarEnabled;
|
||||
|
|
|
@ -33,6 +33,7 @@ TXDelay=100
|
|||
DMRDelay=0
|
||||
RXLevel=50
|
||||
TXLevel=50
|
||||
OscOffset=0
|
||||
Debug=0
|
||||
|
||||
[D-Star]
|
||||
|
|
|
@ -419,6 +419,7 @@ bool CMMDVMHost::createModem()
|
|||
unsigned int colorCode = m_conf.getDMRColorCode();
|
||||
unsigned int rxFrequency = m_conf.getRxFrequency();
|
||||
unsigned int txFrequency = m_conf.getTxFrequency();
|
||||
int oscOffset = m_conf.getModemOscOffset();
|
||||
|
||||
LogInfo("Modem Parameters");
|
||||
LogInfo(" Port: %s", port.c_str());
|
||||
|
@ -426,13 +427,14 @@ bool CMMDVMHost::createModem()
|
|||
LogInfo(" TX Invert: %s", txInvert ? "yes" : "no");
|
||||
LogInfo(" PTT Invert: %s", pttInvert ? "yes" : "no");
|
||||
LogInfo(" TX Delay: %ums", txDelay);
|
||||
LogInfo(" DMR Delay: %u", dmrDelay);
|
||||
LogInfo(" DMR Delay: %u (%.1fms)", dmrDelay, float(dmrDelay) * 0.0416666F);
|
||||
LogInfo(" RX Level: %u%%", rxLevel);
|
||||
LogInfo(" TX Level: %u%%", txLevel);
|
||||
LogInfo(" RX Frequency: %uHz", rxFrequency);
|
||||
LogInfo(" TX Frequency: %uHz", txFrequency);
|
||||
LogInfo(" Osc. Offset: %dppm", oscOffset);
|
||||
|
||||
m_modem = new CModem(port, rxInvert, txInvert, pttInvert, txDelay, rxLevel, txLevel, dmrDelay, debug);
|
||||
m_modem = new CModem(port, rxInvert, txInvert, pttInvert, txDelay, rxLevel, txLevel, dmrDelay, oscOffset, debug);
|
||||
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled);
|
||||
m_modem->setRFParams(rxFrequency, txFrequency);
|
||||
m_modem->setDMRParams(colorCode);
|
||||
|
|
15
Modem.cpp
15
Modem.cpp
|
@ -72,7 +72,7 @@ const unsigned int MAX_RESPONSES = 30U;
|
|||
const unsigned int BUFFER_LENGTH = 500U;
|
||||
|
||||
|
||||
CModem::CModem(const std::string& port, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int rxLevel, unsigned int txLevel, unsigned int dmrDelay, bool debug) :
|
||||
CModem::CModem(const std::string& port, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int rxLevel, unsigned int txLevel, unsigned int dmrDelay, int oscOffset, bool debug) :
|
||||
m_port(port),
|
||||
m_colorCode(0U),
|
||||
m_rxInvert(rxInvert),
|
||||
|
@ -82,6 +82,7 @@ m_txDelay(txDelay),
|
|||
m_dmrDelay(dmrDelay),
|
||||
m_rxLevel(rxLevel),
|
||||
m_txLevel(txLevel),
|
||||
m_oscOffset(oscOffset),
|
||||
m_debug(debug),
|
||||
m_rxFrequency(0U),
|
||||
m_txFrequency(0U),
|
||||
|
@ -724,11 +725,11 @@ bool CModem::readStatus()
|
|||
|
||||
bool CModem::setConfig()
|
||||
{
|
||||
unsigned char buffer[11U];
|
||||
unsigned char buffer[12U];
|
||||
|
||||
buffer[0U] = MMDVM_FRAME_START;
|
||||
|
||||
buffer[1U] = 11U;
|
||||
buffer[1U] = 12U;
|
||||
|
||||
buffer[2U] = MMDVM_SET_CONFIG;
|
||||
|
||||
|
@ -759,10 +760,12 @@ bool CModem::setConfig()
|
|||
|
||||
buffer[10U] = m_dmrDelay;
|
||||
|
||||
// CUtils::dump(1U, "Written", buffer, 11U);
|
||||
buffer[11U] = (unsigned char)(m_oscOffset + 128);
|
||||
|
||||
int ret = m_serial.write(buffer, 11U);
|
||||
if (ret != 11)
|
||||
// CUtils::dump(1U, "Written", buffer, 12U);
|
||||
|
||||
int ret = m_serial.write(buffer, 12U);
|
||||
if (ret != 12)
|
||||
return false;
|
||||
|
||||
unsigned int count = 0U;
|
||||
|
|
3
Modem.h
3
Modem.h
|
@ -33,7 +33,7 @@ enum RESP_TYPE_MMDVM {
|
|||
|
||||
class CModem {
|
||||
public:
|
||||
CModem(const std::string& port, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int rxLevel, unsigned int txLevel, unsigned int dmrDelay, bool debug = false);
|
||||
CModem(const std::string& port, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int rxLevel, unsigned int txLevel, unsigned int dmrDelay, int oscOffset, bool debug = false);
|
||||
~CModem();
|
||||
|
||||
void setRFParams(unsigned int rxFrequency, unsigned int txFrequency);
|
||||
|
@ -78,6 +78,7 @@ private:
|
|||
unsigned int m_dmrDelay;
|
||||
unsigned int m_rxLevel;
|
||||
unsigned int m_txLevel;
|
||||
int m_oscOffset;
|
||||
bool m_debug;
|
||||
unsigned int m_rxFrequency;
|
||||
unsigned int m_txFrequency;
|
||||
|
|
Loading…
Reference in a new issue