Add the noise squelch configuration items.

This commit is contained in:
Jonathan Naylor 2020-07-28 14:22:26 +01:00
parent 15c21de416
commit 0579b4387a
9 changed files with 101 additions and 40 deletions

View file

@ -208,6 +208,9 @@ m_fmKerchunkTime(0U),
m_fmHangTime(7U),
m_fmAccessMode(1U),
m_fmCOSInvert(false),
m_fmNoiseSquelch(false),
m_fmSquelchHighThreshold(30U),
m_fmSquelchLowThreshold(20U),
m_fmRFAudioBoost(1U),
m_fmMaxDevLevel(90.0F),
m_fmExtAudioBoost(1U),
@ -808,6 +811,14 @@ bool CConf::read()
m_fmAccessMode = ::atoi(value);
else if (::strcmp(key, "COSInvert") == 0)
m_fmCOSInvert = ::atoi(value) == 1;
else if (::strcmp(key, "NoiseSquelch") == 0)
m_fmNoiseSquelch = ::atoi(value) == 1;
else if (::strcmp(key, "SquelchThreshold") == 0)
m_fmSquelchHighThreshold = m_fmSquelchLowThreshold = (unsigned int)::atoi(value);
else if (::strcmp(key, "SquelchHighThreshold") == 0)
m_fmSquelchHighThreshold = (unsigned int)::atoi(value);
else if (::strcmp(key, "SquelchLowThreshold") == 0)
m_fmSquelchLowThreshold = (unsigned int)::atoi(value);
else if (::strcmp(key, "RFAudioBoost") == 0)
m_fmRFAudioBoost = (unsigned int)::atoi(value);
else if (::strcmp(key, "MaxDevLevel") == 0)
@ -1757,6 +1768,21 @@ bool CConf::getFMCOSInvert() const
return m_fmCOSInvert;
}
bool CConf::getFMNoiseSquelch() const
{
return m_fmNoiseSquelch;
}
unsigned int CConf::getFMSquelchHighThreshold() const
{
return m_fmSquelchHighThreshold;
}
unsigned int CConf::getFMSquelchLowThreshold() const
{
return m_fmSquelchLowThreshold;
}
unsigned int CConf::getFMRFAudioBoost() const
{
return m_fmRFAudioBoost;

6
Conf.h
View file

@ -211,6 +211,9 @@ public:
unsigned int getFMHangTime() const;
unsigned int getFMAccessMode() const;
bool getFMCOSInvert() const;
bool getFMNoiseSquelch() const;
unsigned int getFMSquelchHighThreshold() const;
unsigned int getFMSquelchLowThreshold() const;
unsigned int getFMRFAudioBoost() const;
float getFMMaxDevLevel() const;
unsigned int getFMExtAudioBoost() const;
@ -502,6 +505,9 @@ private:
unsigned int m_fmHangTime;
unsigned int m_fmAccessMode;
bool m_fmCOSInvert;
bool m_fmNoiseSquelch;
unsigned int m_fmSquelchHighThreshold;
unsigned int m_fmSquelchLowThreshold;
unsigned int m_fmRFAudioBoost;
float m_fmMaxDevLevel;
unsigned int m_fmExtAudioBoost;

View file

@ -174,6 +174,10 @@ KerchunkTime=0
HangTime=7
AccessMode=1
COSInvert=0
NoiseSquelch=0
SquelchThreshold=30
# SquelchHighThreshold=30
# SquelchLowThreshold=20
RFAudioBoost=1
MaxDevLevel=90
ExtAudioBoost=1

View file

@ -1356,35 +1356,38 @@ bool CMMDVMHost::createModem()
m_modem->setAX25Params(rxTwist, ax25TXDelay, ax25SlotTime, ax25PPersist);
if (m_fmEnabled) {
std::string callsign = m_conf.getFMCallsign();
unsigned int callsignSpeed = m_conf.getFMCallsignSpeed();
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();
bool callsignAtStart = m_conf.getFMCallsignAtStart();
bool callsignAtEnd = m_conf.getFMCallsignAtEnd();
bool callsignAtLatch = m_conf.getFMCallsignAtLatch();
std::string rfAck = m_conf.getFMRFAck();
unsigned int ackSpeed = m_conf.getFMAckSpeed();
unsigned int ackFrequency = m_conf.getFMAckFrequency();
unsigned int ackMinTime = m_conf.getFMAckMinTime();
unsigned int ackDelay = m_conf.getFMAckDelay();
float ackLevel = m_conf.getFMAckLevel();
unsigned int timeout = m_conf.getFMTimeout();
float timeoutLevel = m_conf.getFMTimeoutLevel();
float ctcssFrequency = m_conf.getFMCTCSSFrequency();
unsigned int ctcssHighThreshold = m_conf.getFMCTCSSHighThreshold();
unsigned int ctcssLowThreshold = m_conf.getFMCTCSSLowThreshold();
float ctcssLevel = m_conf.getFMCTCSSLevel();
unsigned int kerchunkTime = m_conf.getFMKerchunkTime();
unsigned int hangTime = m_conf.getFMHangTime();
unsigned int accessMode = m_conf.getFMAccessMode();
bool cosInvert = m_conf.getFMCOSInvert();
unsigned int rfAudioBoost = m_conf.getFMRFAudioBoost();
float maxDevLevel = m_conf.getFMMaxDevLevel();
unsigned int modeHangTime = m_conf.getFMModeHang();
std::string callsign = m_conf.getFMCallsign();
unsigned int callsignSpeed = m_conf.getFMCallsignSpeed();
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();
bool callsignAtStart = m_conf.getFMCallsignAtStart();
bool callsignAtEnd = m_conf.getFMCallsignAtEnd();
bool callsignAtLatch = m_conf.getFMCallsignAtLatch();
std::string rfAck = m_conf.getFMRFAck();
unsigned int ackSpeed = m_conf.getFMAckSpeed();
unsigned int ackFrequency = m_conf.getFMAckFrequency();
unsigned int ackMinTime = m_conf.getFMAckMinTime();
unsigned int ackDelay = m_conf.getFMAckDelay();
float ackLevel = m_conf.getFMAckLevel();
unsigned int timeout = m_conf.getFMTimeout();
float timeoutLevel = m_conf.getFMTimeoutLevel();
float ctcssFrequency = m_conf.getFMCTCSSFrequency();
unsigned int ctcssHighThreshold = m_conf.getFMCTCSSHighThreshold();
unsigned int ctcssLowThreshold = m_conf.getFMCTCSSLowThreshold();
float ctcssLevel = m_conf.getFMCTCSSLevel();
unsigned int kerchunkTime = m_conf.getFMKerchunkTime();
unsigned int hangTime = m_conf.getFMHangTime();
unsigned int accessMode = m_conf.getFMAccessMode();
bool cosInvert = m_conf.getFMCOSInvert();
bool noiseSquelch = m_conf.getFMNoiseSquelch();
unsigned int squelchHighThreshold = m_conf.getFMSquelchHighThreshold();
unsigned int squelchLowThreshold = m_conf.getFMSquelchLowThreshold();
unsigned int rfAudioBoost = m_conf.getFMRFAudioBoost();
float maxDevLevel = m_conf.getFMMaxDevLevel();
unsigned int modeHangTime = m_conf.getFMModeHang();
LogInfo("FM Parameters");
LogInfo(" Callsign: %s", callsign.c_str());
@ -1413,13 +1416,20 @@ bool CMMDVMHost::createModem()
LogInfo(" Hang Time: %us", hangTime);
LogInfo(" Access Mode: %u", accessMode);
LogInfo(" COS Invert: %s", cosInvert ? "yes" : "no");
LogInfo(" Noise Squelch: %s", noiseSquelch ? "yes" : "no");
if (noiseSquelch) {
LogInfo(" Squelch High Threshold: %u", squelchHighThreshold);
LogInfo(" Squelch Low Threshold: %u", squelchLowThreshold);
}
LogInfo(" RF Audio Boost: x%u", rfAudioBoost);
LogInfo(" Max. Deviation Level: %.1f%%", maxDevLevel);
LogInfo(" Mode Hang: %us", modeHangTime);
m_modem->setFMCallsignParams(callsign, callsignSpeed, callsignFrequency, callsignTime, callsignHoldoff, callsignHighLevel, callsignLowLevel, callsignAtStart, callsignAtEnd, callsignAtLatch);
m_modem->setFMAckParams(rfAck, ackSpeed, ackFrequency, ackMinTime, ackDelay, ackLevel);
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, accessMode, cosInvert, rfAudioBoost, maxDevLevel);
m_modem->setFMMiscParams(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, accessMode, cosInvert, noiseSquelch, squelchHighThreshold, squelchLowThreshold, rfAudioBoost, maxDevLevel);
if (m_conf.getFMNetworkEnabled()) {
std::string extAck = m_conf.getFMExtAck();

View file

@ -40,7 +40,7 @@ public:
virtual void 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 callsignAtLatch) = 0;
virtual void setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackMinTime, unsigned int ackDelay, float ackLevel) = 0;
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, unsigned int rfAudioBoost, float maxDevLevel) = 0;
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, bool noiseSquelch, unsigned int squelchHighThreshold, unsigned int squelchLowThreshold, unsigned int rfAudioBoost, float maxDevLevel) = 0;
virtual void setFMExtParams(const std::string& ack, unsigned int audioBoost) = 0;
virtual bool open() = 0;

