This commit is contained in:
Clint Chance 2026-07-12 16:54:42 -05:00 committed by GitHub
commit 40d0dd77af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 28 additions and 8 deletions

View File

@ -84,7 +84,8 @@ m_frameCount(0U),
m_abortCount(), m_abortCount(),
m_abort(), m_abort(),
m_controlChannel(false), m_controlChannel(false),
m_trunking(false) m_trunking(false),
m_colorCode(0U)
{ {
::memset(m_modState, 0x00U, 16U * sizeof(q15_t)); ::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; return 4U;
::memcpy(m_aloha, data, length); ::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; m_controlChannel = true;
return 0U; return 0U;
@ -426,6 +433,8 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
void CDMRTX::setColorCode(uint8_t colorCode) void CDMRTX::setColorCode(uint8_t colorCode)
{ {
m_colorCode = colorCode;
if (m_trunking) if (m_trunking)
::memcpy(m_idle, TERMINATOR_DATA, DMR_FRAME_LENGTH_BYTES); ::memcpy(m_idle, TERMINATOR_DATA, DMR_FRAME_LENGTH_BYTES);
else else
@ -458,6 +467,9 @@ uint32_t CDMRTX::getFrameCount()
void CDMRTX::setTrunking(bool trunking) void CDMRTX::setTrunking(bool trunking)
{ {
m_trunking = trunking; m_trunking = trunking;
if (!trunking)
m_controlChannel = false;
} }
#endif #endif

View File

@ -83,6 +83,7 @@ private:
bool m_abort[2U]; bool m_abort[2U];
bool m_controlChannel; bool m_controlChannel;
bool m_trunking; bool m_trunking;
uint8_t m_colorCode;
void createData(uint8_t slotIndex); void createData(uint8_t slotIndex);
void createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex); void createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex);

View File

@ -36,7 +36,8 @@ m_count(0U),
m_q0(0), m_q0(0),
m_q1(0), m_q1(0),
m_state(false), m_state(false),
m_validCount(0U) m_validCount(0U),
m_invalidCount(0U)
{ {
} }
@ -127,6 +128,8 @@ void CFMNoiseSquelch::reset()
m_q1 = 0; m_q1 = 0;
m_state = false; m_state = false;
m_count = 0U; m_count = 0U;
m_validCount = 0U;
m_invalidCount = 0U;
} }
#endif #endif

View File

@ -110,7 +110,7 @@ void CIO::initInt()
#if !defined(USE_ALTERNATE_POCSAG_LEDS) #if !defined(USE_ALTERNATE_POCSAG_LEDS)
pinMode(PIN_POCSAG, OUTPUT); pinMode(PIN_POCSAG, OUTPUT);
#endif #endif
#if !defined(USE_ALTERNATE_POCSAG_LEDS) #if !defined(USE_ALTERNATE_FM_LEDS)
pinMode(PIN_FM, OUTPUT); pinMode(PIN_FM, OUTPUT);
#endif #endif
#endif #endif

View File

@ -61,7 +61,7 @@ void CSTMUART::handleIRQ()
if (USART_GetITStatus(m_usart, USART_IT_RXNE)) { if (USART_GetITStatus(m_usart, USART_IT_RXNE)) {
if(!m_rxFifo.isFull()) if(!m_rxFifo.isFull())
m_rxFifo.put((uint8_t) USART_ReceiveData(m_usart)); m_rxFifo.put((uint8_t) USART_ReceiveData(m_usart));
USART_ClearITPendingBit(USART1, USART_IT_RXNE); USART_ClearITPendingBit(m_usart, USART_IT_RXNE);
} }
if (USART_GetITStatus(m_usart, USART_IT_TXE)) { if (USART_GetITStatus(m_usart, USART_IT_TXE)) {
@ -82,8 +82,12 @@ void CSTMUART::flush()
if(m_usart == NULL) if(m_usart == NULL)
return; return;
// wait until the TXE shows the shift register is empty // wait until the TX FIFO has drained
while (USART_GetITStatus(m_usart, USART_FLAG_TXE)) while (!m_txFifo.isEmpty())
;
// wait until the TC flag shows the shift register is empty
while (USART_GetFlagStatus(m_usart, USART_FLAG_TC) == RESET)
; ;
} }

View File

@ -745,7 +745,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
DEBUG1("Mode set to FM 20Khz Calibrate"); DEBUG1("Mode set to FM 20Khz Calibrate");
break; break;
case STATE_FMCAL25K: case STATE_FMCAL25K:
DEBUG1("Mode set to FM 10Khz Calibrate"); DEBUG1("Mode set to FM 25Khz Calibrate");
break; break;
case STATE_FMCAL30K: case STATE_FMCAL30K:
DEBUG1("Mode set to FM 30Khz Calibrate"); DEBUG1("Mode set to FM 30Khz Calibrate");