diff --git a/CMakeLists.txt b/CMakeLists.txt index 566b8e79..07dc0c79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,6 +209,7 @@ option(FORCE_TSBK_CRC_WARN "" off) option(DEBUG_P25_DFSI "" off) option(DEBUG_RINGBUFFER "" off) option(DEBUG_HTTP_PAYLOAD "" off) +option(DEBUG_TRELLIS "" off) if (DEBUG_DMR_PDU_DATA) add_definitions(-DDEBUG_DMR_PDU_DATA) @@ -273,6 +274,9 @@ endif (DEBUG_RINGBUFFER) if (DEBUG_HTTP_PAYLOAD) add_definitions(-DDEBUG_HTTP_PAYLOAD) endif (DEBUG_HTTP_PAYLOAD) +if (DEBUG_TRELLIS) + add_definitions(-DDEBUG_TRELLIS) +endif (DEBUG_TRELLIS) # cross-compile options option(CROSS_COMPILE_ARM "Cross-compile for 32-bit ARM" off) diff --git a/dmr/edac/Trellis.cpp b/dmr/edac/Trellis.cpp index 73db6fe4..e19bb7b6 100644 --- a/dmr/edac/Trellis.cpp +++ b/dmr/edac/Trellis.cpp @@ -395,6 +395,9 @@ void Trellis::tribitsToBits(const uint8_t* tribits, uint8_t* payload) const /// True, if error corrected, otherwise false. bool Trellis::fixCode(uint8_t* points, uint32_t failPos, uint8_t* payload) const { +#if DEBUG_TRELLIS + ::LogDebug(LOG_HOST, "Trellis::fixCode() failPos = %u, val = %01X", failPos, points[failPos]); +#endif for (unsigned j = 0U; j < 20U; j++) { uint32_t bestPos = 0U; uint32_t bestVal = 0U; @@ -405,6 +408,9 @@ bool Trellis::fixCode(uint8_t* points, uint32_t failPos, uint8_t* payload) const uint8_t tribits[49U]; uint32_t pos = checkCode(points, tribits); if (pos == 999U) { +#if DEBUG_TRELLIS + ::LogDebug(LOG_HOST, "Trellis::fixCode34() fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); +#endif tribitsToBits(tribits, payload); return true; } diff --git a/p25/edac/Trellis.cpp b/p25/edac/Trellis.cpp index d2f5c5f6..9d7394b2 100644 --- a/p25/edac/Trellis.cpp +++ b/p25/edac/Trellis.cpp @@ -24,6 +24,7 @@ */ #include "Defines.h" #include "p25/edac/Trellis.h" +#include "Log.h" using namespace p25::edac; @@ -512,6 +513,9 @@ void Trellis::dibitsToBits(const uint8_t* dibits, uint8_t* payload) const /// True, if error corrected, otherwise false. bool Trellis::fixCode34(uint8_t* points, uint32_t failPos, uint8_t* payload) const { +#if DEBUG_TRELLIS + ::LogDebug(LOG_HOST, "Trellis::fixCode34() failPos = %u, val = %01X", failPos, points[failPos]); +#endif for (unsigned j = 0U; j < 20U; j++) { uint32_t bestPos = 0U; uint32_t bestVal = 0U; @@ -522,6 +526,9 @@ bool Trellis::fixCode34(uint8_t* points, uint32_t failPos, uint8_t* payload) con uint8_t tribits[49U]; uint32_t pos = checkCode34(points, tribits); if (pos == 999U) { +#if DEBUG_TRELLIS + ::LogDebug(LOG_HOST, "Trellis::fixCode34() fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); +#endif tribitsToBits(tribits, payload); return true; } @@ -581,16 +588,22 @@ uint32_t Trellis::checkCode34(const uint8_t* points, uint8_t* tribits) const /// True, if error corrected, otherwise false. bool Trellis::fixCode12(uint8_t* points, uint32_t failPos, uint8_t* payload) const { +#if DEBUG_TRELLIS + ::LogDebug(LOG_HOST, "Trellis::fixCode12() failPos = %u, val = %01X", failPos, points[failPos]); +#endif for (unsigned j = 0U; j < 20U; j++) { uint32_t bestPos = 0U; uint32_t bestVal = 0U; - for (uint32_t i = 0U; i < 4U; i++) { + for (uint32_t i = 0U; i < 16U; i++) { points[failPos] = i; uint8_t dibits[49U]; uint32_t pos = checkCode12(points, dibits); if (pos == 999U) { +#if DEBUG_TRELLIS + ::LogDebug(LOG_HOST, "Trellis::fixCode12() fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); +#endif dibitsToBits(dibits, payload); return true; }