Skip to content

Commit

Permalink
Add the YSF TX hang parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed May 21, 2018
1 parent a65fba4 commit 31beeee
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 14 deletions.
8 changes: 8 additions & 0 deletions Conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions MMDVM.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ TXHang=4
Enable=1
LowDeviation=0
SelfOnly=0
TXHang=4
#DGID=1
RemoteGateway=0
# ModeHang=10
Expand Down
17 changes: 10 additions & 7 deletions MMDVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down
16 changes: 10 additions & 6 deletions Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -1125,7 +1127,7 @@ bool CModem::setConfig()

buffer[0U] = MMDVM_FRAME_START;

buffer[1U] = 19U;
buffer[1U] = 20U;

buffer[2U] = MMDVM_SET_CONFIG;

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion Modem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 31beeee

Please sign in to comment.