Convert to percentages.

This commit is contained in:
Jonathan Naylor
2020-04-12 16:01:28 +01:00
parent 927f31cdfa
commit 211e96a86d
6 changed files with 58 additions and 56 deletions

View File

@@ -179,19 +179,19 @@ m_fmCallsignSpeed(20U),
m_fmCallsignFrequency(1000U),
m_fmCallsignTime(10U),
m_fmCallsignHoldoff(1U),
m_fmCallsignHighLevel(80U),
m_fmCallsignLowLevel(40U),
m_fmCallsignHighLevel(80.0F),
m_fmCallsignLowLevel(40.0F),
m_fmCallsignAtStart(true),
m_fmCallsignAtEnd(true),
m_fmAck("K"),
m_fmAckSpeed(20U),
m_fmAckFrequency(1750U),
m_fmAckDelay(1000U),
m_fmAckLevel(80U),
m_fmTimeoutLevel(80U),
m_fmAckLevel(80.0F),
m_fmTimeoutLevel(80.0F),
m_fmCTCSSFrequency(88.6F),
m_fmCTCSSThreshold(100U),
m_fmCTCSSLevel(5U),
m_fmCTCSSThreshold(10.0F),
m_fmCTCSSLevel(5.0F),
m_fmKerchunkTime(0U),
m_fmHangTime(7U),
m_dstarNetworkEnabled(false),
@@ -705,9 +705,9 @@ bool CConf::read()
else if (::strcmp(key, "CallsignHoldoff") == 0)
m_fmCallsignHoldoff = (unsigned int)::atoi(value);
else if (::strcmp(key, "CallsignHighLevel") == 0)
m_fmCallsignHighLevel = (unsigned int)::atoi(value);
m_fmCallsignHighLevel = float(::atof(value));
else if (::strcmp(key, "CallsignLowLevel") == 0)
m_fmCallsignLowLevel = (unsigned int)::atoi(value);
m_fmCallsignLowLevel = float(::atof(value));
else if (::strcmp(key, "CallsignAtStart") == 0)
m_fmCallsignAtStart = ::atoi(value) == 1;
else if (::strcmp(key, "CallsignAtEnd") == 0)
@@ -724,15 +724,15 @@ bool CConf::read()
else if (::strcmp(key, "AckDelay") == 0)
m_fmAckDelay = (unsigned int)::atoi(value);
else if (::strcmp(key, "AckLevel") == 0)
m_fmAckLevel = (unsigned int)::atoi(value);
m_fmAckLevel = float(::atof(value));
else if (::strcmp(key, "TimeoutLevel") == 0)
m_fmTimeoutLevel = (unsigned int)::atoi(value);
m_fmTimeoutLevel = float(::atof(value));
else if (::strcmp(key, "CTCSSFrequency") == 0)
m_fmCTCSSFrequency = float(::atof(value));
else if (::strcmp(key, "CTCSSThreshold") == 0)
m_fmCTCSSThreshold = (unsigned int)::atoi(value);
m_fmCTCSSThreshold = float(::atoi(value));
else if (::strcmp(key, "CTCSSLevel") == 0)
m_fmCTCSSLevel = (unsigned int)::atoi(value);
m_fmCTCSSLevel = float(::atof(value));
else if (::strcmp(key, "KerchunkTime") == 0)
m_fmKerchunkTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "HangTime") == 0)
@@ -1509,12 +1509,12 @@ unsigned int CConf::getFMCallsignHoldoff() const
return m_fmCallsignHoldoff;
}
unsigned int CConf::getFMCallsignHighLevel() const
float CConf::getFMCallsignHighLevel() const
{
return m_fmCallsignHighLevel;
}
unsigned int CConf::getFMCallsignLowLevel() const
float CConf::getFMCallsignLowLevel() const
{
return m_fmCallsignLowLevel;
}
@@ -1549,12 +1549,12 @@ unsigned int CConf::getFMAckDelay() const
return m_fmAckDelay;
}
unsigned int CConf::getFMAckLevel() const
float CConf::getFMAckLevel() const
{
return m_fmAckLevel;
}
unsigned int CConf::getFMTimeoutLevel() const
float CConf::getFMTimeoutLevel() const
{
return m_fmTimeoutLevel;
}
@@ -1564,12 +1564,12 @@ float CConf::getFMCTCSSFrequency() const
return m_fmCTCSSFrequency;
}
unsigned int CConf::getFMCTCSSThreshold() const
float CConf::getFMCTCSSThreshold() const
{
return m_fmCTCSSThreshold;
}
unsigned int CConf::getFMCTCSSLevel() const
float CConf::getFMCTCSSLevel() const
{
return m_fmCTCSSLevel;
}

24
Conf.h
View File

