From 31beeee6040afe0499cb74a1d8c1213fba892598 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 21 May 2018 21:32:33 +0100 Subject: [PATCH] Add the YSF TX hang parameter. --- Conf.cpp | 8 ++++++++ Conf.h | 2 ++ MMDVM.ini | 1 + MMDVMHost.cpp | 17 ++++++++++------- Modem.cpp | 16 ++++++++++------ Modem.h | 3 ++- 6 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Conf.cpp b/Conf.cpp index 41b68015a..8f2837745 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -141,6 +141,7 @@ m_fusionEnabled(false), m_fusionLowDeviation(false), m_fusionRemoteGateway(false), m_fusionSelfOnly(false), +m_fusionTXHang(4U), m_fusionSQLEnabled(false), m_fusionSQL(0U), m_fusionModeHang(10U), @@ -553,6 +554,8 @@ bool CConf::read() m_fusionRemoteGateway = ::atoi(value) == 1; else if (::strcmp(key, "SelfOnly") == 0) m_fusionSelfOnly = ::atoi(value) == 1; + else if (::strcmp(key, "TXHang") == 0) + m_fusionTXHang = (unsigned int)::atoi(value); else if (::strcmp(key, "ModeHang") == 0) m_fusionModeHang = (unsigned int)::atoi(value); } else if (section == SECTION_P25) { @@ -1147,6 +1150,11 @@ bool CConf::getFusionRemoteGateway() const return m_fusionRemoteGateway; } +unsigned int CConf::getFusionTXHang() const +{ + return m_fusionTXHang; +} + bool CConf::getFusionSelfOnly() const { return m_fusionSelfOnly; diff --git a/Conf.h b/Conf.h index 26d0aa267..f85c17b44 100644 --- a/Conf.h +++ b/Conf.h @@ -136,6 +136,7 @@ class CConf bool getFusionLowDeviation() const; bool getFusionRemoteGateway() const; bool getFusionSelfOnly() const; + unsigned int getFusionTXHang() const; bool getFusionSQLEnabled() const; unsigned char getFusionSQL() const; unsigned int getFusionModeHang() const; @@ -338,6 +339,7 @@ class CConf bool m_fusionLowDeviation; bool m_fusionRemoteGateway; bool m_fusionSelfOnly; + unsigned int m_fusionTXHang; bool m_fusionSQLEnabled; unsigned char m_fusionSQL; unsigned int m_fusionModeHang; diff --git a/MMDVM.ini b/MMDVM.ini index d62a355ac..f9d93575a 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -107,6 +107,7 @@ TXHang=4 Enable=1 LowDeviation=0 SelfOnly=0 +TXHang=4 #DGID=1 RemoteGateway=0 # ModeHang=10 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 0cf02a96f..d3ef606fb 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -474,16 +474,18 @@ int CMMDVMHost::run() CYSFControl* ysf = NULL; if (m_ysfEnabled) { - bool lowDeviation = m_conf.getFusionLowDeviation(); - bool remoteGateway = m_conf.getFusionRemoteGateway(); - bool selfOnly = m_conf.getFusionSelfOnly(); - bool sqlEnabled = m_conf.getFusionSQLEnabled(); - unsigned char sql = m_conf.getFusionSQL(); - m_ysfRFModeHang = m_conf.getFusionModeHang(); + bool lowDeviation = m_conf.getFusionLowDeviation(); + bool remoteGateway = m_conf.getFusionRemoteGateway(); + unsigned int txHang = m_conf.getFusionTXHang(); + bool selfOnly = m_conf.getFusionSelfOnly(); + bool sqlEnabled = m_conf.getFusionSQLEnabled(); + unsigned char sql = m_conf.getFusionSQL(); + m_ysfRFModeHang = m_conf.getFusionModeHang(); LogInfo("YSF RF Parameters"); LogInfo(" Low Deviation: %s", lowDeviation ? "yes" : "no"); LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no"); + LogInfo(" TX Hang: %us", txHang); LogInfo(" Self Only: %s", selfOnly ? "yes" : "no"); LogInfo(" DSQ: %s", sqlEnabled ? "yes" : "no"); if (sqlEnabled) @@ -996,6 +998,7 @@ bool CMMDVMHost::createModem() bool debug = m_conf.getModemDebug(); unsigned int colorCode = m_conf.getDMRColorCode(); bool lowDeviation = m_conf.getFusionLowDeviation(); + unsigned int txHang = m_conf.getFusionTXHang(); unsigned int rxFrequency = m_conf.getRXFrequency(); unsigned int txFrequency = m_conf.getTXFrequency(); int rxOffset = m_conf.getModemRXOffset(); @@ -1031,7 +1034,7 @@ bool CMMDVMHost::createModem() m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel); m_modem->setRFParams(rxFrequency, rxOffset, txFrequency, txOffset, txDCOffset, rxDCOffset, rfLevel); m_modem->setDMRParams(colorCode); - m_modem->setYSFParams(lowDeviation); + m_modem->setYSFParams(lowDeviation, txHang); bool ret = m_modem->open(); if (!ret) { diff --git a/Modem.cpp b/Modem.cpp index 82ad756cd..037935bd5 100644 --- a/Modem.cpp +++ b/Modem.cpp @@ -93,6 +93,7 @@ CModem::CModem(const std::string& port, bool duplex, bool rxInvert, bool txInver m_port(port), m_dmrColorCode(0U), m_ysfLoDev(false), +m_ysfTXHang(4U), m_duplex(duplex), m_rxInvert(rxInvert), m_txInvert(txInvert), @@ -196,9 +197,10 @@ void CModem::setDMRParams(unsigned int colorCode) m_dmrColorCode = colorCode; } -void CModem::setYSFParams(bool loDev) +void CModem::setYSFParams(bool loDev, unsigned int txHang) { - m_ysfLoDev = loDev; + m_ysfLoDev = loDev; + m_ysfTXHang = txHang; } bool CModem::open() @@ -1125,7 +1127,7 @@ bool CModem::setConfig() buffer[0U] = MMDVM_FRAME_START; - buffer[1U] = 19U; + buffer[1U] = 20U; buffer[2U] = MMDVM_SET_CONFIG; @@ -1179,10 +1181,12 @@ bool CModem::setConfig() buffer[18U] = (unsigned char)(m_nxdnTXLevel * 2.55F + 0.5F); - // CUtils::dump(1U, "Written", buffer, 19U); + buffer[19U] = (unsigned char)m_ysfTXHang; - int ret = m_serial.write(buffer, 19U); - if (ret != 19) + // CUtils::dump(1U, "Written", buffer, 20U); + + int ret = m_serial.write(buffer, 20U); + if (ret != 20) return false; unsigned int count = 0U; diff --git a/Modem.h b/Modem.h index b5273736c..37ef76fc2 100644 --- a/Modem.h +++ b/Modem.h @@ -41,7 +41,7 @@ class CModem { void setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled, bool nxdnEnabled); void setLevels(float rxLevel, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel); void setDMRParams(unsigned int colorCode); - void setYSFParams(bool loDev); + void setYSFParams(bool loDev, unsigned int txHang); bool open(); @@ -96,6 +96,7 @@ class CModem { std::string m_port; unsigned int m_dmrColorCode; bool m_ysfLoDev; + unsigned int m_ysfTXHang; bool m_duplex; bool m_rxInvert; bool m_txInvert;