Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit d9421dc

Browse files
authored
v1.2.0 to add common code to library
#### Releases v1.2.0 1. Add common code to library 2. Renew examples
1 parent 155a729 commit d9421dc

File tree

31 files changed

+204
-1375
lines changed

31 files changed

+204
-1375
lines changed

README.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [Features](#features)
1616
* [Currently supported Boards](#currently-supported-boards)
1717
* [Changelog](#changelog)
18+
* [Releases v1.2.0](#releases-v120)
1819
* [Releases v1.1.0](#releases-v110)
1920
* [Releases v1.0.0](#releases-v100)
2021
* [Prerequisites](#prerequisites)
@@ -130,6 +131,11 @@ This [**WebServer_WT32_ETH01** library](https://github.com/khoih-prog/WebServer_
130131

131132
## Changelog
132133

134+
#### Releases v1.2.0
135+
136+
1. Add common code to library
137+
2. Renew examples
138+
133139
#### Releases v1.1.0
134140

135141
1. Add SSL support
@@ -666,7 +672,7 @@ The following are debug terminal output and screen shot when running example [Ad
666672
667673
```
668674
Starting AdvancedWebServer on ESP32_DEV with ETH_PHY_LAN8720
669-
WebServer_WT32_ETH01 v1.1.0
675+
WebServer_WT32_ETH01 v1.2.0
670676

671677
ETH Started
672678
ETH Connected
@@ -684,7 +690,7 @@ The terminal output of **WT32_ETH01** running [ESP32_FS_EthernetWebServer](examp
684690
685691
```cpp
686692
Starting ESP32_FS_EthernetWebServer on ESP32_DEV with ETH_PHY_LAN8720
687-
WebServer_WT32_ETH01 v1.1.0
693+
WebServer_WT32_ETH01 v1.2.0
688694
689695
ETH Started
690696
ETH Connected
@@ -734,7 +740,7 @@ The terminal output of **WT32_ETH01** running [MQTT_ThingStream example](example
734740

735741
```
736742
Starting MQTT_ThingStream on ESP32_DEV with ETH_PHY_LAN8720
737-
WebServer_WT32_ETH01 v1.1.0
743+
WebServer_WT32_ETH01 v1.2.0
738744
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
739745
***************************************
740746
esp32-sniffer/12345678/ble
@@ -758,7 +764,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_Auth example](examples
758764

759765
```
760766
Starting MQTTClient_Auth on ESP32_DEV with ETH_PHY_LAN8720
761-
WebServer_WT32_ETH01 v1.1.0
767+
WebServer_WT32_ETH01 v1.2.0
762768
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
763769
Attempting MQTT connection to broker.emqx.io...connected
764770
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on WT32-ETH01 with ETH_PHY_LAN8720
@@ -775,7 +781,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_Basic example](example
775781

776782
```
777783
Starting MQTTClient_Basic on ESP32_DEV with ETH_PHY_LAN8720
778-
WebServer_WT32_ETH01 v1.1.0
784+
WebServer_WT32_ETH01 v1.2.0
779785
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
780786
Attempting MQTT connection to broker.emqx.io...connected
781787
Message Send : MQTT_Pub => Hello from MQTTClient_Basic on WT32-ETH01 with ETH_PHY_LAN8720
@@ -795,7 +801,7 @@ The terminal output of **WT32_ETH01** running [WebClient example](examples/WebCl
795801

796802
```
797803
Starting WebClient on ESP32_DEV with ETH_PHY_LAN8720
798-
WebServer_WT32_ETH01 v1.1.0
804+
WebServer_WT32_ETH01 v1.2.0
799805
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
800806
801807
Starting connection to server...
@@ -863,7 +869,7 @@ The terminal output of **WT32_ETH01** running [UdpNTPClient example](examples/Ud
863869

864870
```
865871
Starting UdpNTPClient on ESP32_DEV with ETH_PHY_LAN8720
866-
WebServer_WT32_ETH01 v1.1.0
872+
WebServer_WT32_ETH01 v1.2.0
867873
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
868874
UDP Packet received, size 48
869875
From 132.163.97.1, port 123
@@ -892,7 +898,7 @@ The terminal output of **WT32_ETH01** running [BasicHttpClient example](examples
892898

893899
```
894900
Starting BasicHttpClient on ESP32_DEV with ETH_PHY_LAN8720
895-
WebServer_WT32_ETH01 v1.1.0
901+
WebServer_WT32_ETH01 v1.2.0
896902
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
897903
[HTTP] begin...
898904
[HTTP] GET...
@@ -954,7 +960,7 @@ The terminal output of **WT32_ETH01** running [BasicHttpsClient example](example
954960

955961
```
956962
Starting BasicHttpsClient on ESP32_DEV with ETH_PHY_LAN8720
957-
WebServer_WT32_ETH01 v1.1.0
963+
WebServer_WT32_ETH01 v1.2.0
958964
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
959965
Waiting for NTP time sync: .
960966
Current time: Tue Jul 6 05:29:39 2021
@@ -999,7 +1005,7 @@ The terminal output of **WT32_ETH01** running [WebClientMulti_SSL example](examp
9991005

10001006
```
10011007
Starting WebClientMulti_SSL on ESP32_DEV with ETH_PHY_LAN8720
1002-
WebServer_WT32_ETH01 v1.1.0
1008+
WebServer_WT32_ETH01 v1.2.0
10031009
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
10041010
Waiting for NTP time sync: .
10051011
Current time: Tue Jul 6 19:58:27 2021
@@ -1113,7 +1119,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL_Complex example](e
11131119

11141120
```
11151121
Starting MQTTClient_SSL_Complex on ESP32_DEV with ETH_PHY_LAN8720
1116-
WebServer_WT32_ETH01 v1.1.0
1122+
WebServer_WT32_ETH01 v1.2.0
11171123
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
11181124
Waiting for NTP time sync: .
11191125
Current time: Tue Jul 6 18:14:02 2021
@@ -1133,7 +1139,7 @@ The terminal output of **WT32_ETH01** running [MQTTS_ThingStream example](exampl
11331139

11341140
```
11351141
Starting MQTTS_ThingStream on ESP32_DEV with ETH_PHY_LAN8720
1136-
WebServer_WT32_ETH01 v1.1.0
1142+
WebServer_WT32_ETH01 v1.2.0
11371143
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
11381144
Waiting for NTP time sync: .
11391145
Current time: Tue Jul 6 18:38:22 2021
@@ -1159,7 +1165,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL example](examples/
11591165

11601166
```
11611167
Starting MQTTClient_SSL on ESP32_DEV with ETH_PHY_LAN8720
1162-
WebServer_WT32_ETH01 v1.1.0
1168+
WebServer_WT32_ETH01 v1.2.0
11631169
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
11641170
Waiting for NTP time sync: .
11651171
Current time: Tue Jul 6 17:11:00 2021
@@ -1184,7 +1190,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL_Auth example](exam
11841190

11851191
```
11861192
Starting MQTTClient_SSL_Auth on ESP32_DEV with ETH_PHY_LAN8720
1187-
WebServer_WT32_ETH01 v1.1.0
1193+
WebServer_WT32_ETH01 v1.2.0
11881194
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
11891195
Waiting for NTP time sync: .
11901196
Current time: Tue Jul 6 18:05:14 2021
@@ -1227,6 +1233,11 @@ If you get compilation errors, more often than not, you may need to install a ne
12271233

12281234
## Releases
12291235

1236+
#### Releases v1.2.0
1237+
1238+
1. Add common code to library
1239+
2. Renew examples
1240+
12301241
#### Releases v1.1.0
12311242

12321243
1. Add SSL support

examples/HTTPClient/Authorization/Authorization.ino

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -26,57 +26,6 @@ IPAddress mySN(255, 255, 255, 0);
2626
// Google DNS Server IP
2727
IPAddress myDNS(8, 8, 8, 8);
2828

29-
bool eth_connected = false;
30-
31-
void WiFiEvent(WiFiEvent_t event)
32-
{
33-
switch (event)
34-
{
35-
case SYSTEM_EVENT_ETH_START:
36-
Serial.println("\nETH Started");
37-
//set eth hostname here
38-
ETH.setHostname("WT32-ETH01");
39-
break;
40-
case SYSTEM_EVENT_ETH_CONNECTED:
41-
Serial.println("ETH Connected");
42-
break;
43-
44-
case SYSTEM_EVENT_ETH_GOT_IP:
45-
if (!eth_connected)
46-
{
47-
Serial.print("ETH MAC: ");
48-
Serial.print(ETH.macAddress());
49-
Serial.print(", IPv4: ");
50-
Serial.print(ETH.localIP());
51-
52-
if (ETH.fullDuplex())
53-
{
54-
Serial.print(", FULL_DUPLEX");
55-
}
56-
57-
Serial.print(", ");
58-
Serial.print(ETH.linkSpeed());
59-
Serial.println("Mbps");
60-
eth_connected = true;
61-
}
62-
63-
break;
64-
65-
case SYSTEM_EVENT_ETH_DISCONNECTED:
66-
Serial.println("ETH Disconnected");
67-
eth_connected = false;
68-
break;
69-
70-
case SYSTEM_EVENT_ETH_STOP:
71-
Serial.println("\nETH Stopped");
72-
eth_connected = false;
73-
break;
74-
75-
default:
76-
break;
77-
}
78-
}
79-
8029
void setup()
8130
{
8231
Serial.begin(115200);
@@ -98,15 +47,14 @@ void setup()
9847
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
9948
ETH.config(myIP, myGW, mySN, myDNS);
10049

101-
WiFi.onEvent(WiFiEvent);
50+
WT32_ETH01_onEvent();
10251

103-
while (!eth_connected)
104-
delay(100);
52+
WT32_ETH01_waitForConnect();
10553
}
10654

10755
void loop()
10856
{
109-
if (eth_connected)
57+
if (WT32_ETH01_isConnected())
11058
{
11159
HTTPClient http;
11260

examples/HTTPClient/BasicHttpClient/BasicHttpClient.ino

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -26,57 +26,6 @@ IPAddress mySN(255, 255, 255, 0);
2626
// Google DNS Server IP
2727
IPAddress myDNS(8, 8, 8, 8);
2828

29-
bool eth_connected = false;
30-
31-
void WiFiEvent(WiFiEvent_t event)
32-
{
33-
switch (event)
34-
{
35-
case SYSTEM_EVENT_ETH_START:
36-
Serial.println("\nETH Started");
37-
//set eth hostname here
38-
ETH.setHostname("WT32-ETH01");
39-
break;
40-
case SYSTEM_EVENT_ETH_CONNECTED:
41-
Serial.println("ETH Connected");
42-
break;
43-
44-
case SYSTEM_EVENT_ETH_GOT_IP:
45-
if (!eth_connected)
46-
{
47-
Serial.print("ETH MAC: ");
48-
Serial.print(ETH.macAddress());
49-
Serial.print(", IPv4: ");
50-
Serial.print(ETH.localIP());
51-
52-
if (ETH.fullDuplex())
53-
{
54-
Serial.print(", FULL_DUPLEX");
55-
}
56-
57-
Serial.print(", ");
58-
Serial.print(ETH.linkSpeed());
59-
Serial.println("Mbps");
60-
eth_connected = true;
61-
}
62-
63-
break;
64-
65-
case SYSTEM_EVENT_ETH_DISCONNECTED:
66-
Serial.println("ETH Disconnected");
67-
eth_connected = false;
68-
break;
69-
70-
case SYSTEM_EVENT_ETH_STOP:
71-
Serial.println("\nETH Stopped");
72-
eth_connected = false;
73-
break;
74-
75-
default:
76-
break;
77-
}
78-
}
79-
8029
void setup()
8130
{
8231
Serial.begin(115200);
@@ -98,15 +47,14 @@ void setup()
9847
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
9948
ETH.config(myIP, myGW, mySN, myDNS);
10049

101-
WiFi.onEvent(WiFiEvent);
50+
WT32_ETH01_onEvent();
10251

103-
while (!eth_connected)
104-
delay(100);
52+
WT32_ETH01_waitForConnect();
10553
}
10654

10755
void loop()
10856
{
109-
if (eth_connected)
57+
if (WT32_ETH01_isConnected())
11058
{
11159
HTTPClient http;
11260

examples/HTTPClient/BasicHttpsClient/BasicHttpsClient.ino

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ IPAddress mySN(255, 255, 255, 0);
2828
// Google DNS Server IP
2929
IPAddress myDNS(8, 8, 8, 8);
3030

31-
bool eth_connected = false;
32-
3331
// This is GandiStandardSSLCA2.pem, the root Certificate Authority that signed
3432
// the server certifcate for the demo server https://jigsaw.w3.org in this
3533
// example. This certificate is valid until Sep 11 23:59:59 2024 GMT
@@ -93,55 +91,6 @@ void setClock()
9391
Serial.print(asctime(&timeinfo));
9492
}
9593

96-
void WiFiEvent(WiFiEvent_t event)
97-
{
98-
switch (event)
99-
{
100-
case SYSTEM_EVENT_ETH_START:
101-
Serial.println("\nETH Started");
102-
//set eth hostname here
103-
ETH.setHostname("WT32-ETH01");
104-
break;
105-
case SYSTEM_EVENT_ETH_CONNECTED:
106-
Serial.println("ETH Connected");
107-
break;
108-
109-
case SYSTEM_EVENT_ETH_GOT_IP:
110-
if (!eth_connected)
111-
{
112-
Serial.print("ETH MAC: ");
113-
Serial.print(ETH.macAddress());
114-
Serial.print(", IPv4: ");
115-
Serial.print(ETH.localIP());
116-
117-
if (ETH.fullDuplex())
118-
{
119-
Serial.print(", FULL_DUPLEX");
120-
}
121-
122-
Serial.print(", ");
123-
Serial.print(ETH.linkSpeed());
124-
Serial.println("Mbps");
125-
eth_connected = true;
126-
}
127-
128-
break;
129-
130-
case SYSTEM_EVENT_ETH_DISCONNECTED:
131-
Serial.println("ETH Disconnected");
132-
eth_connected = false;
133-
break;
134-
135-
case SYSTEM_EVENT_ETH_STOP:
136-
Serial.println("\nETH Stopped");
137-
eth_connected = false;
138-
break;
139-
140-
default:
141-
break;
142-
}
143-
}
144-
14594
void setup()
14695
{
14796
Serial.begin(115200);
@@ -163,17 +112,16 @@ void setup()
163112
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
164113
ETH.config(myIP, myGW, mySN, myDNS);
165114

166-
WiFi.onEvent(WiFiEvent);
115+
WT32_ETH01_onEvent();
167116

168-
while (!eth_connected)
169-
delay(100);
117+
WT32_ETH01_waitForConnect();
170118

171119
setClock();
172120
}
173121

174122
void loop()
175123
{
176-
if (eth_connected)
124+
if (WT32_ETH01_isConnected())
177125
{
178126
WiFiClientSecure *client = new WiFiClientSecure;
179127

0 commit comments

Comments
 (0)