diff --git a/Conf.cpp b/Conf.cpp index 0b573bb..a83792e 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -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; diff --git a/Conf.h b/Conf.h index 7be95d6..1e2ac51 100644 --- a/Conf.h +++ b/Conf.h @@ -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; diff --git a/MMDVM.ini b/MMDVM.ini index 25aabde..36b1c1b 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -164,6 +164,8 @@ CTCSSThreshold=30 CTCSSLevel=20 KerchunkTime=0 HangTime=7 +UseCOS=1 +RXBoost=1 [D-Star Network] Enable=1 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 123f4ee..2ba9346 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -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(); diff --git a/Modem.cpp b/Modem.cpp index 5bc6485..2f6d24b 100644 --- a/Modem.cpp +++ b/Modem.cpp @@ -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; diff --git a/Modem.h b/Modem.h index d879b1c..2aecf67 100644 --- a/Modem.h +++ b/Modem.h @@ -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(); diff --git a/Version.h b/Version.h index b5fc453..5247a92 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200424"; +const char* VERSION = "20200425"; #endif