Skip to content

Commit

Permalink
Debugging D-Star.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Feb 1, 2016
1 parent 00c15f1 commit 9ccc860
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion DStarControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ void CDStarControl::writeModem(unsigned char *data)
m_errs += errors;
m_bits += 48U;

m_frames++;

unsigned int bits = matchSync(data + 1U);
if (bits <= MAX_SYNC_BIT_ERRORS)
m_n = 0U;
Expand Down Expand Up @@ -736,7 +738,7 @@ void CDStarControl::sendAck()
if (m_network != NULL)
m_network->getStatus(status, reflector);

char text[20U];
char text[40U];
if (status == LS_LINKED_DEXTRA || status == LS_LINKED_DPLUS || status == LS_LINKED_DCS || status == LS_LINKED_CCS || status == LS_LINKED_LOOPBACK)
::sprintf(text, "%-8.8s BER: %.1f%% ", reflector, float(m_errs * 100U) / float(m_bits));
else
Expand Down
2 changes: 1 addition & 1 deletion DStarDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
const unsigned int DSTAR_HEADER_LENGTH_BYTES = 41U;
const unsigned int DSTAR_FRAME_LENGTH_BYTES = 12U;

const unsigned char DSTAR_END_PATTERN_BYTES[] = { TAG_EOT, 0x55, 0x55, 0x55, 0x55, 0xC8, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
const unsigned char DSTAR_END_PATTERN_BYTES[] = { TAG_EOT, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xC8, 0x7A };
const unsigned int DSTAR_END_PATTERN_LENGTH_BYTES = 6U;

const unsigned char DSTAR_NULL_AMBE_DATA_BYTES[] = { 0x9E, 0x8D, 0x32, 0x88, 0x26, 0x1A, 0x3F, 0x61, 0xE8 };
Expand Down
1 change: 1 addition & 0 deletions DStarNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ void CDStarNetwork::clock(unsigned int ms)
case 0x00U: // NETWORK_TEXT;
m_linkStatus = LINK_STATUS(buffer[25U]);
::memcpy(m_linkReflector, buffer + 26U, DSTAR_LONG_CALLSIGN_LENGTH);
LogMessage("D-Star link status set to \"%s\"", buffer + 5U);
return;

case 0x01U: // NETWORK_TEMPTEXT;
Expand Down
16 changes: 8 additions & 8 deletions Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,23 +364,23 @@ void CModem::clock(unsigned int ms)
}

if (m_dstarSpace > 1U && !m_txDStarData.isEmpty()) {
unsigned char buffer[2U];
m_txDStarData.peek(buffer, 2U);
unsigned char buffer[4U];
m_txDStarData.peek(buffer, 4U);

if ((buffer[1U] == TAG_HEADER && m_dstarSpace > 4U) ||
(buffer[1U] == TAG_DATA && m_dstarSpace > 1U) ||
(buffer[1U] == TAG_EOT && m_dstarSpace > 1U)) {
if ((buffer[3U] == MMDVM_DSTAR_HEADER && m_dstarSpace > 4U) ||
(buffer[3U] == MMDVM_DSTAR_DATA && m_dstarSpace > 1U) ||
(buffer[3U] == MMDVM_DSTAR_EOT && m_dstarSpace > 1U)) {
unsigned char len = 0U;
m_txDStarData.getData(&len, 1U);
m_txDStarData.getData(m_buffer, len);

if (m_debug) {
switch (buffer[1U]) {
case TAG_HEADER:
switch (buffer[3U]) {
case MMDVM_DSTAR_HEADER:
CUtils::dump(1U, "TX D-Star Header", m_buffer, len);
m_dstarSpace -= 4U;
break;
case TAG_DATA:
case MMDVM_DSTAR_DATA:
CUtils::dump(1U, "TX D-Star Data", m_buffer, len);
m_dstarSpace -= 1U;
break;
Expand Down

0 comments on commit 9ccc860

Please sign in to comment.