@@ -177,19 +177,19 @@ public:
unsigned int getFMCallsignFrequency() const;
unsigned int getFMCallsignTime() const;
unsigned int getFMCallsignHoldoff() const;
unsigned int getFMCallsignHighLevel() const;
unsigned int getFMCallsignLowLevel() const;
float getFMCallsignHighLevel() const;
float getFMCallsignLowLevel() const;
bool getFMCallsignAtStart() const;
bool getFMCallsignAtEnd() const;
std::string getFMAck() const;
unsigned int getFMAckSpeed() const;
unsigned int getFMAckFrequency() const;
unsigned int getFMAckDelay() const;
unsigned int getFMAckLevel() const;
unsigned int getFMTimeoutLevel() const;
float getFMAckLevel() const;
float getFMTimeoutLevel() const;
float getFMCTCSSFrequency() const;
unsigned int getFMCTCSSThreshold() const;
unsigned int getFMCTCSSLevel() const;
float getFMCTCSSThreshold() const;
float getFMCTCSSLevel() const;
unsigned int getFMKerchunkTime() const;
unsigned int getFMHangTime() const;
@@ -436,19 +436,19 @@ private:
unsigned int m_fmCallsignFrequency;
unsigned int m_fmCallsignTime;
unsigned int m_fmCallsignHoldoff;
unsigned int m_fmCallsignHighLevel;
unsigned int m_fmCallsignLowLevel;
float m_fmCallsignHighLevel;
float m_fmCallsignLowLevel;
bool m_fmCallsignAtStart;
bool m_fmCallsignAtEnd;
std::string m_fmAck;
unsigned int m_fmAckSpeed;
unsigned int m_fmAckFrequency;
unsigned int m_fmAckDelay;
unsigned int m_fmAckLevel;
unsigned int m_fmTimeoutLevel;
float m_fmAckLevel;
float m_fmTimeoutLevel;
float m_fmCTCSSFrequency;
unsigned int m_fmCTCSSThreshold;
unsigned int m_fmCTCSSLevel;
float m_fmCTCSSThreshold;
float m_fmCTCSSLevel;
unsigned int m_fmKerchunkTime;
unsigned int m_fmHangTime;

View File

@@ -157,8 +157,8 @@ AckFrequency=1750
AckDelay=1000
AckLevel=80
TimeoutLevel=80
CTCSSFrequency=88.4
CTCSSThreshold=100
CTCSSFrequency=88.8
CTCSSThreshold=10
CTCSSLevel=5
KerchunkTime=0
HangTime=7

View File

@@ -612,20 +612,20 @@ int CMMDVMHost::run()
unsigned int callsignFrequency = m_conf.getFMCallsignFrequency();
unsigned int callsignTime = m_conf.getFMCallsignTime();
unsigned int callsignHoldoff = m_conf.getFMCallsignHoldoff();
unsigned int callsignHighLevel = m_conf.getFMCallsignHighLevel();
unsigned int callsignLowLevel = m_conf.getFMCallsignLowLevel();
float callsignHighLevel = m_conf.getFMCallsignHighLevel();
float callsignLowLevel = m_conf.getFMCallsignLowLevel();
bool callsignAtStart = m_conf.getFMCallsignAtStart();
bool callsignAtEnd = m_conf.getFMCallsignAtEnd();
std::string ack = m_conf.getFMCallsign();
unsigned int ackSpeed = m_conf.getFMAckSpeed();
unsigned int ackFrequency = m_conf.getFMAckFrequency();
unsigned int ackDelay = m_conf.getFMAckDelay();
unsigned int ackLevel = m_conf.getFMAckLevel();
float ackLevel = m_conf.getFMAckLevel();
unsigned int timeout = m_conf.getTimeout();
unsigned int timeoutLevel = m_conf.getFMTimeoutLevel();
float timeoutLevel = m_conf.getFMTimeoutLevel();
float ctcssFrequency = m_conf.getFMCTCSSFrequency();
unsigned int ctcssThreshold = m_conf.getFMCTCSSThreshold();
unsigned int ctcssLevel = m_conf.getFMCTCSSLevel();
float ctcssThreshold = m_conf.getFMCTCSSThreshold();
float ctcssLevel = m_conf.getFMCTCSSLevel();
unsigned int kerchunkTime = m_conf.getFMKerchunkTime();
unsigned int hangTime = m_conf.getFMHangTime();
@@ -635,20 +635,20 @@ int CMMDVMHost::run()
LogInfo(" Callsign Frequency: %uHz", callsignFrequency);
LogInfo(" Callsign Time: %umins", callsignTime);
LogInfo(" Callsign Holdoff: 1/%u", callsignHoldoff);
LogInfo(" Callsign High Level: %u%%", callsignHighLevel);
LogInfo(" Callsign Low Level: %u%%", callsignLowLevel);
LogInfo(" Callsign High Level: %.1f%%", callsignHighLevel);
LogInfo(" Callsign Low Level: %.1f%%", callsignLowLevel);
LogInfo(" Callsign At Start: %s", callsignAtStart ? "yes" : "no");
LogInfo(" Callsign At End: %s", callsignAtEnd ? "yes" : "no");
LogInfo(" Ack: %s", ack.c_str());
LogInfo(" Ack Speed: %uWPM", ackSpeed);
LogInfo(" Ack Frequency: %uHz", ackFrequency);
LogInfo(" Ack Delay: %ums", ackDelay);
LogInfo(" Ack Level: %u%%", ackLevel);
LogInfo(" Ack Level: %.1f%%", ackLevel);
LogInfo(" Timeout: %us", timeout);
LogInfo(" Timeout Level: %u%%", timeoutLevel);
LogInfo(" Timeout Level: %.1f%%", timeoutLevel);
LogInfo(" CTCSS Frequency: %.1fHz", ctcssFrequency);
LogInfo(" CTCSS Threshold: %u%%", ctcssThreshold);
LogInfo(" CTCSS Level: %u%%", ctcssLevel);
LogInfo(" CTCSS Threshold: %.1f%%", ctcssThreshold);
LogInfo(" CTCSS Level: %.1f%%", ctcssLevel);
LogInfo(" Kerchunk Time: %us", kerchunkTime);
LogInfo(" Hang Time: %us", hangTime);

