Simplify the FM configuration.

This commit is contained in:
Jonathan Naylor 2020-04-18 13:43:36 +01:00
parent f8bce3823a
commit 11cd5679a7
7 changed files with 29 additions and 47 deletions

View file

@ -179,8 +179,7 @@ m_fmCallsignSpeed(20U),
m_fmCallsignFrequency(1000U),
m_fmCallsignTime(10U),
m_fmCallsignHoldoff(1U),
m_fmCallsignHighLevel(80.0F),
m_fmCallsignLowLevel(40.0F),
m_fmCallsignLevel(40.0F),
m_fmCallsignAtStart(true),
m_fmCallsignAtEnd(true),
m_fmRFAck("K"),
@ -707,10 +706,8 @@ bool CConf::read()
m_fmCallsignTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "CallsignHoldoff") == 0)
m_fmCallsignHoldoff = (unsigned int)::atoi(value);
else if (::strcmp(key, "CallsignHighLevel") == 0)
m_fmCallsignHighLevel = float(::atof(value));
else if (::strcmp(key, "CallsignLowLevel") == 0)
m_fmCallsignLowLevel = float(::atof(value));
else if (::strcmp(key, "CallsignLevel") == 0)
m_fmCallsignLevel = float(::atof(value));
else if (::strcmp(key, "CallsignAtStart") == 0)
m_fmCallsignAtStart = ::atoi(value) == 1;
else if (::strcmp(key, "CallsignAtEnd") == 0)
@ -1521,14 +1518,9 @@ unsigned int CConf::getFMCallsignHoldoff() const
return m_fmCallsignHoldoff;
}
float CConf::getFMCallsignHighLevel() const
float CConf::getFMCallsignLevel() const
{
return m_fmCallsignHighLevel;
}
float CConf::getFMCallsignLowLevel() const
{
return m_fmCallsignLowLevel;
return m_fmCallsignLevel;
}
bool CConf::getFMCallsignAtStart() const

6
Conf.h
View file

@ -177,8 +177,7 @@ public:
unsigned int getFMCallsignFrequency() const;
unsigned int getFMCallsignTime() const;
unsigned int getFMCallsignHoldoff() const;
float getFMCallsignHighLevel() const;
float getFMCallsignLowLevel() const;
float getFMCallsignLevel() const;
bool getFMCallsignAtStart() const;
bool getFMCallsignAtEnd() const;
std::string getFMRFAck() const;
@ -439,8 +438,7 @@ private:
unsigned int m_fmCallsignFrequency;
unsigned int m_fmCallsignTime;
unsigned int m_fmCallsignHoldoff;
float m_fmCallsignHighLevel;
float m_fmCallsignLowLevel;
float m_fmCallsignLevel;
bool m_fmCallsignAtStart;
bool m_fmCallsignAtEnd;
std::string m_fmRFAck;

View file

@ -147,12 +147,11 @@ CallsignSpeed=20
CallsignFrequency=1000
CallsignTime=10
CallsignHoldoff=1
CallsignHighLevel=80
CallsignLowLevel=40
CallsignLevel=40
CallsignAtStart=1
CallsignAtEnd=1
RFAck=K
NetAck=N
# NetAck=N
AckSpeed=20
AckFrequency=1750
AckMinTime=4

View file

@ -612,8 +612,7 @@ int CMMDVMHost::run()
unsigned int callsignFrequency = m_conf.getFMCallsignFrequency();
unsigned int callsignTime = m_conf.getFMCallsignTime();
unsigned int callsignHoldoff = m_conf.getFMCallsignHoldoff();
float callsignHighLevel = m_conf.getFMCallsignHighLevel();
float callsignLowLevel = m_conf.getFMCallsignLowLevel();
float callsignLevel = m_conf.getFMCallsignLevel();
bool callsignAtStart = m_conf.getFMCallsignAtStart();
bool callsignAtEnd = m_conf.getFMCallsignAtEnd();
std::string rfAck = m_conf.getFMRFAck();
@ -637,12 +636,11 @@ int CMMDVMHost::run()
LogInfo(" Callsign Frequency: %uHz", callsignFrequency);
LogInfo(" Callsign Time: %umins", callsignTime);
LogInfo(" Callsign Holdoff: 1/%u", callsignHoldoff);
LogInfo(" Callsign High Level: %.1f%%", callsignHighLevel);
LogInfo(" Callsign Low Level: %.1f%%", callsignLowLevel);
LogInfo(" Callsign Level: %.1f%%", callsignLevel);
LogInfo(" Callsign At Start: %s", callsignAtStart ? "yes" : "no");
LogInfo(" Callsign At End: %s", callsignAtEnd ? "yes" : "no");
LogInfo(" RF Ack: %s", rfAck.c_str());
LogInfo(" Net Ack: %s", netAck.c_str());
// LogInfo(" Net Ack: %s", netAck.c_str());
LogInfo(" Ack Speed: %uWPM", ackSpeed);
LogInfo(" Ack Frequency: %uHz", ackFrequency);
LogInfo(" Ack Min Time: %us", ackMinTime);
@ -656,9 +654,9 @@ int CMMDVMHost::run()
LogInfo(" Kerchunk Time: %us", kerchunkTime);
LogInfo(" Hang Time: %us", hangTime);
m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignHighLevel, callsignLowLevel, callsignAtStart, callsignAtEnd);
m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignLevel, callsignAtStart, callsignAtEnd);
m_modem->setFMAckParams(rfAck, ackSpeed, ackFrequency, ackMinTime, ackDelay, ackLevel);
m_modem->setFMMiscParams(netAck, timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime);
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime);
}
bool remoteControlEnabled = m_conf.getRemoteControlEnabled();

