123
Diff: UipEthernet.cpp
- Revision:
- 15:53715cc81c63
- Parent:
- 14:7648334eb41b
- Child:
- 16:269f652b4d0b
--- a/UipEthernet.cpp Tue Sep 03 09:16:55 2019 +0000 +++ b/UipEthernet.cpp Sat Sep 07 17:42:42 2019 +0000 @@ -113,7 +113,7 @@ * @param * @retval */ -int UipEthernet::connect() +int UipEthernet::connect(unsigned long timeout) { // Inicialize static pointer to the UIPEthernet instance ethernet = this; @@ -124,7 +124,7 @@ // If no local IP address has been set ask DHCP server to provide one if (_ip == IpAddress()) { // Now try to get our config info from a DHCP server - int ret = dhcpClient.begin((uint8_t*)_mac); + int ret = dhcpClient.begin((uint8_t*)_mac, timeout); if (ret == 1) { // We've successfully found a DHCP server and got our configuration info, so set things @@ -352,8 +352,8 @@ if (inPacket == NOBLOCK) { inPacket = enc28j60Eth.receivePacket(); #ifdef UIPETHERNET_DEBUG - if (in_packet != NOBLOCK) { - printf("--------------\r\nreceivePacket: %d\r\n", in_packet); + if (inPacket != NOBLOCK) { + printf("--------------\r\nreceivePacket: %d\r\n", inPacket); } #endif } @@ -391,7 +391,7 @@ if (inPacket != NOBLOCK && (packetState & UIPETHERNET_FREEPACKET)) { #ifdef UIPETHERNET_DEBUG - printf("freeing packet: %d\r\n", in_packet); + printf("freeing packet: %d\r\n", inPacket); #endif enc28j60Eth.freePacket(); inPacket = NOBLOCK; @@ -455,7 +455,7 @@ if (packetState & UIPETHERNET_SENDPACKET) { #ifdef UIPETHERNET_DEBUG - printf("Enc28J60Network_send uip_packet: %d, hdrlen: %d\r\n", uip_packet, uip_hdrlen); + printf("Enc28J60Network_send uipPacket: %d, hdrlen: %d\r\n", inPacket, uipHeaderLen); #endif enc28j60Eth.writePacket(uipPacket, 0, uip_buf, uipHeaderLen); packetState &= ~UIPETHERNET_SENDPACKET; @@ -466,12 +466,15 @@ if (uipPacket != NOBLOCK) { #ifdef UIPETHERNET_DEBUG - printf("Enc28J60Network_send uip_buf (uip_len): %d, packet: %d\r\n", uip_len, uip_packet); + printf("Enc28J60Network_send uip_buf (uip_len): %d, packet: %d\r\n", uip_len, uipPacket); #endif enc28j60Eth.writePacket(uipPacket, 0, uip_buf, uip_len); goto sendandfree; } +#ifdef UIPETHERNET_DEBUG + printf("Enc28J60Network_send return false\r\n"); +#endif return false; sendandfree: enc28j60Eth.sendPacket(uipPacket); @@ -635,7 +638,7 @@ #ifdef UIPETHERNET_DEBUG_CHKSUM printf ( - "chksum uip_packet(%d)[%d-%d]: %d\r\n", uip_packet, UIP_IPH_LEN + + "chksum uipPacket(%d)[%d-%d]: %d\r\n", uipPacket, UIP_IPH_LEN + UIP_LLH_LEN + upper_layer_memlen, UIP_IPH_LEN + UIP_LLH_LEN +