mirror of https://github.com/g4klx/MMDVM.git
Small cleanups of the DMR trunking code.
This commit is contained in:
parent
841d7505c2
commit
57e692ad8c
32
DMRTX.cpp
32
DMRTX.cpp
|
|
@ -225,8 +225,10 @@ uint8_t CDMRTX::writeAloha(const uint8_t* data, uint16_t length)
|
|||
{
|
||||
if (length != DMR_FRAME_LENGTH_BYTES)
|
||||
return 4U;
|
||||
|
||||
::memcpy(m_aloha, data, length);
|
||||
m_controlChannel = true;
|
||||
|
||||
return 0U;
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +315,7 @@ uint8_t CDMRTX::getSpace2() const
|
|||
|
||||
void CDMRTX::createData(uint8_t slotIndex)
|
||||
{
|
||||
if (m_fifo[slotIndex].getData() >= DMR_FRAME_LENGTH_BYTES && m_frameCount >= STARTUP_COUNT && m_abortCount[slotIndex] >= ABORT_COUNT) {
|
||||
if ((m_fifo[slotIndex].getData() >= DMR_FRAME_LENGTH_BYTES) && (m_frameCount >= STARTUP_COUNT) && (m_abortCount[slotIndex] >= ABORT_COUNT)) {
|
||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||
m_fifo[slotIndex].get(m_poBuffer[i]);
|
||||
m_markBuffer[i] = MARK_NONE;
|
||||
|
|
@ -322,12 +324,11 @@ void CDMRTX::createData(uint8_t slotIndex)
|
|||
m_abort[slotIndex] = false;
|
||||
// Transmit an idle message
|
||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||
if(slotIndex == 0 && m_controlChannel && m_trunking) {
|
||||
if ((slotIndex == 0U) && m_controlChannel && m_trunking)
|
||||
m_poBuffer[i] = m_aloha[i];
|
||||
}
|
||||
else {
|
||||
else
|
||||
m_poBuffer[i] = m_idle[i];
|
||||
}
|
||||
|
||||
m_markBuffer[i] = MARK_NONE;
|
||||
}
|
||||
}
|
||||
|
|
@ -378,10 +379,12 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
|||
m_cachPtr = 0U;
|
||||
|
||||
if (m_cachPtr == 0U) {
|
||||
if (m_fifo[0U].getData() == 0U && m_fifo[1U].getData() == 0U) {
|
||||
if(!m_trunking)
|
||||
::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U);
|
||||
if ((m_fifo[0U].getData() == 0U) && (m_fifo[1U].getData() == 0U)) {
|
||||
if (m_trunking)
|
||||
::memcpy(m_shortLC, m_newShortLC, 12U);
|
||||
else
|
||||
::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U);
|
||||
} else {
|
||||
::memcpy(m_shortLC, m_newShortLC, 12U);
|
||||
}
|
||||
}
|
||||
|
|
@ -393,8 +396,8 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
|||
|
||||
bool at = false;
|
||||
if (m_frameCount >= STARTUP_COUNT)
|
||||
at = m_fifo[rxSlotIndex].getData() > 0U;
|
||||
bool tc = txSlotIndex == 1U;
|
||||
at = (m_fifo[rxSlotIndex].getData() > 0U);
|
||||
bool tc = (txSlotIndex == 1U);
|
||||
bool ls0 = true; // For 1 and 2
|
||||
bool ls1 = true;
|
||||
|
||||
|
|
@ -423,17 +426,16 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
|||
|
||||
void CDMRTX::setColorCode(uint8_t colorCode)
|
||||
{
|
||||
if(m_trunking)
|
||||
if (m_trunking)
|
||||
::memcpy(m_idle, TERMINATOR_DATA, DMR_FRAME_LENGTH_BYTES);
|
||||
else
|
||||
::memcpy(m_idle, IDLE_DATA, DMR_FRAME_LENGTH_BYTES);
|
||||
|
||||
CDMRSlotType slotType;
|
||||
if(m_trunking) {
|
||||
if (m_trunking) {
|
||||
slotType.encode(colorCode, DT_TERMINATOR_WITH_LC, m_idle);
|
||||
slotType.encode(colorCode, DT_CSBK, m_aloha);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
slotType.encode(colorCode, DT_IDLE, m_idle);
|
||||
}
|
||||
}
|
||||
|
|
@ -458,6 +460,4 @@ void CDMRTX::setTrunking(bool trunking)
|
|||
m_trunking = trunking;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue