Skip to content

Commit

Permalink
Fix wrong positions of the status bits.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Sep 13, 2016
1 parent 34e0d10 commit 30467a7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void CModem::clock(unsigned int ms)
readStatus();
m_statusTimer.start();


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

m_nn++;
#endif
}

m_inactivityTimer.clock(ms);
Expand Down
9 changes: 4 additions & 5 deletions P25Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,9 @@ void CP25Control::addBusyBits(unsigned char* data, unsigned int length, bool b1,
{
assert(data != NULL);

for (unsigned int i = 0U; i < length; i++) {
if (i > 0U && (i % 70U) == 0U)
WRITE_BIT(data, i, b1);
if (i > 0U && (i % 71U) == 0U)
WRITE_BIT(data, i, b2);
for (unsigned int ss0Pos = P25_SS0_START; ss0Pos < length; ss0Pos += P25_SS_INCREMENT) {
unsigned int ss1Pos = ss0Pos + 1U;
WRITE_BIT(data, ss0Pos, b1);
WRITE_BIT(data, ss1Pos, b2);
}
}
4 changes: 4 additions & 0 deletions P25Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_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_TERM = 0x03U;
const unsigned char P25_DUID_LDU1 = 0x05U;
Expand Down
4 changes: 2 additions & 2 deletions P25NID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void CP25NID::process(unsigned char* data)

unsigned int n = 0U;
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);
WRITE_BIT(nid, n, b);
n++;
Expand All @@ -61,7 +61,7 @@ void CP25NID::process(unsigned char* data)

n = 0U;
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);
WRITE_BIT(data, offset, b);
n++;
Expand Down

0 comments on commit 30467a7

Please sign in to comment.