View File

@@ -1834,7 +1834,7 @@ 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, unsigned int callsignHighLevel, unsigned int 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 callsignHighLevel, float callsignLowLevel, bool callsignAtStart, bool callsignAtEnd)
{
assert(m_serial != NULL);
@@ -1849,8 +1849,9 @@ bool CModem::setFMCallsignParams(const std::string& callsign, unsigned int calls
buffer[4U] = callsignFrequency / 10U;
buffer[5U] = callsignTime;
buffer[6U] = callsignHoldoff;
buffer[7U] = callsignHighLevel;
buffer[8U] = callsignLowLevel;
buffer[7U] = (unsigned char)(callsignHighLevel * 2.55F + 0.5F);
buffer[8U] = (unsigned char)(callsignLowLevel * 2.55F + 0.5F);
buffer[9U] = 0x00U;
if (callsignAtStart)
@@ -1892,7 +1893,7 @@ bool CModem::setFMCallsignParams(const std::string& callsign, unsigned int calls
return true;
}
bool CModem::setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackDelay, unsigned int ackLevel)
bool CModem::setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackDelay, float ackLevel)
{
assert(m_serial != NULL);
@@ -1906,7 +1907,8 @@ bool CModem::setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsig
buffer[3U] = ackSpeed;
buffer[4U] = ackFrequency / 10U;
buffer[5U] = ackDelay / 10U;
buffer[6U] = ackLevel;
buffer[6U] = (unsigned char)(ackLevel * 2.55F + 0.5F);
for (unsigned int i = 0U; i < ack.size(); i++)
buffer[7U + i] = ack.at(i);
@@ -1942,7 +1944,7 @@ bool CModem::setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsig
return true;
}
bool CModem::setFMMiscParams(unsigned int timeout, unsigned int timeoutLevel, float ctcssFrequency, unsigned int ctcssThreshold, unsigned int 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);
@@ -1953,11 +1955,11 @@ bool CModem::setFMMiscParams(unsigned int timeout, unsigned int timeoutLevel, fl
buffer[2U] = MMDVM_FM_PARAMS3;
buffer[3U] = timeout / 5U;
buffer[4U] = timeoutLevel;
buffer[4U] = (unsigned char)(timeoutLevel * 2.55F + 0.5F);
buffer[5U] = (unsigned char)ctcssFrequency;
buffer[6U] = ctcssThreshold;
buffer[7U] = ctcssLevel;
buffer[6U] = (unsigned char)(ctcssThreshold * 2.55F + 0.5F);
buffer[7U] = (unsigned char)(ctcssLevel * 2.55F + 0.5F);
buffer[8U] = kerchunkTime;
buffer[9U] = hangTime;

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, unsigned int callsignHighLevel, unsigned int callsignLowLevel, bool callsignAtStart, bool callsignAtEnd);
virtual bool setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackDelay, unsigned int ackLevel);
virtual bool setFMMiscParams(unsigned int timeout, unsigned int timeoutLevel, float ctcssFrequency, unsigned int ctcssThreshold, unsigned int ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime);
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 setFMAckParams(const std::string& ack, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackDelay, float ackLevel);
virtual bool setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, float ctcssThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime);
virtual bool open();