1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-21 12:28:55 +02:00

Add Diag::SNIFFER so config verbosity of sniffer output

This commit is contained in:
Harald Barth 2025-07-07 20:54:21 +02:00
parent e6a829d8ef
commit e45febc785
5 changed files with 12 additions and 4 deletions

View File

@ -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();
}
}
}

View File

@ -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;
}

View File

@ -1277,6 +1277,10 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
Diag::LCN = onOff;
return true;
case "SNIFFER"_hk: // <D SNIFFER ON/OFF>
Diag::SNIFFER = onOff;
return true;
case "WEBSOCKET"_hk: // <D WEBSOCKET ON/OFF>
Diag::WEBSOCKET = onOff;
return true;

View File

@ -29,6 +29,7 @@ bool Diag::ETHERNET=false;
bool Diag::LCN=false;
bool Diag::RAILCOM=false;
bool Diag::WEBSOCKET=false;
bool Diag::SNIFFER=false;

View File

@ -32,7 +32,7 @@ class Diag {
static bool LCN;
static bool RAILCOM;
static bool WEBSOCKET;
static bool SNIFFER;
};
class StringFormatter