View file

@ -1834,12 +1834,12 @@ bool CModem::writeDMRShortLC(const unsigned char* lc)
return m_serial->write(buffer, 12U) == 12;
}
bool 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 CModem::setFMCallsignParams(const std::string& callsign, unsigned int callsignSpeed, unsigned int callsignFrequency, unsigned int callsignTime, unsigned int callsignHoldoff, float callsignLevel, bool callsignAtStart, bool callsignAtEnd)
{
assert(m_serial != NULL);
unsigned char buffer[80U];
unsigned char len = 10U + callsign.size();
unsigned char len = 9U + callsign.size();
buffer[0U] = MMDVM_FRAME_START;
buffer[1U] = len;
@ -1850,17 +1850,16 @@ bool CModem::setFMCallsignParams(const std::string& callsign, unsigned int calls
buffer[5U] = callsignTime;
buffer[6U] = callsignHoldoff;
buffer[7U] = (unsigned char)(callsignHighLevel * 2.55F + 0.5F);
buffer[8U] = (unsigned char)(callsignLowLevel * 2.55F + 0.5F);
buffer[7U] = (unsigned char)(callsignLevel * 2.55F + 0.5F);
buffer[9U] = 0x00U;
buffer[8U] = 0x00U;
if (callsignAtStart)
buffer[9U] |= 0x01U;
buffer[8U] |= 0x01U;
if (callsignAtEnd)
buffer[9U] |= 0x02U;
buffer[8U] |= 0x02U;
for (unsigned int i = 0U; i < callsign.size(); i++)
buffer[10U + i] = callsign.at(i);
buffer[9U + i] = callsign.at(i);
// CUtils::dump(1U, "Written", buffer, len);
@ -1945,15 +1944,14 @@ bool CModem::setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, uns
return true;
}
bool CModem::setFMMiscParams(const std::string& netAck, unsigned int timeout, float timeoutLevel, float ctcssFrequency, float ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime)
bool CModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, float ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime)
{
assert(m_serial != NULL);
unsigned char buffer[20U];
unsigned char len = 10U + netAck.size();
buffer[0U] = MMDVM_FRAME_START;
buffer[1U] = len;
buffer[1U] = 10U;
buffer[2U] = MMDVM_FM_PARAMS3;
buffer[3U] = timeout / 5U;
@ -1966,13 +1964,10 @@ bool CModem::setFMMiscParams(const std::string& netAck, unsigned int timeout, fl
buffer[8U] = kerchunkTime;
buffer[9U] = hangTime;
for (unsigned int i = 0U; i < netAck.size(); i++)
buffer[10U + i] = netAck.at(i);
// CUtils::dump(1U, "Written", buffer, 10U);
// CUtils::dump(1U, "Written", buffer, len);
int ret = m_serial->write(buffer, len);
if (ret != len)
int ret = m_serial->write(buffer, 10U);
if (ret != 10)
return false;
unsigned int count = 0U;

View file

@ -45,9 +45,9 @@ public:
virtual void setYSFParams(bool loDev, unsigned int txHang);
virtual void setTransparentDataParams(unsigned int sendFrameType);
virtual bool 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 bool setFMCallsignParams(const std::string& callsign, unsigned int callsignSpeed, unsigned int callsignFrequency, unsigned int callsignTime, unsigned int callsignHoldoff, float callsignLevel, bool callsignAtStart, bool callsignAtEnd);
virtual bool setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int minTime, unsigned int ackDelay, float ackLevel);
virtual bool setFMMiscParams(const std::string& netAck, unsigned int timeout, float timeoutLevel, float ctcssFrequency, float ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime);
virtual bool setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, float ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime);
virtual bool open();

View file

@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200415";
const char* VERSION = "20200418";
#endif