diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bbe3abb..0fc807a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -30,10 +30,10 @@ Arduino IDE version: 1.8.19
ESP8266_NODEMCU_ESP12E using ESP8266_W5500 Ethernet
ESP8266 core v3.0.2
OS: Ubuntu 20.04 LTS
-Linux xy-Inspiron-3593 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
+Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Context:
-I encountered an endless loop while trying to connect to Local WiFi.
+I encountered a crash while using this library
Steps to reproduce:
1. ...
@@ -41,13 +41,34 @@ Steps to reproduce:
3. ...
4. ...
```
+
+---
+
### Sending Feature Requests
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
-There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/AsyncUDP_Ethernet/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
+There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/RP2040_PWM/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
+
+---
### Sending Pull Requests
Pull Requests with changes and fixes are also welcome!
+Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
+
+1. Change directory to the library GitHub
+
+```
+xy@xy-Inspiron-3593:~$ cd Arduino/xy/RP2040_PWM_GitHub/
+xy@xy-Inspiron-3593:~/Arduino/xy/RP2040_PWM_GitHub$
+```
+
+2. Issue astyle command
+
+```
+xy@xy-Inspiron-3593:~/Arduino/xy/RP2040_PWM_GitHub$ bash utils/restyle.sh
+```
+
+
diff --git a/changelog.md b/changelog.md
index 68ab0d1..7bccb17 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,10 +1,16 @@
-# AsyncUDP_Ethernet
+# AsyncUDP_Ethernet Library
[![arduino-library-badge](https://www.ardu-badge.com/badge/AsyncUDP_Ethernet.svg?)](https://www.ardu-badge.com/AsyncUDP_Ethernet)
[![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncUDP_Ethernet.svg)](https://github.com/khoih-prog/AsyncUDP_Ethernet/releases)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/AsyncUDP_Ethernet.svg)](http://github.com/khoih-prog/AsyncUDP_Ethernet/issues)
+
+
+
+
+
+
---
---
diff --git a/examples/AsyncUDPClient/AsyncUDPClient.ino b/examples/AsyncUDPClient/AsyncUDPClient.ino
index 20158af..375dcc1 100644
--- a/examples/AsyncUDPClient/AsyncUDPClient.ino
+++ b/examples/AsyncUDPClient/AsyncUDPClient.ino
@@ -2,9 +2,9 @@
Async_UdpClient.ino
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -28,13 +28,13 @@ AsyncUDP udp;
void sendRequest();
// Repeat forever, millis() resolution
-//Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
+//Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
Ticker sendUDPRequest;
void sendRequest()
{
UDP_LOGDEBUG1("Send broadcastTo port ", UDP_REMOTE_PORT);
-
+
udp.broadcastTo("Anyone here?", UDP_REMOTE_PORT);
}
@@ -69,52 +69,56 @@ void initEthernet()
#if !USING_DHCP
eth.config(localIP, gateway, netMask, gateway);
#endif
-
+
eth.setDefault();
-
- if (!eth.begin())
+
+ if (!eth.begin())
{
Serial.println("No Ethernet hardware ... Stop here");
-
- while (true)
+
+ while (true)
{
delay(1000);
}
- }
- else
+ }
+ else
{
Serial.print("Connecting to network : ");
-
- while (!eth.connected())
+
+ while (!eth.connected())
{
Serial.print(".");
delay(1000);
}
}
-
+
Serial.println();
-#if USING_DHCP
+#if USING_DHCP
Serial.print("Ethernet DHCP IP address: ");
#else
Serial.print("Ethernet Static IP address: ");
#endif
-
+
Serial.println(eth.localIP());
}
void setup()
{
Serial.begin(115200);
+
while (!Serial && millis() < 5000);
delay(200);
- Serial.print("\nStart Async_UDPClient on "); Serial.print(BOARD_NAME);
- Serial.print(" with "); Serial.println(SHIELD_TYPE);
+ Serial.print("\nStart Async_UDPClient on ");
+ Serial.print(BOARD_NAME);
+ Serial.print(" with ");
+ Serial.println(SHIELD_TYPE);
Serial.println(ASYNC_UDP_ETHERNET_VERSION);
initEthernet();
+
if (udp.connect(remoteIPAddress, UDP_REMOTE_PORT))
{
Serial.println("UDP connected");
diff --git a/examples/AsyncUDPClient/defines.h b/examples/AsyncUDPClient/defines.h
index 6e50134..0dfb546 100644
--- a/examples/AsyncUDPClient/defines.h
+++ b/examples/AsyncUDPClient/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -17,7 +17,7 @@
#define LED_OFF HIGH
#else
#error Only ESP8266
-#endif
+#endif
#define _AWS_ETHERNET_LOGLEVEL_ 1
@@ -34,19 +34,19 @@
#if USING_W5500
#include "W5500lwIP.h"
#define SHIELD_TYPE "ESP8266_W5500 Ethernet"
-
- Wiznet5500lwIP eth(CSPIN);
-
+
+ Wiznet5500lwIP eth(CSPIN);
+
#elif USING_W5100
#include
#define SHIELD_TYPE "ESP8266_W5100 Ethernet"
-
+
Wiznet5100lwIP eth(CSPIN);
#elif USING_ENC28J60
#include
#define SHIELD_TYPE "ESP8266_ENC28J60 Ethernet"
-
+
ENC28J60lwIP eth(CSPIN);
#else
// default if none selected
diff --git a/examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino b/examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino
index 6789a19..9357981 100644
--- a/examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino
+++ b/examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino
@@ -2,13 +2,13 @@
AsyncUDPMulticastServer.ino
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
-
+
#include "defines.h"
#define ASYNC_UDP_ETHERNET_VERSION_MIN_TARGET "AsyncUDP_Ethernet v1.2.1"
@@ -24,13 +24,13 @@ AsyncUDP udp;
void sendRequest();
// Repeat forever, millis() resolution
-//Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
+//Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
Ticker sendUDPRequest;
void sendRequest()
{
UDP_LOGDEBUG("Send multicast");
-
+
//Send multicast
udp.print("Anyone here?");
}
@@ -66,49 +66,52 @@ void initEthernet()
#if !USING_DHCP
eth.config(localIP, gateway, netMask, gateway);
#endif
-
+
eth.setDefault();
-
- if (!eth.begin())
+
+ if (!eth.begin())
{
Serial.println("No Ethernet hardware ... Stop here");
-
- while (true)
+
+ while (true)
{
delay(1000);
}
- }
- else
+ }
+ else
{
Serial.print("Connecting to network : ");
-
- while (!eth.connected())
+
+ while (!eth.connected())
{
Serial.print(".");
delay(1000);
}
}
-
+
Serial.println();
-#if USING_DHCP
+#if USING_DHCP
Serial.print("Ethernet DHCP IP address: ");
#else
Serial.print("Ethernet Static IP address: ");
#endif
-
+
Serial.println(eth.localIP());
}
void setup()
{
Serial.begin(115200);
+
while (!Serial && millis() < 5000);
delay(200);
- Serial.print("\nStart AsyncUDPMulticastServer on "); Serial.print(BOARD_NAME);
- Serial.print(" with "); Serial.println(SHIELD_TYPE);
+ Serial.print("\nStart AsyncUDPMulticastServer on ");
+ Serial.print(BOARD_NAME);
+ Serial.print(" with ");
+ Serial.println(SHIELD_TYPE);
Serial.println(ASYNC_UDP_ETHERNET_VERSION);
initEthernet();
diff --git a/examples/AsyncUDPMulticastServer/defines.h b/examples/AsyncUDPMulticastServer/defines.h
index 6e50134..0dfb546 100644
--- a/examples/AsyncUDPMulticastServer/defines.h
+++ b/examples/AsyncUDPMulticastServer/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -17,7 +17,7 @@
#define LED_OFF HIGH
#else
#error Only ESP8266
-#endif
+#endif
#define _AWS_ETHERNET_LOGLEVEL_ 1
@@ -34,19 +34,19 @@
#if USING_W5500
#include "W5500lwIP.h"
#define SHIELD_TYPE "ESP8266_W5500 Ethernet"
-
- Wiznet5500lwIP eth(CSPIN);
-
+
+ Wiznet5500lwIP eth(CSPIN);
+
#elif USING_W5100
#include
#define SHIELD_TYPE "ESP8266_W5100 Ethernet"
-
+
Wiznet5100lwIP eth(CSPIN);
#elif USING_ENC28J60
#include
#define SHIELD_TYPE "ESP8266_ENC28J60 Ethernet"
-
+
ENC28J60lwIP eth(CSPIN);
#else
// default if none selected
diff --git a/examples/AsyncUDPServer/AsyncUDPServer.ino b/examples/AsyncUDPServer/AsyncUDPServer.ino
index c5d8457..0f9a7d3 100644
--- a/examples/AsyncUDPServer/AsyncUDPServer.ino
+++ b/examples/AsyncUDPServer/AsyncUDPServer.ino
@@ -81,12 +81,15 @@ void initEthernet()
void setup()
{
Serial.begin(115200);
+
while (!Serial && millis() < 5000);
delay(200);
- Serial.print("\nStart AsyncUDPServer on "); Serial.print(BOARD_NAME);
- Serial.print(" with "); Serial.println(SHIELD_TYPE);
+ Serial.print("\nStart AsyncUDPServer on ");
+ Serial.print(BOARD_NAME);
+ Serial.print(" with ");
+ Serial.println(SHIELD_TYPE);
Serial.println(ASYNC_UDP_ETHERNET_VERSION);
initEthernet();
diff --git a/examples/AsyncUDPServer/defines.h b/examples/AsyncUDPServer/defines.h
index 6e50134..0dfb546 100644
--- a/examples/AsyncUDPServer/defines.h
+++ b/examples/AsyncUDPServer/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -17,7 +17,7 @@
#define LED_OFF HIGH
#else
#error Only ESP8266
-#endif
+#endif
#define _AWS_ETHERNET_LOGLEVEL_ 1
@@ -34,19 +34,19 @@
#if USING_W5500
#include "W5500lwIP.h"
#define SHIELD_TYPE "ESP8266_W5500 Ethernet"
-
- Wiznet5500lwIP eth(CSPIN);
-
+
+ Wiznet5500lwIP eth(CSPIN);
+
#elif USING_W5100
#include
#define SHIELD_TYPE "ESP8266_W5100 Ethernet"
-
+
Wiznet5100lwIP eth(CSPIN);
#elif USING_ENC28J60
#include
#define SHIELD_TYPE "ESP8266_ENC28J60 Ethernet"
-
+
ENC28J60lwIP eth(CSPIN);
#else
// default if none selected
diff --git a/examples/AsyncUdpNTPClient/AsyncUdpNTPClient.ino b/examples/AsyncUdpNTPClient/AsyncUdpNTPClient.ino
index 8c58bc9..f9f88da 100644
--- a/examples/AsyncUdpNTPClient/AsyncUdpNTPClient.ino
+++ b/examples/AsyncUdpNTPClient/AsyncUdpNTPClient.ino
@@ -70,11 +70,16 @@ void parsePacket(AsyncUDPPacket packet)
Serial.print("Received UDP Packet Type: ");
Serial.println(packet.isBroadcast() ? "Broadcast" : packet.isMulticast() ? "Multicast" : "Unicast");
- Serial.print("From: "); Serial.print(packet.remoteIP());
- Serial.print(":"); Serial.print(packet.remotePort());
- Serial.print(", To: "); Serial.print(packet.localIP());
- Serial.print(":"); Serial.print(packet.localPort());
- Serial.print(", Length: "); Serial.print(packet.length());
+ Serial.print("From: ");
+ Serial.print(packet.remoteIP());
+ Serial.print(":");
+ Serial.print(packet.remotePort());
+ Serial.print(", To: ");
+ Serial.print(packet.localIP());
+ Serial.print(":");
+ Serial.print(packet.localPort());
+ Serial.print(", Length: ");
+ Serial.print(packet.length());
Serial.println();
unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
@@ -162,19 +167,22 @@ void initEthernet()
void setup()
{
Serial.begin(115200);
+
while (!Serial && millis() < 5000);
delay(200);
- Serial.print("\nStart AsyncUdpNTPClient on "); Serial.print(BOARD_NAME);
- Serial.print(" with "); Serial.println(SHIELD_TYPE);
+ Serial.print("\nStart AsyncUdpNTPClient on ");
+ Serial.print(BOARD_NAME);
+ Serial.print(" with ");
+ Serial.println(SHIELD_TYPE);
Serial.println(ASYNC_UDP_ETHERNET_VERSION);
initEthernet();
//NTP requests are to port NTP_REQUEST_PORT = 123
if (Udp.connect(timeServerIP, NTP_REQUEST_PORT))
- //if (Udp.connect(timeServer, NTP_REQUEST_PORT))
+ //if (Udp.connect(timeServer, NTP_REQUEST_PORT))
{
Serial.println("UDP connected");
diff --git a/examples/AsyncUdpNTPClient/defines.h b/examples/AsyncUdpNTPClient/defines.h
index 6e50134..0dfb546 100644
--- a/examples/AsyncUdpNTPClient/defines.h
+++ b/examples/AsyncUdpNTPClient/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -17,7 +17,7 @@
#define LED_OFF HIGH
#else
#error Only ESP8266
-#endif
+#endif
#define _AWS_ETHERNET_LOGLEVEL_ 1
@@ -34,19 +34,19 @@
#if USING_W5500
#include "W5500lwIP.h"
#define SHIELD_TYPE "ESP8266_W5500 Ethernet"
-
- Wiznet5500lwIP eth(CSPIN);
-
+
+ Wiznet5500lwIP eth(CSPIN);
+
#elif USING_W5100
#include
#define SHIELD_TYPE "ESP8266_W5100 Ethernet"
-
+
Wiznet5100lwIP eth(CSPIN);
#elif USING_ENC28J60
#include
#define SHIELD_TYPE "ESP8266_ENC28J60 Ethernet"
-
+
ENC28J60lwIP eth(CSPIN);
#else
// default if none selected
diff --git a/examples/AsyncUdpSendReceive/AsyncUdpSendReceive.ino b/examples/AsyncUdpSendReceive/AsyncUdpSendReceive.ino
index 7a0f284..3ad4eb9 100644
--- a/examples/AsyncUdpSendReceive/AsyncUdpSendReceive.ino
+++ b/examples/AsyncUdpSendReceive/AsyncUdpSendReceive.ino
@@ -2,9 +2,9 @@
AsyncUDPSendReceive.ino
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -36,13 +36,13 @@ AsyncUDP Udp;
void sendRequest();
// Repeat forever, millis() resolution
-//Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
+//Ticker sendUDPRequest(sendRequest, UDP_REQUEST_INTERVAL_MS, 0, MILLIS);
Ticker sendUDPRequest;
void sendACKPacket()
{
Serial.println("============= sendACKPacket =============");
-
+
// Send unicast ACK to the same remoteIP and remotePort we received the packet
// The AsyncUDP_STM32 library will take care of the correct IP and port based on pcb
Udp.write((uint8_t *) ReplyBuffer, sizeof(ReplyBuffer));
@@ -62,7 +62,7 @@ void createNTPpacket()
packetBuffer[1] = 0; // Stratum, or type of clock
packetBuffer[2] = 6; // Polling Interval
packetBuffer[3] = 0xEC; // Peer Clock Precision
-
+
// 8 bytes of zero for Root Delay & Root Dispersion
packetBuffer[12] = 49;
packetBuffer[13] = 0x4E;
@@ -81,7 +81,7 @@ void parsePacket(AsyncUDPPacket packet)
{
struct tm ts;
char buf[80];
-
+
memcpy(packetBuffer, packet.data(), sizeof(packetBuffer));
Serial.print("Received UDP Packet Type: ");
@@ -104,20 +104,20 @@ void parsePacket(AsyncUDPPacket packet)
// combine the four bytes (two words) into a long integer
// this is NTP time (seconds since Jan 1 1900):
unsigned long secsSince1900 = highWord << 16 | lowWord;
-
+
Serial.print(F("Seconds since Jan 1 1900 = "));
Serial.println(secsSince1900);
// now convert NTP time into )everyday time:
Serial.print(F("Epoch/Unix time = "));
-
+
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
const unsigned long seventyYears = 2208988800UL;
-
+
// subtract seventy years:
unsigned long epoch = secsSince1900 - seventyYears;
time_t epoch_t = epoch; //secsSince1900 - seventyYears;
-
+
// print Unix time:
Serial.println(epoch);
@@ -142,49 +142,52 @@ void initEthernet()
#if !USING_DHCP
eth.config(localIP, gateway, netMask, gateway);
#endif
-
+
eth.setDefault();
-
- if (!eth.begin())
+
+ if (!eth.begin())
{
Serial.println("No Ethernet hardware ... Stop here");
-
- while (true)
+
+ while (true)
{
delay(1000);
}
- }
- else
+ }
+ else
{
Serial.print("Connecting to network : ");
-
- while (!eth.connected())
+
+ while (!eth.connected())
{
Serial.print(".");
delay(1000);
}
}
-
+
Serial.println();
-#if USING_DHCP
+#if USING_DHCP
Serial.print("Ethernet DHCP IP address: ");
#else
Serial.print("Ethernet Static IP address: ");
#endif
-
+
Serial.println(eth.localIP());
}
void setup()
{
Serial.begin(115200);
+
while (!Serial && millis() < 5000);
delay(200);
- Serial.print("\nStart AsyncUDPSendReceive on "); Serial.print(BOARD_NAME);
- Serial.print(" with "); Serial.println(SHIELD_TYPE);
+ Serial.print("\nStart AsyncUDPSendReceive on ");
+ Serial.print(BOARD_NAME);
+ Serial.print(" with ");
+ Serial.println(SHIELD_TYPE);
Serial.println(ASYNC_UDP_ETHERNET_VERSION);
initEthernet();
diff --git a/examples/AsyncUdpSendReceive/defines.h b/examples/AsyncUdpSendReceive/defines.h
index 6e50134..0dfb546 100644
--- a/examples/AsyncUdpSendReceive/defines.h
+++ b/examples/AsyncUdpSendReceive/defines.h
@@ -1,10 +1,10 @@
/****************************************************************************************************************************
defines.h
-
+
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -17,7 +17,7 @@
#define LED_OFF HIGH
#else
#error Only ESP8266
-#endif
+#endif
#define _AWS_ETHERNET_LOGLEVEL_ 1
@@ -34,19 +34,19 @@
#if USING_W5500
#include "W5500lwIP.h"
#define SHIELD_TYPE "ESP8266_W5500 Ethernet"
-
- Wiznet5500lwIP eth(CSPIN);
-
+
+ Wiznet5500lwIP eth(CSPIN);
+
#elif USING_W5100
#include
#define SHIELD_TYPE "ESP8266_W5100 Ethernet"
-
+
Wiznet5100lwIP eth(CSPIN);
#elif USING_ENC28J60
#include
#define SHIELD_TYPE "ESP8266_ENC28J60 Ethernet"
-
+
ENC28J60lwIP eth(CSPIN);
#else
// default if none selected
diff --git a/examples/multiFileProject/multiFileProject.cpp b/examples/multiFileProject/multiFileProject.cpp
index fdaea9b..0190f36 100644
--- a/examples/multiFileProject/multiFileProject.cpp
+++ b/examples/multiFileProject/multiFileProject.cpp
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.cpp
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -13,10 +13,10 @@
#include "multiFileProject.h"
#if USING_W5500
- Wiznet5500lwIP eth(CSPIN);
+ Wiznet5500lwIP eth(CSPIN);
#elif USING_W5100
Wiznet5100lwIP eth(CSPIN);
-#elif USING_ENC28J60
+#elif USING_ENC28J60
ENC28J60lwIP eth(CSPIN);
#else
// default if none selected
diff --git a/examples/multiFileProject/multiFileProject.h b/examples/multiFileProject/multiFileProject.h
index a87f9c5..daf5182 100644
--- a/examples/multiFileProject/multiFileProject.h
+++ b/examples/multiFileProject/multiFileProject.h
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.h
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -27,19 +27,19 @@
#if USING_W5500
#include "W5500lwIP.h"
#define SHIELD_TYPE "ESP8266_W5500 Ethernet"
-
- extern Wiznet5500lwIP eth;
-
+
+ extern Wiznet5500lwIP eth;
+
#elif USING_W5100
#include
#define SHIELD_TYPE "ESP8266_W5100 Ethernet"
-
+
extern Wiznet5100lwIP eth;
#elif USING_ENC28J60
#include
#define SHIELD_TYPE "ESP8266_ENC28J60 Ethernet"
-
+
extern ENC28J60lwIP eth;
#else
// default if none selected
diff --git a/examples/multiFileProject/multiFileProject.ino b/examples/multiFileProject/multiFileProject.ino
index 2353e91..4e7c6a2 100644
--- a/examples/multiFileProject/multiFileProject.ino
+++ b/examples/multiFileProject/multiFileProject.ino
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.ino
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
*****************************************************************************************************************************/
@@ -22,26 +22,29 @@
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include // https://github.com/khoih-prog/AsyncUDP_Ethernet
-void setup()
+void setup()
{
Serial.begin(115200);
+
while (!Serial && millis() < 5000);
-
+
Serial.println("\nStart multiFileProject");
Serial.println(ASYNC_UDP_ETHERNET_VERSION);
#if defined(ASYNC_UDP_ETHERNET_VERSION_MIN)
+
if (ASYNC_UDP_ETHERNET_VERSION_INT < ASYNC_UDP_ETHERNET_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(ASYNC_UDP_ETHERNET_VERSION_MIN_TARGET);
}
+
#endif
Serial.print("You're OK now");
}
-void loop()
+void loop()
{
// put your main code here, to run repeatedly:
}
diff --git a/platformio/platformio.ini b/platformio/platformio.ini
index c100d9e..43131e1 100644
--- a/platformio/platformio.ini
+++ b/platformio/platformio.ini
@@ -35,6 +35,8 @@ upload_speed = 921600
; Checks for the compatibility with frameworks and dev/platforms
lib_compat_mode = strict
+lib_ldf_mode = chain+
+;lib_ldf_mode = deep+
lib_deps =
; PlatformIO 4.x
diff --git a/src/AsyncUDP_Ethernet.h b/src/AsyncUDP_Ethernet.h
index 595beff..c405955 100644
--- a/src/AsyncUDP_Ethernet.h
+++ b/src/AsyncUDP_Ethernet.h
@@ -1,19 +1,19 @@
/****************************************************************************************************************************
AsyncUDP_Ethernet.h
-
+
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
-
+
Version: 1.2.1
-
+
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.1 K Hoang 15/04/2022 Initial coding for ESP8266 using W5x00/ENC8266 Ethernet.
- Bump up version to v1.2.1 to sync with AsyncUDP_STM32 v1.2.1
+ Bump up version to v1.2.1 to sync with AsyncUDP_STM32 v1.2.1
*****************************************************************************************************************************/
#pragma once
@@ -23,7 +23,7 @@
#if !defined(ESP8266)
#error This code is currently intended to run only on the ESP8266 platform
-#endif
+#endif
#define ASYNC_UDP_ETHERNET_VERSION "AsyncUDP_Ethernet v1.2.1"
@@ -37,15 +37,15 @@
#if defined(ESP8266)
#ifndef BOARD_NAME
- #if defined(ARDUINO_BOARD)
- #define BOARD_NAME ARDUINO_BOARD
- #else
- #define BOARD_NAME "ESP8266"
- #endif
+ #if defined(ARDUINO_BOARD)
+ #define BOARD_NAME ARDUINO_BOARD
+ #else
+ #define BOARD_NAME "ESP8266"
+ #endif
#endif
- #define EthernetInterface eth
-#endif // ESP8266
+ #define EthernetInterface eth
+#endif // ESP8266
////////////////////////////////////////////////////////////
diff --git a/src/AsyncUDP_Ethernet_Debug.h b/src/AsyncUDP_Ethernet_Debug.h
index d1bb3d8..ca4ae35 100644
--- a/src/AsyncUDP_Ethernet_Debug.h
+++ b/src/AsyncUDP_Ethernet_Debug.h
@@ -1,19 +1,19 @@
/****************************************************************************************************************************
AsyncUDP_Ethernet_Debug.h
-
+
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
-
+
Version: 1.2.1
-
+
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.1 K Hoang 15/04/2022 Initial coding for ESP8266 using W5x00/ENC8266 Ethernet.
- Bump up version to v1.2.1 to sync with AsyncUDP_STM32 v1.2.1
+ Bump up version to v1.2.1 to sync with AsyncUDP_STM32 v1.2.1
*****************************************************************************************************************************/
#pragma once
diff --git a/src/AsyncUDP_Ethernet_Impl.h b/src/AsyncUDP_Ethernet_Impl.h
index 56d6322..b8fcb20 100644
--- a/src/AsyncUDP_Ethernet_Impl.h
+++ b/src/AsyncUDP_Ethernet_Impl.h
@@ -1,19 +1,19 @@
/****************************************************************************************************************************
AsyncUdp_Impl_Ethernet.h
-
+
For ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
AsyncUDP_Ethernet is a Async UDP library for the ESP8266 with lwIP_5100, lwIP_5500 or lwIP_enc28j60 library
-
+
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/ASYNC_UDP_Ethernet
-
+
Version: 1.2.1
-
+
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.1 K Hoang 15/04/2022 Initial coding for ESP8266 using W5x00/ENC8266 Ethernet.
- Bump up version to v1.2.1 to sync with AsyncUDP_STM32 v1.2.1
+ Bump up version to v1.2.1 to sync with AsyncUDP_STM32 v1.2.1
*****************************************************************************************************************************/
#pragma once
@@ -295,9 +295,9 @@ void AsyncUDP::_recv(udp_pcb *upcb, pbuf *pb, ip_addr_t *addr, const uint16_t& p
////////////////////////////////////////////////////////////
#if LWIP_VERSION_MAJOR == 1
-void AsyncUDP::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, ip_addr_t *addr, uint16_t port)
+ void AsyncUDP::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, ip_addr_t *addr, uint16_t port)
#else
-void AsyncUDP::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port)
+ void AsyncUDP::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port)
#endif
{
reinterpret_cast(arg)->_recv(upcb, p, (ip_addr_t *)addr, port);
diff --git a/utils/astyle_library.conf b/utils/astyle_library.conf
new file mode 100644
index 0000000..8a73bc2
--- /dev/null
+++ b/utils/astyle_library.conf
@@ -0,0 +1,70 @@
+# Code formatting rules for Arduino libraries, modified from for KH libraries:
+#
+# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
+#
+
+# astyle --style=allman -s2 -t2 -C -S -xW -Y -M120 -f -p -xg -H -xb -c --xC120 -xL *.h *.cpp *.ino
+
+--mode=c
+--lineend=linux
+--style=allman
+
+# -r or -R
+#--recursive
+
+# -c => Converts tabs into spaces
+convert-tabs
+
+# -s2 => 2 spaces indentation
+--indent=spaces=2
+
+# -t2 => tab =2 spaces
+#--indent=tab=2
+
+# -C
+--indent-classes
+
+# -S
+--indent-switches
+
+# -xW
+--indent-preproc-block
+
+# -Y => indent classes, switches (and cases), comments starting at column 1
+--indent-col1-comments
+
+# -M120 => maximum of 120 spaces to indent a continuation line
+--max-continuation-indent=120
+
+# -xC120 => max‑code‑length will break a line if the code exceeds # characters
+--max-code-length=120
+
+# -f =>
+--break-blocks
+
+# -p => put a space around operators
+--pad-oper
+
+# -xg => Insert space padding after commas
+--pad-comma
+
+# -H => put a space after if/for/while
+pad-header
+
+# -xb => Break one line headers (e.g. if/for/while)
+--break-one-line-headers
+
+# -c => Converts tabs into spaces
+#--convert-tabs
+
+# if you like one-liners, keep them
+#keep-one-line-statements
+
+# -xV
+--attach-closing-while
+
+#unpad-paren
+
+# -xp
+remove-comment-prefix
+
diff --git a/utils/restyle.sh b/utils/restyle.sh
new file mode 100644
index 0000000..bcd846f
--- /dev/null
+++ b/utils/restyle.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+for dir in . ; do
+ find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.ino" \) -exec astyle --suffix=none --options=./utils/astyle_library.conf \{\} \;
+done
+