Skip to content

Commit

Permalink
looptimer more diag in EthernetInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
habazut committed Aug 9, 2024
1 parent e328ea5 commit 690c629
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions EthernetInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "WiThrottle.h"
#include "DCCTimer.h"

extern void looptimer(unsigned long timeout, const FSH* message);

EthernetInterface * EthernetInterface::singleton=NULL;
/**
* @brief Setup Ethernet Connection
Expand Down Expand Up @@ -125,6 +127,7 @@ void EthernetInterface::loop()
//nothing happened
break;
}
looptimer(8000, F("Ethloop after maintain"));
singleton->loop2();
}

Expand Down Expand Up @@ -207,13 +210,14 @@ void EthernetInterface::loop2() {
// read bytes from a client
int count = clients[socket].read(buffer, MAX_ETH_BUFFER);
buffer[count] = '\0'; // terminate the string properly
if (Diag::ETHERNET) DIAG(F(",count=%d:%e"), socket,buffer);
if (Diag::ETHERNET) DIAG(F(",count=%d:%e"), count, buffer);
// execute with data going directly back
CommandDistributor::parse(socket,buffer,outboundRing);
return; // limit the amount of processing that takes place within 1 loop() cycle.
}
}
}
looptimer(8000, F("Ethloop2 after incoming"));

// stop any clients which disconnect
for (int socket = 0; socket<MAX_SOCK_NUM; socket++) {
Expand All @@ -223,9 +227,11 @@ void EthernetInterface::loop2() {
if (Diag::ETHERNET) DIAG(F("Ethernet: disconnect %d "), socket);
}
}
looptimer(8000, F("Ethloop after disconnectcheck"));

WiThrottle::loop(outboundRing);

looptimer(8000, F("Ethloop after Withrottleloop"));

// handle at most 1 outbound transmission
int socketOut=outboundRing->read();
if (socketOut >= MAX_SOCK_NUM) {
Expand All @@ -236,5 +242,7 @@ void EthernetInterface::loop2() {
for(;count>0;count--) clients[socketOut].write(outboundRing->read());
clients[socketOut].flush(); //maybe
}
looptimer(8000, F("Ethloop after outbound"));

}
#endif

0 comments on commit 690c629

Please sign in to comment.