100100
101101#### Important notes
102102
103- ESP32 Core v2.0.0 introduces new enum breaking almost all ` WT32_ETH01 ` codes written for core v1.0.6-.
103+ ESP32 Core v2.0.0+ introduces new enum breaking almost all ` WT32_ETH01 ` codes written for core v1.0.6-.
104104
105105It's really strange to define a breaking enum ` arduino_event_id_t ` in [ ** WiFiGeneric.h** #L36-L78] ( https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/src/WiFiGeneric.h#L36-L78 ) , compared to the old ` system_event_id_t ` , now placed in [ ** esp_event_legacy.h** #L29-L63] ( https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/esp32/include/esp_event/include/esp_event_legacy.h#L29-L63 )
106106
@@ -115,7 +115,7 @@ To use with core v1.0.6-, just define in your sketch
115115#define USING_CORE_ESP32_CORE_V200_PLUS false
116116```
117117
118- - Releases v1.4.0 can be used for either ESP32 core v2.0.0+ or v1.0.6-. ** Autodetect core**
118+ - Releases v1.4.0+ can be used for either ESP32 core v2.0.0+ or v1.0.6-. ** Autodetect core**
119119
120120
121121#### Features
@@ -453,8 +453,6 @@ IPAddress mySN(255, 255, 255, 0);
453453// Google DNS Server IP
454454IPAddress myDNS(8, 8, 8, 8);
455455
456- bool eth_connected = false;
457-
458456int reqCount = 0; // number of requests received
459457
460458void handleRoot()
@@ -532,55 +530,6 @@ void drawGraph()
532530 server.send(200, F("image/svg+xml"), out);
533531}
534532
535- void WiFiEvent(WiFiEvent_t event)
536- {
537- switch (event)
538- {
539- case SYSTEM_EVENT_ETH_START:
540- Serial.println("\nETH Started");
541- //set eth hostname here
542- ETH.setHostname("WT32-ETH01");
543- break;
544- case SYSTEM_EVENT_ETH_CONNECTED:
545- Serial.println("ETH Connected");
546- break;
547-
548- case SYSTEM_EVENT_ETH_GOT_IP:
549- if (!eth_connected)
550- {
551- Serial.print("ETH MAC: ");
552- Serial.print(ETH.macAddress());
553- Serial.print(", IPv4: ");
554- Serial.print(ETH.localIP());
555-
556- if (ETH.fullDuplex())
557- {
558- Serial.print(", FULL_DUPLEX");
559- }
560-
561- Serial.print(", ");
562- Serial.print(ETH.linkSpeed());
563- Serial.println("Mbps");
564- eth_connected = true;
565- }
566-
567- break;
568-
569- case SYSTEM_EVENT_ETH_DISCONNECTED:
570- Serial.println("ETH Disconnected");
571- eth_connected = false;
572- break;
573-
574- case SYSTEM_EVENT_ETH_STOP:
575- Serial.println("\nETH Stopped");
576- eth_connected = false;
577- break;
578-
579- default:
580- break;
581- }
582- }
583-
584533void setup()
585534{
586535 Serial.begin(115200);
@@ -593,6 +542,9 @@ void setup()
593542 Serial.println(" with " + String(SHIELD_TYPE));
594543 Serial.println(WEBSERVER_WT32_ETH01_VERSION);
595544
545+ // To be called before ETH.begin()
546+ WT32_ETH01_onEvent();
547+
596548 //bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO,
597549 // eth_phy_type_t type=ETH_PHY_TYPE, eth_clock_mode_t clk_mode=ETH_CLK_MODE);
598550 //ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_TYPE, ETH_CLK_MODE);
@@ -602,10 +554,7 @@ void setup()
602554 //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
603555 ETH.config(myIP, myGW, mySN, myDNS);
604556
605- WiFi.onEvent(WiFiEvent);
606-
607- while (!eth_connected)
608- delay(100);
557+ WT32_ETH01_waitForConnect();
609558
610559 server.on(F("/"), handleRoot);
611560 server.on(F("/test.svg"), drawGraph);
@@ -674,7 +623,7 @@ The following are debug terminal output and screen shot when running example [Ad
674623
675624```
676625Starting AdvancedWebServer on ESP32_DEV with ETH_PHY_LAN8720
677- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
626+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
678627
679628ETH Started
680629ETH Connected
@@ -692,7 +641,7 @@ The terminal output of **WT32_ETH01** running [ESP32_FS_EthernetWebServer](examp
692641
693642```cpp
694643Starting ESP32_FS_EthernetWebServer on ESP32_DEV with ETH_PHY_LAN8720
695- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
644+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
696645
697646ETH Started
698647ETH Connected
@@ -742,7 +691,7 @@ The terminal output of **WT32_ETH01** running [MQTT_ThingStream example](example
742691
743692```
744693Starting MQTT_ThingStream on ESP32_DEV with ETH_PHY_LAN8720
745- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
694+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
746695ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
747696***************************************
748697esp32-sniffer/12345678/ble
@@ -766,7 +715,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_Auth example](examples
766715
767716```
768717Starting MQTTClient_Auth on ESP32_DEV with ETH_PHY_LAN8720
769- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
718+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
770719ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
771720Attempting MQTT connection to broker.emqx.io...connected
772721Message Send : MQTT_Pub => Hello from MQTTClient_Auth on WT32-ETH01 with ETH_PHY_LAN8720
@@ -783,7 +732,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_Basic example](example
783732
784733```
785734Starting MQTTClient_Basic on ESP32_DEV with ETH_PHY_LAN8720
786- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
735+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
787736ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
788737Attempting MQTT connection to broker.emqx.io...connected
789738Message Send : MQTT_Pub => Hello from MQTTClient_Basic on WT32-ETH01 with ETH_PHY_LAN8720
@@ -803,7 +752,7 @@ The terminal output of **WT32_ETH01** running [WebClient example](examples/WebCl
803752
804753```
805754Starting WebClient on ESP32_DEV with ETH_PHY_LAN8720
806- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
755+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
807756ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
808757
809758Starting connection to server...
@@ -871,7 +820,7 @@ The terminal output of **WT32_ETH01** running [UdpNTPClient example](examples/Ud
871820
872821```
873822Starting UdpNTPClient on ESP32_DEV with ETH_PHY_LAN8720
874- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
823+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
875824ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
876825UDP Packet received, size 48
877826From 132.163.97.1, port 123
@@ -900,7 +849,7 @@ The terminal output of **WT32_ETH01** running [BasicHttpClient example](examples
900849
901850```
902851Starting BasicHttpClient on ESP32_DEV with ETH_PHY_LAN8720
903- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
852+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
904853ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
905854[HTTP] begin...
906855[HTTP] GET...
@@ -962,7 +911,7 @@ The terminal output of **WT32_ETH01** running [BasicHttpsClient example](example
962911
963912```
964913Starting BasicHttpsClient on ESP32_DEV with ETH_PHY_LAN8720
965- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
914+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
966915ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
967916Waiting for NTP time sync: .
968917Current time: Tue Jul 6 05:29:39 2021
@@ -1007,7 +956,7 @@ The terminal output of **WT32_ETH01** running [WebClientMulti_SSL example](examp
1007956
1008957```
1009958Starting WebClientMulti_SSL on ESP32_DEV with ETH_PHY_LAN8720
1010- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
959+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
1011960ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
1012961Waiting for NTP time sync: .
1013962Current time: Tue Jul 6 19:58:27 2021
@@ -1121,7 +1070,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL_Complex example](e
11211070
11221071```
11231072Starting MQTTClient_SSL_Complex on ESP32_DEV with ETH_PHY_LAN8720
1124- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
1073+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
11251074ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
11261075Waiting for NTP time sync: .
11271076Current time: Tue Jul 6 18:14:02 2021
@@ -1141,7 +1090,7 @@ The terminal output of **WT32_ETH01** running [MQTTS_ThingStream example](exampl
11411090
11421091```
11431092Starting MQTTS_ThingStream on ESP32_DEV with ETH_PHY_LAN8720
1144- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
1093+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
11451094ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
11461095Waiting for NTP time sync: .
11471096Current time: Tue Jul 6 18:38:22 2021
@@ -1167,7 +1116,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL example](examples/
11671116
11681117```
11691118Starting MQTTClient_SSL on ESP32_DEV with ETH_PHY_LAN8720
1170- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
1119+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
11711120ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
11721121Waiting for NTP time sync: .
11731122Current time: Tue Jul 6 17:11:00 2021
@@ -1192,7 +1141,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL_Auth example](exam
11921141
11931142```
11941143Starting MQTTClient_SSL_Auth on ESP32_DEV with ETH_PHY_LAN8720
1195- WebServer_WT32_ETH01 v1.4.0 for core v2.0.0+
1144+ WebServer_WT32_ETH01 v1.4.1 for core v2.0.0+
11961145ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
11971146Waiting for NTP time sync: .
11981147Current time: Tue Jul 6 18:05:14 2021
0 commit comments