Skip to content

Commit

Permalink
Improve output from logic sniffer
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewman committed Aug 20, 2017
1 parent 1114d67 commit 5265675
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tools/logic/logic-rdm-sniffer.cpp
Expand Up @@ -267,8 +267,9 @@ void LogicReader::ProcessData(U8 *data, uint32_t data_length) {


void LogicReader::DisplayDMXFrame(const uint8_t *data, unsigned int length) {
if (!FLAGS_display_dmx)
if (!FLAGS_display_dmx) {
return;
}

cout << "DMX " << std::dec;
cout << length << ":" << std::hex;
Expand All @@ -283,15 +284,18 @@ void LogicReader::DisplayRDMFrame(const uint8_t *data, unsigned int length) {
}
command->Print(&m_command_printer, !FLAGS_full_rdm, true);
} else {
cout << "RDM " << std::dec;
cout << length << ":" << std::hex;
DisplayRawData(data, length);
}
}


void LogicReader::DisplayAlternateFrame(const uint8_t *data,
unsigned int length) {
if (!FLAGS_display_asc || length == 0)
if (!FLAGS_display_asc || length == 0) {
return;
}

unsigned int slot_count = length - 1;
cout << "SC " << ToHex(static_cast<int>(data[0]))
Expand All @@ -305,7 +309,8 @@ void LogicReader::DisplayAlternateFrame(const uint8_t *data,
*/
void LogicReader::DisplayRawData(const uint8_t *data, unsigned int length) {
for (unsigned int i = 0; i < length; i++) {
cout << std::hex << std::setw(2) << static_cast<int>(data[i]) << " ";
cout << std::hex << std::setw(2) << std::setfill('0')
<< static_cast<int>(data[i]) << " ";
}
cout << endl;
}
Expand Down

0 comments on commit 5265675

Please sign in to comment.