mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-05-07 13:37:48 +00:00
Small cleanups of the DMR trunking code.
This commit is contained in:
parent
841d7505c2
commit
57e692ad8c
3 changed files with 24 additions and 25 deletions
44
DMRTX.cpp
44
DMRTX.cpp
|
|
@ -46,8 +46,8 @@ const uint8_t IDLE_DATA[] =
|
|||
// DT Terminator with LC, empty
|
||||
const uint8_t TERMINATOR_DATA[] =
|
||||
{0x00U, 0xCCU, 0x01U, 0x80U, 0x01U, 0x94U, 0x01U, 0x48U, 0x08U, 0xB0U, 0x08U,
|
||||
0x80U, 0x04U, 0xADU, 0xFFU, 0x57U, 0xD7U, 0x5DU, 0xF5U, 0xD9U, 0x65U, 0x90U,
|
||||
0x01U, 0x78U, 0x00U, 0xD0U, 0x08U, 0x40U, 0x14U, 0x00U, 0x0DU, 0x80U, 0x15U};
|
||||
0x80U, 0x04U, 0xADU, 0xFFU, 0x57U, 0xD7U, 0x5DU, 0xF5U, 0xD9U, 0x65U, 0x90U,
|
||||
0x01U, 0x78U, 0x00U, 0xD0U, 0x08U, 0x40U, 0x14U, 0x00U, 0x0DU, 0x80U, 0x15U};
|
||||
|
||||
const uint8_t CACH_INTERLEAVE[] =
|
||||
{ 1U, 2U, 3U, 5U, 6U, 7U, 9U, 10U, 11U, 13U, 15U, 16U, 17U, 19U, 20U, 21U, 23U,
|
||||
|
|
@ -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) {
|
||||
m_poBuffer[i] = m_aloha[i];
|
||||
}
|
||||
else {
|
||||
m_poBuffer[i] = m_idle[i];
|
||||
}
|
||||
if ((slotIndex == 0U) && m_controlChannel && m_trunking)
|
||||
m_poBuffer[i] = m_aloha[i];
|
||||
else
|
||||
m_poBuffer[i] = m_idle[i];
|
||||
|
||||
m_markBuffer[i] = MARK_NONE;
|
||||
}
|
||||
}
|
||||
|
|
@ -378,12 +379,14 @@ 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);
|
||||
else
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
::memcpy(m_poBuffer, m_shortLC + m_cachPtr, 3U);
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
3
DMRTX.h
3
DMRTX.h
|
|
@ -65,7 +65,7 @@ public:
|
|||
void setColorCode(uint8_t colorCode);
|
||||
|
||||
private:
|
||||
CRingBuffer<uint8_t> m_fifo[2U];
|
||||
CRingBuffer<uint8_t> m_fifo[2U];
|
||||
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
||||
DMRTXSTATE m_state;
|
||||
|
|
@ -93,4 +93,3 @@ private:
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@
|
|||
#if !defined(VERSION_H)
|
||||
#define VERSION_H
|
||||
|
||||
#define VERSION "20260219"
|
||||
#define VERSION "20260424"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue