1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-06-29 10:35:24 +02:00

remove debug code and looptimer and loopdiag

This commit is contained in:
Harald Barth 2025-04-01 22:41:52 +02:00
parent 40c30822f1
commit f48f755608

View File

@ -147,52 +147,8 @@ void setup()
CommandDistributor::broadcastPower(); CommandDistributor::broadcastPower();
} }
/**************** for future reference
void looptimer(unsigned long timeout, const FSH* message)
{
static unsigned long lasttimestamp = 0;
unsigned long now = micros();
if (timeout != 0) {
unsigned long diff = now - lasttimestamp;
if (diff > timeout) {
DIAG(message);
DIAG(F("DeltaT=%L"), diff);
lasttimestamp = micros();
return;
}
}
lasttimestamp = now;
}
*********************************************/
void loopdiag(unsigned long timeout)
{
static unsigned long lasttimestamp = 0;
unsigned long now = millis();
if (timeout != 0) {
unsigned long diff = now - lasttimestamp;
if (diff > timeout) {
if (dccSniffer){
uint64_t val = dccSniffer->getDebug();
int n = 64;
Serial.print("<* LOOPDIAG ");
while (n--) {
Serial.print(val&(1ULL<<n)?"1":"0");
}
Serial.println(" >\n");
/*
(dccSniffer->fetchPacket()).print(Serial);
*/
}
lasttimestamp = millis();
return;
}
}
// lasttimestamp = now;
}
void loop() void loop()
{ {
// Some debug for sniffer code
//loopdiag(937); // Do not use a value that does divide even in 80Mhz ticks
if (dccSniffer && dccDecoder) { if (dccSniffer && dccDecoder) {
DCCPacket p = dccSniffer->fetchPacket(); DCCPacket p = dccSniffer->fetchPacket();
if (p.len() != 0) { if (p.len() != 0) {
@ -201,7 +157,6 @@ void loop()
} }
} }
} }
digitalWrite(2,LOW);
// The main sketch has responsibilities during loop() // The main sketch has responsibilities during loop()