mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 15:09:23 +08:00
Simplify the FM configuration.
This commit is contained in:
18
Conf.cpp
18
Conf.cpp
@@ -179,8 +179,7 @@ m_fmCallsignSpeed(20U),
|
|||||||
m_fmCallsignFrequency(1000U),
|
m_fmCallsignFrequency(1000U),
|
||||||
m_fmCallsignTime(10U),
|
m_fmCallsignTime(10U),
|
||||||
m_fmCallsignHoldoff(1U),
|
m_fmCallsignHoldoff(1U),
|
||||||
m_fmCallsignHighLevel(80.0F),
|
m_fmCallsignLevel(40.0F),
|
||||||
m_fmCallsignLowLevel(40.0F),
|
|
||||||
m_fmCallsignAtStart(true),
|
m_fmCallsignAtStart(true),
|
||||||
m_fmCallsignAtEnd(true),
|
m_fmCallsignAtEnd(true),
|
||||||
m_fmRFAck("K"),
|
m_fmRFAck("K"),
|
||||||
@@ -707,10 +706,8 @@ bool CConf::read()
|
|||||||
m_fmCallsignTime = (unsigned int)::atoi(value);
|
m_fmCallsignTime = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "CallsignHoldoff") == 0)
|
else if (::strcmp(key, "CallsignHoldoff") == 0)
|
||||||
m_fmCallsignHoldoff = (unsigned int)::atoi(value);
|
m_fmCallsignHoldoff = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "CallsignHighLevel") == 0)
|
else if (::strcmp(key, "CallsignLevel") == 0)
|
||||||
m_fmCallsignHighLevel = float(::atof(value));
|
m_fmCallsignLevel = float(::atof(value));
|
||||||
else if (::strcmp(key, "CallsignLowLevel") == 0)
|
|
||||||
m_fmCallsignLowLevel = float(::atof(value));
|
|
||||||
else if (::strcmp(key, "CallsignAtStart") == 0)
|
else if (::strcmp(key, "CallsignAtStart") == 0)
|
||||||
m_fmCallsignAtStart = ::atoi(value) == 1;
|
m_fmCallsignAtStart = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "CallsignAtEnd") == 0)
|
else if (::strcmp(key, "CallsignAtEnd") == 0)
|
||||||
@@ -1521,14 +1518,9 @@ unsigned int CConf::getFMCallsignHoldoff() const
|
|||||||
return m_fmCallsignHoldoff;
|
return m_fmCallsignHoldoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CConf::getFMCallsignHighLevel() const
|
float CConf::getFMCallsignLevel() const
|
||||||
{
|
{
|
||||||
return m_fmCallsignHighLevel;
|
return m_fmCallsignLevel;
|
||||||
}
|
|
||||||
|
|
||||||
float CConf::getFMCallsignLowLevel() const
|
|
||||||
{
|
|
||||||
return m_fmCallsignLowLevel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getFMCallsignAtStart() const
|
bool CConf::getFMCallsignAtStart() const
|
||||||
|
|||||||
6
Conf.h
6
Conf.h
@@ -177,8 +177,7 @@ public:
|
|||||||
unsigned int getFMCallsignFrequency() const;
|
unsigned int getFMCallsignFrequency() const;
|
||||||
unsigned int getFMCallsignTime() const;
|
unsigned int getFMCallsignTime() const;
|
||||||
unsigned int getFMCallsignHoldoff() const;
|
unsigned int getFMCallsignHoldoff() const;
|
||||||
float getFMCallsignHighLevel() const;
|
float getFMCallsignLevel() const;
|
||||||
float getFMCallsignLowLevel() const;
|
|
||||||
bool getFMCallsignAtStart() const;
|
bool getFMCallsignAtStart() const;
|
||||||
bool getFMCallsignAtEnd() const;
|
bool getFMCallsignAtEnd() const;
|
||||||
std::string getFMRFAck() const;
|
std::string getFMRFAck() const;
|
||||||
@@ -439,8 +438,7 @@ private:
|
|||||||
unsigned int m_fmCallsignFrequency;
|
unsigned int m_fmCallsignFrequency;
|
||||||
unsigned int m_fmCallsignTime;
|
unsigned int m_fmCallsignTime;
|
||||||
unsigned int m_fmCallsignHoldoff;
|
unsigned int m_fmCallsignHoldoff;
|
||||||
float m_fmCallsignHighLevel;
|
float m_fmCallsignLevel;
|
||||||
float m_fmCallsignLowLevel;
|
|
||||||
bool m_fmCallsignAtStart;
|
bool m_fmCallsignAtStart;
|
||||||
bool m_fmCallsignAtEnd;
|
bool m_fmCallsignAtEnd;
|
||||||
std::string m_fmRFAck;
|
std::string m_fmRFAck;
|
||||||
|
|||||||
@@ -147,12 +147,11 @@ CallsignSpeed=20
|
|||||||
CallsignFrequency=1000
|
CallsignFrequency=1000
|
||||||
CallsignTime=10
|
CallsignTime=10
|
||||||
CallsignHoldoff=1
|
CallsignHoldoff=1
|
||||||
CallsignHighLevel=80
|
CallsignLevel=40
|
||||||
CallsignLowLevel=40
|
|
||||||
CallsignAtStart=1
|
CallsignAtStart=1
|
||||||
CallsignAtEnd=1
|
CallsignAtEnd=1
|
||||||
RFAck=K
|
RFAck=K
|
||||||
NetAck=N
|
# NetAck=N
|
||||||
AckSpeed=20
|
AckSpeed=20
|
||||||
AckFrequency=1750
|
AckFrequency=1750
|
||||||
AckMinTime=4
|
AckMinTime=4
|
||||||
|
|||||||
@@ -612,8 +612,7 @@ int CMMDVMHost::run()
|
|||||||
unsigned int callsignFrequency = m_conf.getFMCallsignFrequency();
|
unsigned int callsignFrequency = m_conf.getFMCallsignFrequency();
|
||||||
unsigned int callsignTime = m_conf.getFMCallsignTime();
|
unsigned int callsignTime = m_conf.getFMCallsignTime();
|
||||||
unsigned int callsignHoldoff = m_conf.getFMCallsignHoldoff();
|
unsigned int callsignHoldoff = m_conf.getFMCallsignHoldoff();
|
||||||
float callsignHighLevel = m_conf.getFMCallsignHighLevel();
|
float callsignLevel = m_conf.getFMCallsignLevel();
|
||||||
float callsignLowLevel = m_conf.getFMCallsignLowLevel();
|
|
||||||
bool callsignAtStart = m_conf.getFMCallsignAtStart();
|
bool callsignAtStart = m_conf.getFMCallsignAtStart();
|
||||||
bool callsignAtEnd = m_conf.getFMCallsignAtEnd();
|
bool callsignAtEnd = m_conf.getFMCallsignAtEnd();
|
||||||
std::string rfAck = m_conf.getFMRFAck();
|
std::string rfAck = m_conf.getFMRFAck();
|
||||||
@@ -637,12 +636,11 @@ int CMMDVMHost::run()
|
|||||||
LogInfo(" Callsign Frequency: %uHz", callsignFrequency);
|
LogInfo(" Callsign Frequency: %uHz", callsignFrequency);
|
||||||
LogInfo(" Callsign Time: %umins", callsignTime);
|
LogInfo(" Callsign Time: %umins", callsignTime);
|
||||||
LogInfo(" Callsign Holdoff: 1/%u", callsignHoldoff);
|
LogInfo(" Callsign Holdoff: 1/%u", callsignHoldoff);
|
||||||
LogInfo(" Callsign High Level: %.1f%%", callsignHighLevel);
|
LogInfo(" Callsign Level: %.1f%%", callsignLevel);
|
||||||
LogInfo(" Callsign Low Level: %.1f%%", callsignLowLevel);
|
|
||||||
LogInfo(" Callsign At Start: %s", callsignAtStart ? "yes" : "no");
|
LogInfo(" Callsign At Start: %s", callsignAtStart ? "yes" : "no");
|
||||||
LogInfo(" Callsign At End: %s", callsignAtEnd ? "yes" : "no");
|
LogInfo(" Callsign At End: %s", callsignAtEnd ? "yes" : "no");
|
||||||
LogInfo(" RF Ack: %s", rfAck.c_str());
|
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 Speed: %uWPM", ackSpeed);
|
||||||
LogInfo(" Ack Frequency: %uHz", ackFrequency);
|
LogInfo(" Ack Frequency: %uHz", ackFrequency);
|
||||||
LogInfo(" Ack Min Time: %us", ackMinTime);
|
LogInfo(" Ack Min Time: %us", ackMinTime);
|
||||||
@@ -656,9 +654,9 @@ int CMMDVMHost::run()
|
|||||||
LogInfo(" Kerchunk Time: %us", kerchunkTime);
|
LogInfo(" Kerchunk Time: %us", kerchunkTime);
|
||||||
LogInfo(" Hang Time: %us", hangTime);
|
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->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();
|
bool remoteControlEnabled = m_conf.getRemoteControlEnabled();
|
||||||
|
|||||||
29
Modem.cpp
29
Modem.cpp
@@ -1834,12 +1834,12 @@ bool CModem::writeDMRShortLC(const unsigned char* lc)
|
|||||||
return m_serial->write(buffer, 12U) == 12;
|
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);
|
assert(m_serial != NULL);
|
||||||
|
|
||||||
unsigned char buffer[80U];
|
unsigned char buffer[80U];
|
||||||
unsigned char len = 10U + callsign.size();
|
unsigned char len = 9U + callsign.size();
|
||||||
|
|
||||||
buffer[0U] = MMDVM_FRAME_START;
|
buffer[0U] = MMDVM_FRAME_START;
|
||||||
buffer[1U] = len;
|
buffer[1U] = len;
|
||||||
@@ -1850,17 +1850,16 @@ bool CModem::setFMCallsignParams(const std::string& callsign, unsigned int calls
|
|||||||
buffer[5U] = callsignTime;
|
buffer[5U] = callsignTime;
|
||||||
buffer[6U] = callsignHoldoff;
|
buffer[6U] = callsignHoldoff;
|
||||||
|
|
||||||
buffer[7U] = (unsigned char)(callsignHighLevel * 2.55F + 0.5F);
|
buffer[7U] = (unsigned char)(callsignLevel * 2.55F + 0.5F);
|
||||||
buffer[8U] = (unsigned char)(callsignLowLevel * 2.55F + 0.5F);
|
|
||||||
|
|
||||||
buffer[9U] = 0x00U;
|
buffer[8U] = 0x00U;
|
||||||
if (callsignAtStart)
|
if (callsignAtStart)
|
||||||
buffer[9U] |= 0x01U;
|
buffer[8U] |= 0x01U;
|
||||||
if (callsignAtEnd)
|
if (callsignAtEnd)
|
||||||
buffer[9U] |= 0x02U;
|
buffer[8U] |= 0x02U;
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < callsign.size(); i++)
|
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);
|
// CUtils::dump(1U, "Written", buffer, len);
|
||||||
|
|
||||||
@@ -1945,15 +1944,14 @@ bool CModem::setFMAckParams(const std::string& rfAck, unsigned int ackSpeed, uns
|
|||||||
return true;
|
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);
|
assert(m_serial != NULL);
|
||||||
|
|
||||||
unsigned char buffer[20U];
|
unsigned char buffer[20U];
|
||||||
unsigned char len = 10U + netAck.size();
|
|
||||||
|
|
||||||
buffer[0U] = MMDVM_FRAME_START;
|
buffer[0U] = MMDVM_FRAME_START;
|
||||||
buffer[1U] = len;
|
buffer[1U] = 10U;
|
||||||
buffer[2U] = MMDVM_FM_PARAMS3;
|
buffer[2U] = MMDVM_FM_PARAMS3;
|
||||||
|
|
||||||
buffer[3U] = timeout / 5U;
|
buffer[3U] = timeout / 5U;
|
||||||
@@ -1966,13 +1964,10 @@ bool CModem::setFMMiscParams(const std::string& netAck, unsigned int timeout, fl
|
|||||||
buffer[8U] = kerchunkTime;
|
buffer[8U] = kerchunkTime;
|
||||||
buffer[9U] = hangTime;
|
buffer[9U] = hangTime;
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < netAck.size(); i++)
|
// CUtils::dump(1U, "Written", buffer, 10U);
|
||||||
buffer[10U + i] = netAck.at(i);
|
|
||||||
|
|
||||||
// CUtils::dump(1U, "Written", buffer, len);
|
int ret = m_serial->write(buffer, 10U);
|
||||||
|
if (ret != 10)
|
||||||
int ret = m_serial->write(buffer, len);
|
|
||||||
if (ret != len)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned int count = 0U;
|
unsigned int count = 0U;
|
||||||
|
|||||||
4
Modem.h
4
Modem.h
@@ -45,9 +45,9 @@ public:
|
|||||||
virtual void setYSFParams(bool loDev, unsigned int txHang);
|
virtual void setYSFParams(bool loDev, unsigned int txHang);
|
||||||
virtual void setTransparentDataParams(unsigned int sendFrameType);
|
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 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();
|
virtual bool open();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user