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

Commit 39ac177

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 3ec6bbe commit 39ac177

File tree

1 file changed

+2
-54
lines changed

1 file changed

+2
-54
lines changed

examples/ESP32_FS_EthernetWebServer/ESP32_FS_EthernetWebServer.ino

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ IPAddress mySN(255, 255, 255, 0);
6969
// Google DNS Server IP
7070
IPAddress myDNS(8, 8, 8, 8);
7171

72-
bool eth_connected = false;
73-
7472
//holds the current upload
7573
File fsUploadFile;
7674

@@ -464,55 +462,6 @@ void initWebserver(void)
464462
server.begin();
465463
}
466464

467-
void WiFiEvent(WiFiEvent_t event)
468-
{
469-
switch (event)
470-
{
471-
case SYSTEM_EVENT_ETH_START:
472-
Serial.println("\nETH Started");
473-
//set eth hostname here
474-
ETH.setHostname("WT32-ETH01");
475-
break;
476-
case SYSTEM_EVENT_ETH_CONNECTED:
477-
Serial.println("ETH Connected");
478-
break;
479-
480-
case SYSTEM_EVENT_ETH_GOT_IP:
481-
if (!eth_connected)
482-
{
483-
Serial.print("ETH MAC: ");
484-
Serial.print(ETH.macAddress());
485-
Serial.print(", IPv4: ");
486-
Serial.print(ETH.localIP());
487-
488-
if (ETH.fullDuplex())
489-
{
490-
Serial.print(", FULL_DUPLEX");
491-
}
492-
493-
Serial.print(", ");
494-
Serial.print(ETH.linkSpeed());
495-
Serial.println("Mbps");
496-
eth_connected = true;
497-
}
498-
499-
break;
500-
501-
case SYSTEM_EVENT_ETH_DISCONNECTED:
502-
Serial.println("ETH Disconnected");
503-
eth_connected = false;
504-
break;
505-
506-
case SYSTEM_EVENT_ETH_STOP:
507-
Serial.println("\nETH Stopped");
508-
eth_connected = false;
509-
break;
510-
511-
default:
512-
break;
513-
}
514-
}
515-
516465
void setup(void)
517466
{
518467
Serial.begin(115200);
@@ -534,10 +483,9 @@ void setup(void)
534483
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
535484
ETH.config(myIP, myGW, mySN, myDNS);
536485

537-
WiFi.onEvent(WiFiEvent);
486+
WT32_ETH01_onEvent();
538487

539-
while (!eth_connected)
540-
delay(100);
488+
WT32_ETH01_waitForConnect();
541489

542490
initFS();
543491
listDir();

0 commit comments

Comments
 (0)