Added support for ESP32-EVB and Ethernet
This commit is contained in:
parent
6ff81845ed
commit
b932a10ca1
|
@ -19,4 +19,17 @@ lib_deps =
|
||||||
ESP32 Digital RGB LED Drivers
|
ESP32 Digital RGB LED Drivers
|
||||||
esp32_https_server
|
esp32_https_server
|
||||||
|
|
||||||
build_flags = -std=c++11
|
build_flags = -std=c++11
|
||||||
|
|
||||||
|
[env:esp32-evb]
|
||||||
|
platform = espressif32
|
||||||
|
board = esp32-evb
|
||||||
|
framework = arduino
|
||||||
|
|
||||||
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
ESP32 Digital RGB LED Drivers
|
||||||
|
esp32_https_server@0.3.0
|
||||||
|
|
||||||
|
build_flags = -std=c++11
|
||||||
|
|
45
src/main.cpp
45
src/main.cpp
|
@ -6,6 +6,8 @@
|
||||||
#include <WiFiMulti.h>
|
#include <WiFiMulti.h>
|
||||||
#include <SPIFFS.h>
|
#include <SPIFFS.h>
|
||||||
|
|
||||||
|
#include <ETH.h>
|
||||||
|
|
||||||
#include <FreeRTOS.h>
|
#include <FreeRTOS.h>
|
||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
|
|
||||||
|
@ -49,6 +51,45 @@ UpdateServer *updateServer;
|
||||||
|
|
||||||
AnimationController animController(&ledFader);
|
AnimationController animController(&ledFader);
|
||||||
|
|
||||||
|
static bool eth_connected = false;
|
||||||
|
|
||||||
|
void WiFiEvent(WiFiEvent_t event)
|
||||||
|
{
|
||||||
|
switch (event) {
|
||||||
|
case SYSTEM_EVENT_ETH_START:
|
||||||
|
Serial.println("ETH Started");
|
||||||
|
//set eth hostname here
|
||||||
|
ETH.setHostname("zamusiclight");
|
||||||
|
break;
|
||||||
|
case SYSTEM_EVENT_ETH_CONNECTED:
|
||||||
|
Serial.println("ETH Connected");
|
||||||
|
break;
|
||||||
|
case SYSTEM_EVENT_ETH_GOT_IP:
|
||||||
|
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("ETH Stopped");
|
||||||
|
eth_connected = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool initLEDs()
|
bool initLEDs()
|
||||||
{
|
{
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -431,6 +472,8 @@ void setup()
|
||||||
NULL, /* Task handle to keep track of created task */
|
NULL, /* Task handle to keep track of created task */
|
||||||
CORE_ID_LED);
|
CORE_ID_LED);
|
||||||
|
|
||||||
|
WiFi.onEvent(WiFiEvent);
|
||||||
|
|
||||||
// Connect the WiFi network (or start an AP if that doesn't work)
|
// Connect the WiFi network (or start an AP if that doesn't work)
|
||||||
for (auto &net : Config::instance().getWLANList())
|
for (auto &net : Config::instance().getWLANList())
|
||||||
{
|
{
|
||||||
|
@ -441,6 +484,8 @@ void setup()
|
||||||
|
|
||||||
wifi_setup();
|
wifi_setup();
|
||||||
|
|
||||||
|
ETH.begin();
|
||||||
|
|
||||||
// start the UDP server
|
// start the UDP server
|
||||||
udpProto.start(2703);
|
udpProto.start(2703);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue