Fix wrong positions of the status bits.

This commit is contained in:
Jonathan Naylor 2016-09-13 06:24:06 +01:00
parent 34e0d10343
commit 30467a749c
4 changed files with 12 additions and 8 deletions

View file

@ -308,7 +308,7 @@ void CModem::clock(unsigned int ms)
readStatus(); readStatus();
m_statusTimer.start(); m_statusTimer.start();
#ifdef notdef
const unsigned char* dat = P25_DATA[m_nn]; const unsigned char* dat = P25_DATA[m_nn];
if (m_nn == 0U) { if (m_nn == 0U) {
unsigned char data = 101U; unsigned char data = 101U;
@ -329,6 +329,7 @@ void CModem::clock(unsigned int ms)
} }
m_nn++; m_nn++;
#endif
} }
m_inactivityTimer.clock(ms); m_inactivityTimer.clock(ms);

View file

@ -281,10 +281,9 @@ void CP25Control::addBusyBits(unsigned char* data, unsigned int length, bool b1,
{ {
assert(data != NULL); assert(data != NULL);
for (unsigned int i = 0U; i < length; i++) { for (unsigned int ss0Pos = P25_SS0_START; ss0Pos < length; ss0Pos += P25_SS_INCREMENT) {
if (i > 0U && (i % 70U) == 0U) unsigned int ss1Pos = ss0Pos + 1U;
WRITE_BIT(data, i, b1); WRITE_BIT(data, ss0Pos, b1);
if (i > 0U && (i % 71U) == 0U) WRITE_BIT(data, ss1Pos, b2);
WRITE_BIT(data, i, b2);
} }
} }

View file

@ -37,6 +37,10 @@ const unsigned int P25_NID_LENGTH_BYTES = 8U;
const unsigned char P25_SYNC_BYTES[] = {0x55U, 0x75U, 0xF5U, 0xFFU, 0x77U, 0xFFU}; const unsigned char P25_SYNC_BYTES[] = {0x55U, 0x75U, 0xF5U, 0xFFU, 0x77U, 0xFFU};
const unsigned char P25_SYNC_BYTES_LENGTH = 6U; const unsigned char P25_SYNC_BYTES_LENGTH = 6U;
const unsigned int P25_SS0_START = 70U;
const unsigned int P25_SS1_START = 71U;
const unsigned int P25_SS_INCREMENT = 72U;
const unsigned char P25_DUID_HEADER = 0x00U; const unsigned char P25_DUID_HEADER = 0x00U;
const unsigned char P25_DUID_TERM = 0x03U; const unsigned char P25_DUID_TERM = 0x03U;
const unsigned char P25_DUID_LDU1 = 0x05U; const unsigned char P25_DUID_LDU1 = 0x05U;

View file

@ -45,7 +45,7 @@ void CP25NID::process(unsigned char* data)
unsigned int n = 0U; unsigned int n = 0U;
for (unsigned int offset = 48U; offset < 114U; offset++) { for (unsigned int offset = 48U; offset < 114U; offset++) {
if (offset != 70U && offset != 71U) { if (offset != P25_SS0_START && offset != P25_SS1_START) {
bool b = READ_BIT(data, offset); bool b = READ_BIT(data, offset);
WRITE_BIT(nid, n, b); WRITE_BIT(nid, n, b);
n++; n++;
@ -61,7 +61,7 @@ void CP25NID::process(unsigned char* data)
n = 0U; n = 0U;
for (unsigned int offset = 48U; offset < 114U; offset++) { for (unsigned int offset = 48U; offset < 114U; offset++) {
if (offset != 70U && offset != 71U) { if (offset != P25_SS0_START && offset != P25_SS1_START) {
bool b = READ_BIT(nid, n); bool b = READ_BIT(nid, n);
WRITE_BIT(data, offset, b); WRITE_BIT(data, offset, b);
n++; n++;