Add two more FM parameters.

This commit is contained in:
Jonathan Naylor 2020-04-25 15:15:56 +01:00
parent ac344cec69
commit 3d1602e50e
7 changed files with 48 additions and 9 deletions

View file

@ -196,6 +196,8 @@ m_fmCTCSSThreshold(40U),
m_fmCTCSSLevel(2.0F),
m_fmKerchunkTime(0U),
m_fmHangTime(7U),
m_fmUseCOS(true),
m_fmRXBoost(1U),
m_dstarNetworkEnabled(false),
m_dstarGatewayAddress(),
m_dstarGatewayPort(0U),
@ -746,6 +748,10 @@ bool CConf::read()
m_fmKerchunkTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "HangTime") == 0)
m_fmHangTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "UseCOS") == 0)
m_fmUseCOS = ::atoi(value) == 1;
else if (::strcmp(key, "RXBoost") == 0)
m_fmRXBoost = (unsigned int)::atoi(value);
} else if (section == SECTION_DSTAR_NETWORK) {
if (::strcmp(key, "Enable") == 0)
m_dstarNetworkEnabled = ::atoi(value) == 1;
@ -1603,6 +1609,16 @@ unsigned int CConf::getFMHangTime() const
return m_fmHangTime;
}
bool CConf::getFMUseCOS() const
{
return m_fmUseCOS;
}
unsigned int CConf::getFMRXBoost() const
{
return m_fmRXBoost;
}
bool CConf::getDStarNetworkEnabled() const
{
return m_dstarNetworkEnabled;

4
Conf.h
View file

@ -194,6 +194,8 @@ public:
float getFMCTCSSLevel() const;
unsigned int getFMKerchunkTime() const;
unsigned int getFMHangTime() const;
bool getFMUseCOS() const;
unsigned int getFMRXBoost() const;
// The D-Star Network section
bool getDStarNetworkEnabled() const;
@ -455,6 +457,8 @@ private:
float m_fmCTCSSLevel;
unsigned int m_fmKerchunkTime;
unsigned int m_fmHangTime;
bool m_fmUseCOS;
unsigned int m_fmRXBoost;
bool m_dstarNetworkEnabled;
std::string m_dstarGatewayAddress;

View file

@ -164,6 +164,8 @@ CTCSSThreshold=30
CTCSSLevel=20
KerchunkTime=0
HangTime=7
UseCOS=1
RXBoost=1
[D-Star Network]
Enable=1

View file

@ -1229,6 +1229,8 @@ bool CMMDVMHost::createModem()
float ctcssLevel = m_conf.getFMCTCSSLevel();
unsigned int kerchunkTime = m_conf.getFMKerchunkTime();
unsigned int hangTime = m_conf.getFMHangTime();
bool useCOS = m_conf.getFMUseCOS();
unsigned int rxBoost = m_conf.getFMRXBoost();
LogInfo("FM Parameters");
LogInfo(" Callsign: %s", callsign.c_str());
@ -1254,10 +1256,12 @@ bool CMMDVMHost::createModem()
LogInfo(" CTCSS Level: %.1f%%", ctcssLevel);
LogInfo(" Kerchunk Time: %us", kerchunkTime);
LogInfo(" Hang Time: %us", hangTime);
LogInfo(" Use COS: %s", useCOS ? "yes" : "no");
LogInfo(" RX Boost: x%u", rxBoost);
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);
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, rxBoost);
}
bool ret = m_modem->open();

View file

@ -190,7 +190,9 @@ m_fmCtcssFrequency(88.4F),
m_fmCtcssThreshold(25U),
m_fmCtcssLevel(10.0F),
m_fmKerchunkTime(0U),
m_fmHangTime(5U)
m_fmHangTime(5U),
m_fmUseCOS(true),
m_fmRXBoost(1U)
{
m_buffer = new unsigned char[BUFFER_LENGTH];
@ -1902,7 +1904,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)
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)
{
m_fmTimeout = timeout;
m_fmTimeoutLevel = timeoutLevel;
@ -1913,6 +1915,9 @@ void CModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctc
m_fmKerchunkTime = kerchunkTime;
m_fmHangTime = hangTime;
m_fmUseCOS = useCOS;
m_fmRXBoost = rxBoost;
}
bool CModem::setFMCallsignParams()
@ -2033,7 +2038,7 @@ bool CModem::setFMMiscParams()
unsigned char buffer[20U];
buffer[0U] = MMDVM_FRAME_START;
buffer[1U] = 10U;
buffer[1U] = 12U;
buffer[2U] = MMDVM_FM_PARAMS3;
buffer[3U] = m_fmTimeout / 5U;
@ -2046,10 +2051,16 @@ bool CModem::setFMMiscParams()
buffer[8U] = m_fmKerchunkTime;
buffer[9U] = m_fmHangTime;
// CUtils::dump(1U, "Written", buffer, 10U);
buffer[10U] = 0x00U;
if (m_fmUseCOS)
buffer[10U] |= 0x01U;
int ret = m_serial->write(buffer, 10U);
if (ret != 10)
buffer[11U] = m_fmRXBoost;
// CUtils::dump(1U, "Written", buffer, 12U);
int ret = m_serial->write(buffer, 12U);
if (ret != 12)
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);
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 bool open();
@ -206,6 +206,8 @@ private:
float m_fmCtcssLevel;
unsigned int m_fmKerchunkTime;
unsigned int m_fmHangTime;
bool m_fmUseCOS;
unsigned int m_fmRXBoost;
bool readVersion();
bool readStatus();

View file

@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200424";
const char* VERSION = "20200425";
#endif