diff --git a/Conf.cpp b/Conf.cpp index eaf7263..0f62639 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -187,6 +187,7 @@ m_fmRFAck("K"), m_fmNetAck("N"), m_fmAckSpeed(20U), m_fmAckFrequency(1750U), +m_fmAckMinTime(5U), m_fmAckDelay(1000U), m_fmAckLevel(80.0F), m_fmTimeoutLevel(80.0F), @@ -727,6 +728,8 @@ bool CConf::read() m_fmAckSpeed = (unsigned int)::atoi(value); else if (::strcmp(key, "AckFrequency") == 0) m_fmAckFrequency = (unsigned int)::atoi(value); + else if (::strcmp(key, "AckMinTime") == 0) + m_fmAckMinTime = (unsigned int)::atoi(value); else if (::strcmp(key, "AckDelay") == 0) m_fmAckDelay = (unsigned int)::atoi(value); else if (::strcmp(key, "AckLevel") == 0) @@ -1555,6 +1558,11 @@ unsigned int CConf::getFMAckFrequency() const return m_fmAckFrequency; } +unsigned int CConf::getFMAckMinTime() const +{ + return m_fmAckMinTime; +} + unsigned int CConf::getFMAckDelay() const { return m_fmAckDelay; diff --git a/Conf.h b/Conf.h index 2460cb9..84127a4 100644 --- a/Conf.h +++ b/Conf.h @@ -185,6 +185,7 @@ public: std::string getFMNetAck() const; unsigned int getFMAckSpeed() const; unsigned int getFMAckFrequency() const; + unsigned int getFMAckMinTime() const; unsigned int getFMAckDelay() const; float getFMAckLevel() const; float getFMTimeoutLevel() const; @@ -445,6 +446,7 @@ private: std::string m_fmNetAck; unsigned int m_fmAckSpeed; unsigned int m_fmAckFrequency; + unsigned int m_fmAckMinTime; unsigned int m_fmAckDelay; float m_fmAckLevel; float m_fmTimeoutLevel; diff --git a/MMDVM.ini b/MMDVM.ini index f7c73bc..c7b70a4 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -155,6 +155,7 @@ RFAck=K NetAck=N AckSpeed=20 AckFrequency=1750 +AckMinTime=4 AckDelay=1000 AckLevel=80 TimeoutLevel=80 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 9693309..e1c34ad 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -620,6 +620,7 @@ int CMMDVMHost::run() std::string netAck = m_conf.getFMNetAck(); unsigned int ackSpeed = m_conf.getFMAckSpeed(); unsigned int ackFrequency = m_conf.getFMAckFrequency(); + unsigned int ackMinTime = m_conf.getFMAckMinTime(); unsigned int ackDelay = m_conf.getFMAckDelay(); float ackLevel = m_conf.getFMAckLevel(); unsigned int timeout = m_conf.getTimeout(); @@ -644,6 +645,7 @@ int CMMDVMHost::run() LogInfo(" Net Ack: %s", netAck.c_str()); LogInfo(" Ack Speed: %uWPM", ackSpeed); LogInfo(" Ack Frequency: %uHz", ackFrequency); + LogInfo(" Ack Min Time: %us", ackMinTime); LogInfo(" Ack Delay: %ums", ackDelay); LogInfo(" Ack Level: %.1f%%", ackLevel); LogInfo(" Timeout: %us", timeout); @@ -655,7 +657,7 @@ int CMMDVMHost::run() LogInfo(" Hang Time: %us", hangTime); m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignHighLevel, callsignLowLevel, callsignAtStart, callsignAtEnd); - m_modem->setFMAckParams(rfAck, ackSpeed, ackFrequency, ackDelay, ackLevel); + m_modem->setFMAckParams(rfAck, ackSpeed, ackFrequency, ackMinTime, ackDelay, ackLevel); m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime); } diff --git a/Modem.cpp b/Modem.cpp index a3fa859..3b9e51a 100644 --- a/Modem.cpp +++ b/Modem.cpp @@ -1893,12 +1893,12 @@ bool CModem::setFMCallsignParams(const std::string& callsign, unsigned int calls return true; } -bool CModem::setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackDelay, float ackLevel) +bool CModem::setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackMinTime, unsigned int ackDelay, float ackLevel) { assert(m_serial != NULL); unsigned char buffer[80U]; - unsigned char len = 7U + ack.size(); + unsigned char len = 8U + ack.size(); buffer[0U] = MMDVM_FRAME_START; buffer[1U] = len; @@ -1906,12 +1906,13 @@ bool CModem::setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsig buffer[3U] = ackSpeed; buffer[4U] = ackFrequency / 10U; - buffer[5U] = ackDelay / 10U; + buffer[5U] = ackMinTime; + buffer[6U] = ackDelay / 10U; - buffer[6U] = (unsigned char)(ackLevel * 2.55F + 0.5F); + buffer[7U] = (unsigned char)(ackLevel * 2.55F + 0.5F); for (unsigned int i = 0U; i < ack.size(); i++) - buffer[7U + i] = ack.at(i); + buffer[8U + i] = ack.at(i); // CUtils::dump(1U, "Written", buffer, len); diff --git a/Modem.h b/Modem.h index 6b0fbe3..82ba207 100644 --- a/Modem.h +++ b/Modem.h @@ -46,7 +46,7 @@ public: virtual void setTransparentDataParams(unsigned int sendFrameType); virtual bool 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 bool setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackDelay, float ackLevel); + virtual bool setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int minTime, unsigned int ackDelay, float ackLevel); virtual bool setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, float ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime); virtual bool open();