Debug: silence excessive couts
This commit is contained in:
@@ -63,12 +63,16 @@ bool Header::validateCrc16() const
|
|||||||
// Calculate CRC16 for the header excluding the crc_16 field itself
|
// Calculate CRC16 for the header excluding the crc_16 field itself
|
||||||
uint16_t calculatedCrc = calculateCrc16();
|
uint16_t calculatedCrc = calculateCrc16();
|
||||||
|
|
||||||
// Debug output
|
// Compare with the CRC in the header
|
||||||
|
bool isValid = (calculatedCrc == crc_16);
|
||||||
|
|
||||||
|
// Debug output only if validation fails
|
||||||
|
if (!isValid) {
|
||||||
std::cout << "CRC16 Debug: calculated=0x" << std::hex << calculatedCrc
|
std::cout << "CRC16 Debug: calculated=0x" << std::hex << calculatedCrc
|
||||||
<< ", received=0x" << crc_16 << std::dec << std::endl;
|
<< ", received=0x" << crc_16 << std::dec << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Compare with the CRC in the header
|
return isValid;
|
||||||
return calculatedCrc == crc_16;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Header::setCrc16FromRawBytes()
|
void Header::setCrc16FromRawBytes()
|
||||||
@@ -167,12 +171,16 @@ bool BroadcastMessage::validateCrc32() const
|
|||||||
|
|
||||||
calculatedCrc = comms::calculateCrc32(messageData, messageSize);
|
calculatedCrc = comms::calculateCrc32(messageData, messageSize);
|
||||||
|
|
||||||
// Debug output
|
// Compare with the CRC in the footer
|
||||||
|
bool isValid = (calculatedCrc == footer.crc_32);
|
||||||
|
|
||||||
|
// Debug output only if validation fails
|
||||||
|
if (!isValid) {
|
||||||
std::cout << "BroadcastMessage CRC32 Debug: calculated=0x" << std::hex << calculatedCrc
|
std::cout << "BroadcastMessage CRC32 Debug: calculated=0x" << std::hex << calculatedCrc
|
||||||
<< ", received=0x" << footer.crc_32 << std::dec << std::endl;
|
<< ", received=0x" << footer.crc_32 << std::dec << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Compare with the CRC in the footer
|
return isValid;
|
||||||
return calculatedCrc == footer.crc_32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandshakeRequest methods
|
// HandshakeRequest methods
|
||||||
@@ -284,12 +292,16 @@ bool HandshakeResponse::validateCrc32() const
|
|||||||
size_t messageSize = sizeof(HandshakeResponse) - sizeof(footer.crc_32);
|
size_t messageSize = sizeof(HandshakeResponse) - sizeof(footer.crc_32);
|
||||||
uint32_t calculatedCrc = comms::calculateCrc32(messageData, messageSize);
|
uint32_t calculatedCrc = comms::calculateCrc32(messageData, messageSize);
|
||||||
|
|
||||||
// Debug output
|
// Compare with the CRC in the footer
|
||||||
|
bool isValid = (calculatedCrc == footer.crc_32);
|
||||||
|
|
||||||
|
// Debug output only if validation fails
|
||||||
|
if (!isValid) {
|
||||||
std::cout << "HandshakeResponse CRC32 Debug: calculated=0x" << std::hex << calculatedCrc
|
std::cout << "HandshakeResponse CRC32 Debug: calculated=0x" << std::hex << calculatedCrc
|
||||||
<< ", received=0x" << footer.crc_32 << std::dec << std::endl;
|
<< ", received=0x" << footer.crc_32 << std::dec << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Compare with the CRC in the footer
|
return isValid;
|
||||||
return calculatedCrc == footer.crc_32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standalone CRC16 calculation utility
|
// Standalone CRC16 calculation utility
|
||||||
@@ -614,12 +626,16 @@ bool HeartbeatMessage::validateCrc32() const
|
|||||||
// Use the calculateCrc32 method to avoid code duplication
|
// Use the calculateCrc32 method to avoid code duplication
|
||||||
uint32_t calculatedCrc = calculateCrc32();
|
uint32_t calculatedCrc = calculateCrc32();
|
||||||
|
|
||||||
// Debug output
|
// Compare with the CRC in the footer
|
||||||
|
bool isValid = (calculatedCrc == footer.crc_32);
|
||||||
|
|
||||||
|
// Debug output only if validation fails
|
||||||
|
if (!isValid) {
|
||||||
std::cout << "HeartbeatMessage CRC32 Debug: calculated=0x" << std::hex << calculatedCrc
|
std::cout << "HeartbeatMessage CRC32 Debug: calculated=0x" << std::hex << calculatedCrc
|
||||||
<< ", received=0x" << footer.crc_32 << std::dec << std::endl;
|
<< ", received=0x" << footer.crc_32 << std::dec << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Compare with the CRC in the footer
|
return isValid;
|
||||||
return calculatedCrc == footer.crc_32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace comms
|
} // namespace comms
|
||||||
|
|||||||
Reference in New Issue
Block a user