diff --git a/CommandStation-EX.ino b/CommandStation-EX.ino index 61b23ec..92a13aa 100644 --- a/CommandStation-EX.ino +++ b/CommandStation-EX.ino @@ -168,7 +168,8 @@ void loop() DCCPacket p = dccSniffer->fetchPacket(); if (p.len() != 0) { if (DCCDecoder::parse(p)) { - p.print(); + if (Diag::SNIFFER) + p.print(); } } } diff --git a/DCCDecoder.cpp b/DCCDecoder.cpp index 6e7d858..f1a0a40 100644 --- a/DCCDecoder.cpp +++ b/DCCDecoder.cpp @@ -42,8 +42,10 @@ bool DCCDecoder::parse(DCCPacket &p) { for (byte n = 0; n < p.len(); n++) checksum ^= d[n]; if (checksum) { // Result should be zero, if not it's an error! - DIAG(F("Checksum error:")); - p.print(); + if (Diag::SNIFFER) { + DIAG(F("Checksum error:")); + p.print(); + } return false; } diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 37f67cd..b8c3100 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -1277,6 +1277,10 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[]) Diag::LCN = onOff; return true; + case "SNIFFER"_hk: // + Diag::SNIFFER = onOff; + return true; + case "WEBSOCKET"_hk: // Diag::WEBSOCKET = onOff; return true; diff --git a/StringFormatter.cpp b/StringFormatter.cpp index 35a4901..641532e 100644 --- a/StringFormatter.cpp +++ b/StringFormatter.cpp @@ -29,6 +29,7 @@ bool Diag::ETHERNET=false; bool Diag::LCN=false; bool Diag::RAILCOM=false; bool Diag::WEBSOCKET=false; +bool Diag::SNIFFER=false; diff --git a/StringFormatter.h b/StringFormatter.h index c046ec7..0407725 100644 --- a/StringFormatter.h +++ b/StringFormatter.h @@ -32,7 +32,7 @@ class Diag { static bool LCN; static bool RAILCOM; static bool WEBSOCKET; - + static bool SNIFFER; }; class StringFormatter