From 1a142e36cb1dc794c1cacd2cf57f7f23e358ce08 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 4 May 2020 22:30:16 +0100 Subject: [PATCH] Host support for the CallsignAtLatch option. --- Conf.cpp | 8 ++++++++ Conf.h | 2 ++ MMDVM.ini | 1 + MMDVMHost.cpp | 4 +++- Modem.cpp | 6 +++++- Modem.h | 3 ++- Version.h | 2 +- 7 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Conf.cpp b/Conf.cpp index e204fa9..23f7596 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -182,6 +182,7 @@ m_fmCallsignHighLevel(35.0F), m_fmCallsignLowLevel(15.0F), m_fmCallsignAtStart(true), m_fmCallsignAtEnd(true), +m_fmCallsignAtLatch(true), m_fmRFAck("K"), m_fmExtAck("N"), m_fmAckSpeed(20U), @@ -716,6 +717,8 @@ bool CConf::read() m_fmCallsignAtStart = ::atoi(value) == 1; else if (::strcmp(key, "CallsignAtEnd") == 0) m_fmCallsignAtEnd = ::atoi(value) == 1; + else if (::strcmp(key, "CallsignAtLatch") == 0) + m_fmCallsignAtLatch = ::atoi(value) == 1; else if (::strcmp(key, "RFAck") == 0) { // Convert the ack to upper case for (unsigned int i = 0U; value[i] != 0; i++) @@ -1545,6 +1548,11 @@ bool CConf::getFMCallsignAtEnd() const return m_fmCallsignAtEnd; } +bool CConf::getFMCallsignAtLatch() const +{ + return m_fmCallsignAtLatch; +} + std::string CConf::getFMRFAck() const { return m_fmRFAck; diff --git a/Conf.h b/Conf.h index 14678e1..0ba0955 100644 --- a/Conf.h +++ b/Conf.h @@ -180,6 +180,7 @@ public: float getFMCallsignLowLevel() const; bool getFMCallsignAtStart() const; bool getFMCallsignAtEnd() const; + bool getFMCallsignAtLatch() const; std::string getFMRFAck() const; std::string getFMExtAck() const; unsigned int getFMAckSpeed() const; @@ -445,6 +446,7 @@ private: float m_fmCallsignLowLevel; bool m_fmCallsignAtStart; bool m_fmCallsignAtEnd; + bool m_fmCallsignAtLatch; std::string m_fmRFAck; std::string m_fmExtAck; unsigned int m_fmAckSpeed; diff --git a/MMDVM.ini b/MMDVM.ini index d504978..9faaecc 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -150,6 +150,7 @@ CallsignHighLevel=50 CallsignLowLevel=20 CallsignAtStart=1 CallsignAtEnd=1 +CallsignAtLatch=0 RFAck=K ExtAck=N AckSpeed=20 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index b9449e0..961d9a2 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -1215,6 +1215,7 @@ bool CMMDVMHost::createModem() float callsignLowLevel = m_conf.getFMCallsignLowLevel(); bool callsignAtStart = m_conf.getFMCallsignAtStart(); bool callsignAtEnd = m_conf.getFMCallsignAtEnd(); + bool callsignAtLatch = m_conf.getFMCallsignAtLatch(); std::string rfAck = m_conf.getFMRFAck(); std::string extAck = m_conf.getFMExtAck(); unsigned int ackSpeed = m_conf.getFMAckSpeed(); @@ -1244,6 +1245,7 @@ bool CMMDVMHost::createModem() LogInfo(" Callsign Low Level: %.1f%%", callsignLowLevel); LogInfo(" Callsign At Start: %s", callsignAtStart ? "yes" : "no"); LogInfo(" Callsign At End: %s", callsignAtEnd ? "yes" : "no"); + LogInfo(" Callsign At Latch: %s", callsignAtLatch ? "yes" : "no"); LogInfo(" RF Ack: %s", rfAck.c_str()); // LogInfo(" Ext. Ack: %s", extAck.c_str()); LogInfo(" Ack Speed: %uWPM", ackSpeed); @@ -1263,7 +1265,7 @@ bool CMMDVMHost::createModem() LogInfo(" Max. Deviation Level: %.1f%%", maxDevLevel); // LogInfo(" Ext. Audio Boost: x%u", extAudioBoost); - m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignHighLevel, callsignLowLevel, callsignAtStart, callsignAtEnd); + m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignHighLevel, callsignLowLevel, callsignAtStart, callsignAtEnd, callsignAtLatch); m_modem->setFMAckParams(rfAck, ackSpeed, ackFrequency, ackMinTime, ackDelay, ackLevel); m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, rfAudioBoost, maxDevLevel); } diff --git a/Modem.cpp b/Modem.cpp index 784aa3e..3041567 100644 --- a/Modem.cpp +++ b/Modem.cpp @@ -178,6 +178,7 @@ m_fmCallsignHighLevel(35.0F), m_fmCallsignLowLevel(15.0F), m_fmCallsignAtStart(true), m_fmCallsignAtEnd(true), +m_fmCallsignAtLatch(true), m_fmRfAck("K"), m_fmAckSpeed(20U), m_fmAckFrequency(1750U), @@ -1887,7 +1888,7 @@ bool CModem::writeDMRShortLC(const unsigned char* lc) return m_serial->write(buffer, 12U) == 12; } -void CModem::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) +void CModem::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, bool callsignAtLatch) { m_fmCallsign = callsign; m_fmCallsignSpeed = callsignSpeed; @@ -1898,6 +1899,7 @@ void CModem::setFMCallsignParams(const std::string& callsign, unsigned int calls m_fmCallsignLowLevel = callsignLowLevel; m_fmCallsignAtStart = callsignAtStart; m_fmCallsignAtEnd = callsignAtEnd; + m_fmCallsignAtLatch = callsignAtLatch; } void CModem::setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackMinTime, unsigned int ackDelay, float ackLevel) @@ -1951,6 +1953,8 @@ bool CModem::setFMCallsignParams() buffer[9U] |= 0x01U; if (m_fmCallsignAtEnd) buffer[9U] |= 0x02U; + if (m_fmCallsignAtLatch) + buffer[9U] |= 0x04U; for (unsigned int i = 0U; i < m_fmCallsign.size(); i++) buffer[10U + i] = m_fmCallsign.at(i); diff --git a/Modem.h b/Modem.h index 0533fa1..edb30ec 100644 --- a/Modem.h +++ b/Modem.h @@ -45,7 +45,7 @@ public: virtual void setYSFParams(bool loDev, unsigned int txHang); virtual void setTransparentDataParams(unsigned int sendFrameType); - 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 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, bool callsignAtLatch); 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 rfAudioBoost, float maxDevLevel); @@ -194,6 +194,7 @@ private: float m_fmCallsignLowLevel; bool m_fmCallsignAtStart; bool m_fmCallsignAtEnd; + bool m_fmCallsignAtLatch; std::string m_fmRfAck; unsigned int m_fmAckSpeed; unsigned int m_fmAckFrequency; diff --git a/Version.h b/Version.h index 8e901ee..4b0d9cc 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200428"; +const char* VERSION = "20200504"; #endif