diff --git a/Conf.cpp b/Conf.cpp index a8201b8..94fd7bd 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -115,6 +115,7 @@ m_dmrSlot2TGWhiteList(), m_dmrCallHang(3U), m_dmrTXHang(4U), m_fusionEnabled(false), +m_fusionLowDeviation(false), m_fusionRemoteGateway(false), m_p25Enabled(false), m_p25NAC(0x293U), @@ -428,6 +429,8 @@ bool CConf::read() } else if (section == SECTION_FUSION) { if (::strcmp(key, "Enable") == 0) m_fusionEnabled = ::atoi(value) == 1; + else if (::strcmp(key, "LowDeviation") == 0) + m_fusionLowDeviation = ::atoi(value) == 1; else if (::strcmp(key, "RemoteGateway") == 0) m_fusionRemoteGateway = ::atoi(value) == 1; } else if (section == SECTION_P25) { @@ -867,6 +870,11 @@ bool CConf::getFusionEnabled() const return m_fusionEnabled; } +bool CConf::getFusionLowDeviation() const +{ + return m_fusionLowDeviation; +} + bool CConf::getFusionRemoteGateway() const { return m_fusionRemoteGateway; diff --git a/Conf.h b/Conf.h index 57401e2..f3804e3 100644 --- a/Conf.h +++ b/Conf.h @@ -110,6 +110,7 @@ public: // The System Fusion section bool getFusionEnabled() const; + bool getFusionLowDeviation() const; bool getFusionRemoteGateway() const; // The P25 section @@ -258,6 +259,7 @@ private: unsigned int m_dmrTXHang; bool m_fusionEnabled; + bool m_fusionLowDeviation; bool m_fusionRemoteGateway; bool m_p25Enabled; diff --git a/MMDVM.ini b/MMDVM.ini index d7a24fb..08b2dec 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -80,6 +80,7 @@ TXHang=4 [System Fusion] Enable=1 +LowDeviation=0 RemoteGateway=0 [P25] diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index ce3e515..7f0c584 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -395,12 +395,14 @@ int CMMDVMHost::run() CYSFControl* ysf = NULL; if (m_ysfEnabled) { + bool lowDeviation = m_conf.getFusionLowDeviation(); bool remoteGateway = m_conf.getFusionRemoteGateway(); LogInfo("YSF Parameters"); + LogInfo(" Low Deviation: %s", lowDeviation ? "yes" : "no"); LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no"); - ysf = new CYSFControl(m_callsign, m_ysfNetwork, m_display, m_timeout, m_duplex, remoteGateway, rssi); + ysf = new CYSFControl(m_callsign, m_ysfNetwork, m_display, m_timeout, m_duplex, lowDeviation, remoteGateway, rssi); } CP25Control* p25 = NULL; @@ -800,6 +802,7 @@ bool CMMDVMHost::createModem() unsigned int p25TXLevel = m_conf.getModemP25TXLevel(); bool debug = m_conf.getModemDebug(); unsigned int colorCode = m_conf.getDMRColorCode(); + bool lowDeviation = m_conf.getFusionLowDeviation(); unsigned int rxFrequency = m_conf.getRxFrequency(); unsigned int txFrequency = m_conf.getTxFrequency(); std::string samplesDir = m_conf.getModemSamplesDir(); @@ -825,6 +828,7 @@ bool CMMDVMHost::createModem() m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel); m_modem->setRFParams(rxFrequency, txFrequency); m_modem->setDMRParams(colorCode); + m_modem->setYSFParams(lowDeviation); bool ret = m_modem->open(); if (!ret) { diff --git a/Modem.cpp b/Modem.cpp index 0c818a6..db38322 100644 --- a/Modem.cpp +++ b/Modem.cpp @@ -87,7 +87,8 @@ const unsigned int BUFFER_LENGTH = 2000U; CModem::CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, const std::string& samplesDir, bool debug) : m_port(port), -m_colorCode(0U), +m_dmrColorCode(0U), +m_ysfLoDev(false), m_duplex(duplex), m_rxInvert(rxInvert), m_txInvert(txInvert), @@ -174,7 +175,12 @@ void CModem::setDMRParams(unsigned int colorCode) { assert(colorCode < 16U); - m_colorCode = colorCode; + m_dmrColorCode = colorCode; +} + +void CModem::setYSFParams(bool loDev) +{ + m_ysfLoDev = loDev; } bool CModem::open() @@ -954,6 +960,8 @@ bool CModem::setConfig() buffer[3U] |= 0x02U; if (m_pttInvert) buffer[3U] |= 0x04U; + if (m_ysfLoDev) + buffer[3U] |= 0x08U; if (!m_duplex) buffer[3U] |= 0x80U; @@ -975,7 +983,7 @@ bool CModem::setConfig() buffer[8U] = (m_cwIdTXLevel * 255U) / 100U; - buffer[9U] = m_colorCode; + buffer[9U] = m_dmrColorCode; buffer[10U] = m_dmrDelay; diff --git a/Modem.h b/Modem.h index 1ab6b38..d38e1f7 100644 --- a/Modem.h +++ b/Modem.h @@ -41,6 +41,7 @@ public: void setModeParams(bool dstarEnabled, bool dmrEnabled, bool ysfEnabled, bool p25Enabled); void setLevels(unsigned int rxLevel, unsigned int cwIdTXLevel, unsigned int dstarTXLevel, unsigned int dmrTXLevel, unsigned int ysfTXLevel, unsigned int p25Enabled); void setDMRParams(unsigned int colorCode); + void setYSFParams(bool loDev); bool open(); @@ -88,7 +89,8 @@ public: private: std::string m_port; - unsigned int m_colorCode; + unsigned int m_dmrColorCode; + bool m_ysfLoDev; bool m_duplex; bool m_rxInvert; bool m_txInvert; diff --git a/YSFControl.cpp b/YSFControl.cpp index 44abb4f..5c999a3 100644 --- a/YSFControl.cpp +++ b/YSFControl.cpp @@ -24,11 +24,12 @@ // #define DUMP_YSF -CYSFControl::CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper) : +CYSFControl::CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool lowDeviation, bool remoteGateway, CRSSIInterpolator* rssiMapper) : m_callsign(NULL), m_network(network), m_display(display), m_duplex(duplex), +m_lowDeviation(lowDeviation), m_remoteGateway(remoteGateway), m_queue(5000U, "YSF Control"), m_rfState(RS_RF_LISTENING), @@ -217,6 +218,7 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len) if (m_duplex) { fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); + fich.setDev(m_lowDeviation); fich.encode(data + 2U); writeQueueRF(data); } @@ -242,6 +244,7 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len) if (m_duplex) { fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); + fich.setDev(m_lowDeviation); fich.encode(data + 2U); writeQueueRF(data); } @@ -351,6 +354,7 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len) if (m_duplex) { fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); + fich.setDev(m_lowDeviation); fich.encode(data + 2U); writeQueueRF(data); } @@ -523,6 +527,7 @@ void CYSFControl::writeNetwork() fich.setVoIP(true); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); + fich.setDev(m_lowDeviation); fich.encode(data + 35U); m_lastMode = dt; diff --git a/YSFControl.h b/YSFControl.h index bc98146..8d2abc1 100644 --- a/YSFControl.h +++ b/YSFControl.h @@ -34,7 +34,7 @@ class CYSFControl { public: - CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool remoteGateway, CRSSIInterpolator* rssiMapper); + CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool lowDeviation, bool remoteGateway, CRSSIInterpolator* rssiMapper); ~CYSFControl(); bool writeModem(unsigned char* data, unsigned int len); @@ -48,6 +48,7 @@ private: CYSFNetwork* m_network; CDisplay* m_display; bool m_duplex; + bool m_lowDeviation; bool m_remoteGateway; CRingBuffer m_queue; RPT_RF_STATE m_rfState; diff --git a/YSFFICH.cpp b/YSFFICH.cpp index 4ed9169..ae4fcce 100644 --- a/YSFFICH.cpp +++ b/YSFFICH.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2016 by Jonathan Naylor G4KLX + * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -199,6 +199,11 @@ unsigned char CYSFFICH::getMR() const return (m_fich[2U] >> 3) & 0x03U; } +bool CYSFFICH::getDev() const +{ + return (m_fich[2U] & 0x40U) == 0x40U; +} + void CYSFFICH::setMR(unsigned char mr) { m_fich[2U] &= 0xC7U; @@ -212,3 +217,11 @@ void CYSFFICH::setVoIP(bool on) else m_fich[2U] &= 0xFBU; } + +void CYSFFICH::setDev(bool on) +{ + if (on) + m_fich[2U] |= 0x40U; + else + m_fich[2U] &= 0xBFU; +} diff --git a/YSFFICH.h b/YSFFICH.h index 8b8d0bd..3837604 100644 --- a/YSFFICH.h +++ b/YSFFICH.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,9 +36,11 @@ public: unsigned char getFT() const; unsigned char getDT() const; unsigned char getMR() const; + bool getDev() const; void setMR(unsigned char mr); void setVoIP(bool set); + void setDev(bool set); private: unsigned char* m_fich;