Add the maximum deviation level.

This commit is contained in:
Jonathan Naylor
2020-04-25 22:43:14 +01:00
parent 3d1602e50e
commit 56746e1320
6 changed files with 26 additions and 8 deletions

View File

@@ -198,6 +198,7 @@ m_fmKerchunkTime(0U),
m_fmHangTime(7U),
m_fmUseCOS(true),
m_fmRXBoost(1U),
m_fmMaxDevLevel(90.0F),
m_dstarNetworkEnabled(false),
m_dstarGatewayAddress(),
m_dstarGatewayPort(0U),
@@ -752,6 +753,8 @@ bool CConf::read()
m_fmUseCOS = ::atoi(value) == 1;
else if (::strcmp(key, "RXBoost") == 0)
m_fmRXBoost = (unsigned int)::atoi(value);
else if (::strcmp(key, "MaxDevLevel") == 0)
m_fmMaxDevLevel = float(::atof(value));
} else if (section == SECTION_DSTAR_NETWORK) {
if (::strcmp(key, "Enable") == 0)
m_dstarNetworkEnabled = ::atoi(value) == 1;
@@ -1619,6 +1622,11 @@ unsigned int CConf::getFMRXBoost() const
return m_fmRXBoost;
}
float CConf::getFMMaxDevLevel() const
{
return m_fmMaxDevLevel;
}
bool CConf::getDStarNetworkEnabled() const
{
return m_dstarNetworkEnabled;

2
Conf.h
View File

@@ -196,6 +196,7 @@ public:
unsigned int getFMHangTime() const;
bool getFMUseCOS() const;
unsigned int getFMRXBoost() const;
float getFMMaxDevLevel() const;
// The D-Star Network section
bool getDStarNetworkEnabled() const;
@@ -459,6 +460,7 @@ private:
unsigned int m_fmHangTime;
bool m_fmUseCOS;
unsigned int m_fmRXBoost;
float m_fmMaxDevLevel;
bool m_dstarNetworkEnabled;
std::string m_dstarGatewayAddress;

View File

@@ -166,6 +166,7 @@ KerchunkTime=0
HangTime=7
UseCOS=1
RXBoost=1
MaxDevLevel=90
[D-Star Network]
Enable=1

View File

@@ -1231,6 +1231,7 @@ bool CMMDVMHost::createModem()
unsigned int hangTime = m_conf.getFMHangTime();
bool useCOS = m_conf.getFMUseCOS();
unsigned int rxBoost = m_conf.getFMRXBoost();
float maxDevLevel = m_conf.getFMMaxDevLevel();
LogInfo("FM Parameters");
LogInfo(" Callsign: %s", callsign.c_str());
@@ -1258,10 +1259,11 @@ bool CMMDVMHost::createModem()
LogInfo(" Hang Time: %us", hangTime);
LogInfo(" Use COS: %s", useCOS ? "yes" : "no");
LogInfo(" RX Boost: x%u", rxBoost);
LogInfo(" Max. Deviation Level: %.1f%%", maxDevLevel);
m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignHighLevel, callsignLowLevel, callsignAtStart, callsignAtEnd);
m_modem->setFMAckParams(rfAck, ackSpeed, ackFrequency, ackMinTime, ackDelay, ackLevel);
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, rxBoost);
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, rxBoost, maxDevLevel);
}
bool ret = m_modem->open();

View File

@@ -192,7 +192,8 @@ m_fmCtcssLevel(10.0F),
m_fmKerchunkTime(0U),
m_fmHangTime(5U),
m_fmUseCOS(true),
m_fmRXBoost(1U)
m_fmRXBoost(1U),
m_fmMaxDevLevel(90.0F)
{
m_buffer = new unsigned char[BUFFER_LENGTH];
@@ -1904,7 +1905,7 @@ void CModem::setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, uns
m_fmAckLevel = ackLevel;
}
void CModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, bool useCOS, unsigned int rxBoost)
void CModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, bool useCOS, unsigned int rxBoost, float maxDevLevel)
{
m_fmTimeout = timeout;
m_fmTimeoutLevel = timeoutLevel;
@@ -1918,6 +1919,7 @@ void CModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctc
m_fmUseCOS = useCOS;
m_fmRXBoost = rxBoost;
m_fmMaxDevLevel = maxDevLevel;
}
bool CModem::setFMCallsignParams()
@@ -2038,7 +2040,7 @@ bool CModem::setFMMiscParams()
unsigned char buffer[20U];
buffer[0U] = MMDVM_FRAME_START;
buffer[1U] = 12U;
buffer[1U] = 13U;
buffer[2U] = MMDVM_FM_PARAMS3;
buffer[3U] = m_fmTimeout / 5U;
@@ -2057,10 +2059,12 @@ bool CModem::setFMMiscParams()
buffer[11U] = m_fmRXBoost;
// CUtils::dump(1U, "Written", buffer, 12U);
buffer[12U] = (unsigned char)(m_fmMaxDevLevel * 2.55F + 0.5F);
int ret = m_serial->write(buffer, 12U);
if (ret != 12)
// CUtils::dump(1U, "Written", buffer, 13U);
int ret = m_serial->write(buffer, 13U);
if (ret != 13)
return false;
unsigned int count = 0U;

View File

@@ -47,7 +47,7 @@ public:
virtual void setFMCallsignParams(const std::string& callsign, unsigned int callsignSpeed, unsigned int callsignFrequency, unsigned int callsignTime, unsigned int callsignHoldoff, float callsignHighLevel, float callsignLowLevel, bool callsignAtStart, bool callsignAtEnd);
virtual void setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackMinTime, unsigned int ackDelay, float ackLevel);
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, bool useCOS, unsigned int rxBoost);
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, bool useCOS, unsigned int rxBoost, float maxDevLevel);
virtual bool open();
@@ -208,6 +208,7 @@ private:
unsigned int m_fmHangTime;
bool m_fmUseCOS;
unsigned int m_fmRXBoost;
float m_fmMaxDevLevel;
bool readVersion();
bool readStatus();