Small CW Id cleanups.

48kHz
Jonathan Naylor 2016-05-10 06:35:53 +01:00
parent 61cacc40b9
commit 90ff130c51
3 changed files with 21 additions and 4 deletions

View File

@ -140,7 +140,7 @@ uint8_t CCWIdTX::write(const uint8_t* data, uint8_t length)
bool b = (SYMBOL_LIST[j].pattern & MASK) == MASK;
WRITE_BIT1(m_poBuffer, m_poLen, b);
if (m_poLen >= 1000U) {
if (m_poLen >= 995U) {
m_poLen = 0U;
return 4U;
}
@ -151,13 +151,23 @@ uint8_t CCWIdTX::write(const uint8_t* data, uint8_t length)
}
}
if (m_poLen == 8U)
// An empty message
if (m_poLen == 8U) {
m_poLen = 0U;
else
m_poLen += 5U;
return 4U;
}
m_poLen += 5U;
DEBUG2("Message created with length", m_poLen);
return 0U;
}
void CCWIdTX::reset()
{
m_poLen = 0U;
m_poPtr = 0U;
m_n = 0U;
}

View File

@ -30,6 +30,8 @@ public:
uint8_t write(const uint8_t* data, uint8_t length);
void reset();
private:
uint8_t m_poBuffer[1000U];
uint16_t m_poLen;

View File

@ -276,18 +276,21 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
DEBUG1("Mode set to DMR");
dstarRX.reset();
ysfRX.reset();
cwIdTX.reset();
break;
case STATE_DSTAR:
DEBUG1("Mode set to D-Star");
dmrIdleRX.reset();
dmrRX.reset();
ysfRX.reset();
cwIdTX.reset();
break;
case STATE_YSF:
DEBUG1("Mode set to System Fusion");
dmrIdleRX.reset();
dmrRX.reset();
dstarRX.reset();
cwIdTX.reset();
break;
case STATE_DSTARCAL:
DEBUG1("Mode set to D-Star Calibrate");
@ -295,6 +298,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
dmrRX.reset();
dstarRX.reset();
ysfRX.reset();
cwIdTX.reset();
break;
case STATE_DMRCAL:
DEBUG1("Mode set to DMR Calibrate");
@ -302,6 +306,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
dmrRX.reset();
dstarRX.reset();
ysfRX.reset();
cwIdTX.reset();
break;
default:
DEBUG1("Mode set to Idle");