Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
Update README.md and use allman astyle
Browse files Browse the repository at this point in the history
  • Loading branch information
khoih-prog committed Nov 24, 2022
1 parent abb235e commit 8db69d3
Show file tree
Hide file tree
Showing 21 changed files with 293 additions and 164 deletions.
27 changes: 24 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,45 @@ 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. ...
2. ...
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
```


8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -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)


<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
<a href="https://profile-counter.glitch.me/khoih-prog/count.svg" title="Total khoih-prog Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog/count.svg" style="height: 30px;width: 200px;"></a>
<a href="https://profile-counter.glitch.me/khoih-prog-AsyncUDP_Ethernet/count.svg" title="AsyncUDP_Ethernet Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-AsyncUDP_Ethernet/count.svg" style="height: 30px;width: 200px;"></a>

---
---

Expand Down
40 changes: 22 additions & 18 deletions examples/AsyncUDPClient/AsyncUDPClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
*****************************************************************************************************************************/
Expand All @@ -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);
}

Expand Down Expand Up @@ -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");
Expand Down
18 changes: 9 additions & 9 deletions examples/AsyncUDPClient/defines.h
Original file line number Diff line number Diff line change
@@ -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
*****************************************************************************************************************************/
Expand All @@ -17,7 +17,7 @@
#define LED_OFF HIGH
#else
#error Only ESP8266
#endif
#endif

#define _AWS_ETHERNET_LOGLEVEL_ 1

Expand All @@ -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 <W5100lwIP.h>
#define SHIELD_TYPE "ESP8266_W5100 Ethernet"

Wiznet5100lwIP eth(CSPIN);

#elif USING_ENC28J60
#include <ENC28J60lwIP.h>
#define SHIELD_TYPE "ESP8266_ENC28J60 Ethernet"

ENC28J60lwIP eth(CSPIN);
#else
// default if none selected
Expand Down
41 changes: 22 additions & 19 deletions examples/AsyncUDPMulticastServer/AsyncUDPMulticastServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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?");
}
Expand Down Expand Up @@ -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();
Expand Down
18 changes: 9 additions & 9 deletions examples/AsyncUDPMulticastServer/defines.h
Original file line number Diff line number Diff line change
@@ -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
*****************************************************************************************************************************/
Expand All @@ -17,7 +17,7 @@
#define LED_OFF HIGH
#else
#error Only ESP8266
#endif
#endif

#define _AWS_ETHERNET_LOGLEVEL_ 1

Expand All @@ -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 <W5100lwIP.h>
#define SHIELD_TYPE "ESP8266_W5100 Ethernet"

Wiznet5100lwIP eth(CSPIN);

#elif USING_ENC28J60
#include <ENC28J60lwIP.h>
#define SHIELD_TYPE "ESP8266_ENC28J60 Ethernet"

ENC28J60lwIP eth(CSPIN);
#else
// default if none selected
Expand Down
7 changes: 5 additions & 2 deletions examples/AsyncUDPServer/AsyncUDPServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 8db69d3

Please sign in to comment.