Skip to content

Commit d3b91ee

Browse files
committed
Ethernet.cpp - nice uip_periodic(i) loop; debug prints TCP flags
1 parent 91abc01 commit d3b91ee

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/Ethernet.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ UIPEthernetClass::tick()
184184
#ifdef UIPETHERNET_DEBUG
185185
if (in_packet != NOBLOCK)
186186
{
187-
Serial.print(F("--------------\nreceivePacket: "));
188-
Serial.println(in_packet);
187+
Serial.println(F("--------------\npacket received"));
189188
}
190189
#endif
191190
}
@@ -201,7 +200,9 @@ UIPEthernetClass::tick()
201200
uip_packet = in_packet; //required for upper_layer_checksum of in_packet!
202201
#ifdef UIPETHERNET_DEBUG
203202
Serial.print(F("readPacket type IP, uip_len: "));
204-
Serial.println(uip_len);
203+
Serial.print(uip_len);
204+
Serial.print(F(", bits: "));
205+
Serial.println(BUF->flags, BIN);
205206
#endif
206207
uip_arp_ipin();
207208
uip_input();
@@ -227,8 +228,7 @@ UIPEthernetClass::tick()
227228
if (in_packet != NOBLOCK && (packetstate & UIPETHERNET_FREEPACKET))
228229
{
229230
#ifdef UIPETHERNET_DEBUG
230-
Serial.print(F("freeing packet: "));
231-
Serial.println(in_packet);
231+
Serial.println(F("freeing received packet"));
232232
#endif
233233
Enc28J60Network::freePacket();
234234
in_packet = NOBLOCK;
@@ -243,17 +243,16 @@ UIPEthernetClass::tick()
243243

244244
for (int i = 0; i < UIP_CONNS; i++)
245245
{
246-
uip_conn = &uip_conns[i];
247-
uip_process(UIP_TIMER);
248-
// If the above function invocation resulted in data that
249-
// should be sent out on the Enc28J60Network, the global variable
250-
// uip_len is set to a value > 0.
251-
if (uip_len > 0)
252-
{
253-
uip_arp_out();
254-
network_send();
246+
uip_periodic(i);
247+
// If the above function invocation resulted in data that
248+
// should be sent out on the Enc28J60Network, the global variable
249+
// uip_len is set to a value > 0.
250+
if (uip_len > 0)
251+
{
252+
uip_arp_out();
253+
network_send();
254+
}
255255
}
256-
}
257256
#if UIP_UDP
258257
for (int i = 0; i < UIP_UDP_CONNS; i++)
259258
{
@@ -291,7 +290,9 @@ boolean UIPEthernetClass::network_send()
291290
Serial.print(F("Enc28J60Network_send uip_buf (uip_len): "));
292291
Serial.print(uip_len);
293292
Serial.print(F(", packet: "));
294-
Serial.println(uip_packet);
293+
Serial.print(uip_packet);
294+
Serial.print(F(", bits: "));
295+
Serial.println(BUF->flags, BIN);
295296
#endif
296297
Enc28J60Network::writePacket(uip_packet, UIP_SENDBUFFER_OFFSET,uip_buf,uip_len);
297298
goto sendandfree;

0 commit comments

Comments
 (0)