mirror of https://github.com/g4klx/MMDVM.git
Make DMR trunking state handling order-independent.
The CSBK slot type was only encoded into the ALOHA frame inside setColorCode(), so it took effect only if a reconfigure happened after an ALOHA frame had already been received; on the usual command ordering (SET_CONFIG then ALOHA) the transmitted slot type depended entirely on the host-supplied bytes. Remember the colour code and stamp the slot type in writeAloha() as well. Also clear m_controlChannel when trunking is disabled, so the host has a way to stop control channel transmission other than rebooting, and fix a stray tab introduced in createCACH().
This commit is contained in:
parent
90220cbb9d
commit
96061a6013
14
DMRTX.cpp
14
DMRTX.cpp
|
|
@ -84,7 +84,8 @@ m_frameCount(0U),
|
|||
m_abortCount(),
|
||||
m_abort(),
|
||||
m_controlChannel(false),
|
||||
m_trunking(false)
|
||||
m_trunking(false),
|
||||
m_colorCode(0U)
|
||||
{
|
||||
::memset(m_modState, 0x00U, 16U * sizeof(q15_t));
|
||||
|
||||
|
|
@ -227,6 +228,12 @@ uint8_t CDMRTX::writeAloha(const uint8_t* data, uint16_t length)
|
|||
return 4U;
|
||||
|
||||
::memcpy(m_aloha, data, length);
|
||||
|
||||
// Stamp the slot type with the current colour code so that the result
|
||||
// doesn't depend on the ordering of the ALOHA and SET_CONFIG commands.
|
||||
CDMRSlotType slotType;
|
||||
slotType.encode(m_colorCode, DT_CSBK, m_aloha);
|
||||
|
||||
m_controlChannel = true;
|
||||
|
||||
return 0U;
|
||||
|
|
@ -426,6 +433,8 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
|||
|
||||
void CDMRTX::setColorCode(uint8_t colorCode)
|
||||
{
|
||||
m_colorCode = colorCode;
|
||||
|
||||
if (m_trunking)
|
||||
::memcpy(m_idle, TERMINATOR_DATA, DMR_FRAME_LENGTH_BYTES);
|
||||
else
|
||||
|
|
@ -458,6 +467,9 @@ uint32_t CDMRTX::getFrameCount()
|
|||
void CDMRTX::setTrunking(bool trunking)
|
||||
{
|
||||
m_trunking = trunking;
|
||||
|
||||
if (!trunking)
|
||||
m_controlChannel = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue