mirror of https://github.com/g4klx/MMDVM.git
Return configuration errors.
This commit is contained in:
parent
4b0c3d88f3
commit
bbe56f5082
24
FM.cpp
24
FM.cpp
|
@ -82,10 +82,8 @@ void CFM::reset()
|
|||
{
|
||||
}
|
||||
|
||||
void CFM::setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd)
|
||||
uint8_t CFM::setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd)
|
||||
{
|
||||
m_callsign.setParams(callsign, speed, frequency, lowLevel);
|
||||
|
||||
m_callsignAtStart = callsignAtStart;
|
||||
m_callsignAtEnd = callsignAtEnd;
|
||||
|
||||
|
@ -96,25 +94,29 @@ void CFM::setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, u
|
|||
|
||||
m_holdoffTimer.setTimeout(holdoffTime, 0U);
|
||||
m_callsignTimer.setTimeout(callsignTime, 0U);
|
||||
|
||||
return m_callsign.setParams(callsign, speed, frequency, lowLevel);
|
||||
}
|
||||
|
||||
void CFM::setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level)
|
||||
uint8_t CFM::setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level)
|
||||
{
|
||||
m_rfAck.setParams(rfAck, speed, frequency, level);
|
||||
|
||||
m_ackDelayTimer.setTimeout(0U, delay);
|
||||
m_ackMinTimer.setTimeout(minTime, 0U);
|
||||
|
||||
return m_rfAck.setParams(rfAck, speed, frequency, level);
|
||||
}
|
||||
|
||||
void CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime)
|
||||
uint8_t CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime)
|
||||
{
|
||||
m_timeoutTone.setParams(timeoutLevel);
|
||||
m_goertzel.setParams(ctcssFrequency, ctcssThreshold);
|
||||
m_ctcss.setParams(ctcssFrequency, ctcssLevel);
|
||||
|
||||
m_timeoutTimer.setTimeout(timeout, 0U);
|
||||
m_kerchunkTimer.setTimeout(kerchunkTime, 0U);
|
||||
m_hangTimer.setTimeout(hangTime, 0U);
|
||||
|
||||
m_timeoutTone.setParams(timeoutLevel);
|
||||
|
||||
m_goertzel.setParams(ctcssFrequency, ctcssThreshold);
|
||||
|
||||
return m_ctcss.setParams(ctcssFrequency, ctcssLevel);
|
||||
}
|
||||
|
||||
void CFM::stateMachine(bool validSignal, uint8_t length)
|
||||
|
|
6
FM.h
6
FM.h
|
@ -47,9 +47,9 @@ public:
|
|||
|
||||
void reset();
|
||||
|
||||
void setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd);
|
||||
void setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level);
|
||||
void setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime);
|
||||
uint8_t setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd);
|
||||
uint8_t setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level);
|
||||
uint8_t setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime);
|
||||
|
||||
private:
|
||||
CFMKeyer m_callsign;
|
||||
|
|
|
@ -81,7 +81,7 @@ m_n(0U)
|
|||
{
|
||||
}
|
||||
|
||||
void CFMCTCSSTX::setParams(uint8_t frequency, uint8_t level)
|
||||
uint8_t CFMCTCSSTX::setParams(uint8_t frequency, uint8_t level)
|
||||
{
|
||||
for (uint8_t i = 0U; i < CTCSS_TABLE_LEN; i++) {
|
||||
if (CTCSS_TONES[i].m_frequency == frequency) {
|
||||
|
@ -91,6 +91,8 @@ void CFMCTCSSTX::setParams(uint8_t frequency, uint8_t level)
|
|||
}
|
||||
|
||||
m_level = q15_t(level * 128);
|
||||
|
||||
return m_entry == NULL ? 4U : 0U;
|
||||
}
|
||||
|
||||
void CFMCTCSSTX::getAudio(q15_t* samples, uint8_t length)
|
||||
|
|
|
@ -31,7 +31,7 @@ class CFMCTCSSTX {
|
|||
public:
|
||||
CFMCTCSSTX();
|
||||
|
||||
void setParams(uint8_t frequency, uint8_t level);
|
||||
uint8_t setParams(uint8_t frequency, uint8_t level);
|
||||
|
||||
void getAudio(q15_t* samples, uint8_t length);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ m_poLen(0U)
|
|||
{
|
||||
}
|
||||
|
||||
void CFMKeyer::setParams(const char* text, uint8_t speed, uint16_t frequency, uint8_t level)
|
||||
uint8_t CFMKeyer::setParams(const char* text, uint8_t speed, uint16_t frequency, uint8_t level)
|
||||
{
|
||||
m_level = q15_t(level * 128);
|
||||
|
||||
|
@ -98,7 +98,7 @@ void CFMKeyer::setParams(const char* text, uint8_t speed, uint16_t frequency, ui
|
|||
|
||||
if (m_poLen >= 995U) {
|
||||
m_poLen = 0U;
|
||||
return;
|
||||
return 4U;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,8 @@ void CFMKeyer::setParams(const char* text, uint8_t speed, uint16_t frequency, ui
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0U;
|
||||
}
|
||||
|
||||
void CFMKeyer::getAudio(q15_t* samples, uint8_t length)
|
||||
|
|
|
@ -25,7 +25,7 @@ class CFMKeyer {
|
|||
public:
|
||||
CFMKeyer();
|
||||
|
||||
void setParams(const char* text, uint8_t speed, uint16_t frequency, uint8_t level);
|
||||
uint8_t setParams(const char* text, uint8_t speed, uint16_t frequency, uint8_t level);
|
||||
|
||||
void getAudio(q15_t* samples, uint8_t length);
|
||||
|
||||
|
|
|
@ -384,9 +384,7 @@ uint8_t CSerialPort::setFMParams1(const uint8_t* data, uint8_t length)
|
|||
callsign[n] = data[i];
|
||||
callsign[n] = '\0';
|
||||
|
||||
fm.setCallsign(callsign, speed, frequency, time, holdoff, highLevel, lowLevel, callAtStart, callAtEnd);
|
||||
|
||||
return 0U;
|
||||
return fm.setCallsign(callsign, speed, frequency, time, holdoff, highLevel, lowLevel, callAtStart, callAtEnd);
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setFMParams2(const uint8_t* data, uint8_t length)
|
||||
|
@ -406,9 +404,7 @@ uint8_t CSerialPort::setFMParams2(const uint8_t* data, uint8_t length)
|
|||
ack[n] = data[i];
|
||||
ack[n] = '\0';
|
||||
|
||||
fm.setAck(ack, speed, frequency, minTime, delay, level);
|
||||
|
||||
return 0U;
|
||||
return fm.setAck(ack, speed, frequency, minTime, delay, level);
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint8_t length)
|
||||
|
@ -426,9 +422,7 @@ uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint8_t length)
|
|||
uint8_t kerchunkTime = data[5U];
|
||||
uint8_t hangTime = data[6U];
|
||||
|
||||
fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime);
|
||||
|
||||
return 0U;
|
||||
return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime);
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
||||
|
|
Loading…
Reference in New Issue