View file

@ -42,7 +42,7 @@ public:
virtual void 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 callsignAtLatch) {};
virtual void setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackMinTime, unsigned int ackDelay, float ackLevel) {};
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, unsigned int rfAudioBoost, float maxDevLevel) {};
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, bool noiseSquelch, unsigned int squelchHighThreshold, unsigned int squelchLowThreshold, unsigned int rfAudioBoost, float maxDevLevel) {};
virtual void setFMExtParams(const std::string& ack, unsigned int audioBoost) {};
virtual bool open();

View file

@ -224,6 +224,9 @@ m_fmKerchunkTime(0U),
m_fmHangTime(5U),
m_fmAccessMode(1U),
m_fmCOSInvert(false),
m_fmNoiseSquelch(false),
m_fmSquelchHighThreshold(30U),
m_fmSquelchLowThreshold(20U),
m_fmRFAudioBoost(1U),
m_fmExtAudioBoost(1U),
m_fmMaxDevLevel(90.0F),
@ -2186,7 +2189,7 @@ void CSerialModem::setFMAckParams(const std::string& rfAck, unsigned int ackSpee
m_fmAckLevel = ackLevel;
}
void CSerialModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, unsigned int rfAudioBoost, float maxDevLevel)
void CSerialModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, bool noiseSquelch, unsigned int squelchHighThreshold, unsigned int squelchLowThreshold, unsigned int rfAudioBoost, float maxDevLevel)
{
m_fmTimeout = timeout;
m_fmTimeoutLevel = timeoutLevel;
@ -2203,6 +2206,10 @@ void CSerialModem::setFMMiscParams(unsigned int timeout, float timeoutLevel, flo
m_fmAccessMode = accessMode;
m_fmCOSInvert = cosInvert;
m_fmNoiseSquelch = noiseSquelch;
m_fmSquelchHighThreshold = squelchHighThreshold;
m_fmSquelchLowThreshold = squelchLowThreshold;
m_fmRFAudioBoost = rfAudioBoost;
m_fmMaxDevLevel = maxDevLevel;
}
@ -2334,7 +2341,7 @@ bool CSerialModem::setFMMiscParams()
unsigned char buffer[20U];
buffer[0U] = MMDVM_FRAME_START;
buffer[1U] = 15U;
buffer[1U] = 17U;
buffer[2U] = MMDVM_FM_PARAMS3;
buffer[3U] = m_fmTimeout / 5U;
@ -2348,7 +2355,9 @@ bool CSerialModem::setFMMiscParams()
buffer[9U] = m_fmKerchunkTime;
buffer[10U] = m_fmHangTime;
buffer[11U] = m_fmAccessMode;
buffer[11U] = m_fmAccessMode & 0x0FU;
if (m_fmNoiseSquelch)
buffer[11U] |= 0x40U;
if (m_fmCOSInvert)
buffer[11U] |= 0x80U;
@ -2358,10 +2367,13 @@ bool CSerialModem::setFMMiscParams()
buffer[14U] = (unsigned char)(m_rxLevel * 2.55F + 0.5F);
// CUtils::dump(1U, "Written", buffer, 15U);
buffer[15U] = m_fmSquelchHighThreshold;
buffer[16U] = m_fmSquelchLowThreshold;
int ret = m_serial->write(buffer, 15U);
if (ret != 15)
// CUtils::dump(1U, "Written", buffer, 17U);
int ret = m_serial->write(buffer, 17U);
if (ret != 17)
return false;
unsigned int count = 0U;

View file

@ -60,7 +60,7 @@ public:
virtual void 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 callsignAtLatch);
virtual void setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, unsigned int ackFrequency, unsigned int ackMinTime, unsigned int ackDelay, float ackLevel);
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, unsigned int rfAudioBoost, float maxDevLevel);
virtual void setFMMiscParams(unsigned int timeout, float timeoutLevel, float ctcssFrequency, unsigned int ctcssHighThreshold, unsigned int ctcssLowThreshold, float ctcssLevel, unsigned int kerchunkTime, unsigned int hangTime, unsigned int accessMode, bool cosInvert, bool noiseSquelch, unsigned int squelchHighThreshold, unsigned int squelchLowThreshold, unsigned int rfAudioBoost, float maxDevLevel);
virtual void setFMExtParams(const std::string& ack, unsigned int audioBoost);
virtual bool open();
@ -247,6 +247,9 @@ private:
unsigned int m_fmHangTime;
unsigned int m_fmAccessMode;
bool m_fmCOSInvert;
bool m_fmNoiseSquelch;
unsigned int m_fmSquelchHighThreshold;
unsigned int m_fmSquelchLowThreshold;
unsigned int m_fmRFAudioBoost;
unsigned int m_fmExtAudioBoost;
float m_fmMaxDevLevel;

View file

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