Add YSF low deviation mode.

This commit is contained in:
Jonathan Naylor 2017-03-23 20:26:17 +00:00
parent ceb761f26e
commit 1a6f282782
10 changed files with 55 additions and 9 deletions

View File

@ -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;

2
Conf.h
View File

@ -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;

View File

@ -80,6 +80,7 @@ TXHang=4
[System Fusion]
Enable=1
LowDeviation=0
RemoteGateway=0
[P25]

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<unsigned char> m_queue;
RPT_RF_STATE m_rfState;

View File

@ -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;
}

View File

@ -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;