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

Commit

Permalink
v1.2.0 to add common code to library
Browse files Browse the repository at this point in the history
#### Releases v1.2.0

1. Add common code to library
2. Renew examples
  • Loading branch information
khoih-prog committed Jul 13, 2021
1 parent 3ec6bbe commit 39ac177
Showing 1 changed file with 2 additions and 54 deletions.
56 changes: 2 additions & 54 deletions examples/ESP32_FS_EthernetWebServer/ESP32_FS_EthernetWebServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ IPAddress mySN(255, 255, 255, 0);
// Google DNS Server IP
IPAddress myDNS(8, 8, 8, 8);

bool eth_connected = false;

//holds the current upload
File fsUploadFile;

Expand Down Expand Up @@ -464,55 +462,6 @@ void initWebserver(void)
server.begin();
}

void WiFiEvent(WiFiEvent_t event)
{
switch (event)
{
case SYSTEM_EVENT_ETH_START:
Serial.println("\nETH Started");
//set eth hostname here
ETH.setHostname("WT32-ETH01");
break;
case SYSTEM_EVENT_ETH_CONNECTED:
Serial.println("ETH Connected");
break;

case SYSTEM_EVENT_ETH_GOT_IP:
if (!eth_connected)
{
Serial.print("ETH MAC: ");
Serial.print(ETH.macAddress());
Serial.print(", IPv4: ");
Serial.print(ETH.localIP());

if (ETH.fullDuplex())
{
Serial.print(", FULL_DUPLEX");
}

Serial.print(", ");
Serial.print(ETH.linkSpeed());
Serial.println("Mbps");
eth_connected = true;
}

break;

case SYSTEM_EVENT_ETH_DISCONNECTED:
Serial.println("ETH Disconnected");
eth_connected = false;
break;

case SYSTEM_EVENT_ETH_STOP:
Serial.println("\nETH Stopped");
eth_connected = false;
break;

default:
break;
}
}

void setup(void)
{
Serial.begin(115200);
Expand All @@ -534,10 +483,9 @@ void setup(void)
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
ETH.config(myIP, myGW, mySN, myDNS);

WiFi.onEvent(WiFiEvent);
WT32_ETH01_onEvent();

while (!eth_connected)
delay(100);
WT32_ETH01_waitForConnect();

initFS();
listDir();
Expand Down

0 comments on commit 39ac177

Please sign in to comment.