100
100
101
101
#### Important notes
102
102
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-.
104
104
105
105
It'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 )
106
106
@@ -115,7 +115,7 @@ To use with core v1.0.6-, just define in your sketch
115
115
#define USING_CORE_ESP32_CORE_V200_PLUS false
116
116
```
117
117
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**
119
119
120
120
121
121
#### Features
@@ -453,8 +453,6 @@ IPAddress mySN(255, 255, 255, 0);
453
453
// Google DNS Server IP
454
454
IPAddress myDNS(8, 8, 8, 8);
455
455
456
- bool eth_connected = false;
457
-
458
456
int reqCount = 0; // number of requests received
459
457
460
458
void handleRoot()
@@ -532,55 +530,6 @@ void drawGraph()
532
530
server.send(200, F("image/svg+xml"), out);
533
531
}
534
532
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
-
584
533
void setup()
585
534
{
586
535
Serial.begin(115200);
@@ -593,6 +542,9 @@ void setup()
593
542
Serial.println(" with " + String(SHIELD_TYPE));
594
543
Serial.println(WEBSERVER_WT32_ETH01_VERSION);
595
544
545
+ // To be called before ETH.begin()
546
+ WT32_ETH01_onEvent();
547
+
596
548
//bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO,
597
549
// eth_phy_type_t type=ETH_PHY_TYPE, eth_clock_mode_t clk_mode=ETH_CLK_MODE);
598
550
//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()
602
554
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
603
555
ETH.config(myIP, myGW, mySN, myDNS);
604
556
605
- WiFi.onEvent(WiFiEvent);
606
-
607
- while (!eth_connected)
608
- delay(100);
557
+ WT32_ETH01_waitForConnect();
609
558
610
559
server.on(F("/"), handleRoot);
611
560
server.on(F("/test.svg"), drawGraph);
@@ -674,7 +623,7 @@ The following are debug terminal output and screen shot when running example [Ad
674
623
675
624
```
676
625
Starting 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+
678
627
679
628
ETH Started
680
629
ETH Connected
@@ -692,7 +641,7 @@ The terminal output of **WT32_ETH01** running [ESP32_FS_EthernetWebServer](examp
692
641
693
642
```cpp
694
643
Starting 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+
696
645
697
646
ETH Started
698
647
ETH Connected
@@ -742,7 +691,7 @@ The terminal output of **WT32_ETH01** running [MQTT_ThingStream example](example
742
691
743
692
```
744
693
Starting 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+
746
695
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
747
696
***************************************
748
697
esp32-sniffer/12345678/ble
@@ -766,7 +715,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_Auth example](examples
766
715
767
716
```
768
717
Starting 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+
770
719
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
771
720
Attempting MQTT connection to broker.emqx.io...connected
772
721
Message 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
783
732
784
733
```
785
734
Starting 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+
787
736
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
788
737
Attempting MQTT connection to broker.emqx.io...connected
789
738
Message 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
803
752
804
753
```
805
754
Starting 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+
807
756
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
808
757
809
758
Starting connection to server...
@@ -871,7 +820,7 @@ The terminal output of **WT32_ETH01** running [UdpNTPClient example](examples/Ud
871
820
872
821
```
873
822
Starting 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+
875
824
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
876
825
UDP Packet received, size 48
877
826
From 132.163.97.1, port 123
@@ -900,7 +849,7 @@ The terminal output of **WT32_ETH01** running [BasicHttpClient example](examples
900
849
901
850
```
902
851
Starting 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+
904
853
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
905
854
[HTTP] begin...
906
855
[HTTP] GET...
@@ -962,7 +911,7 @@ The terminal output of **WT32_ETH01** running [BasicHttpsClient example](example
962
911
963
912
```
964
913
Starting 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+
966
915
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
967
916
Waiting for NTP time sync: .
968
917
Current time: Tue Jul 6 05:29:39 2021
@@ -1007,7 +956,7 @@ The terminal output of **WT32_ETH01** running [WebClientMulti_SSL example](examp
1007
956
1008
957
```
1009
958
Starting 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+
1011
960
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
1012
961
Waiting for NTP time sync: .
1013
962
Current time: Tue Jul 6 19:58:27 2021
@@ -1121,7 +1070,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL_Complex example](e
1121
1070
1122
1071
```
1123
1072
Starting 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+
1125
1074
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
1126
1075
Waiting for NTP time sync: .
1127
1076
Current time: Tue Jul 6 18:14:02 2021
@@ -1141,7 +1090,7 @@ The terminal output of **WT32_ETH01** running [MQTTS_ThingStream example](exampl
1141
1090
1142
1091
```
1143
1092
Starting 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+
1145
1094
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
1146
1095
Waiting for NTP time sync: .
1147
1096
Current time: Tue Jul 6 18:38:22 2021
@@ -1167,7 +1116,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL example](examples/
1167
1116
1168
1117
```
1169
1118
Starting 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+
1171
1120
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
1172
1121
Waiting for NTP time sync: .
1173
1122
Current time: Tue Jul 6 17:11:00 2021
@@ -1192,7 +1141,7 @@ The terminal output of **WT32_ETH01** running [MQTTClient_SSL_Auth example](exam
1192
1141
1193
1142
```
1194
1143
Starting 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+
1196
1145
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
1197
1146
Waiting for NTP time sync: .
1198
1147
Current time: Tue Jul 6 18:05:14 2021
0 commit comments