mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
ETH optimizations
This commit is contained in:
@@ -21,7 +21,7 @@ void APSettingsService::reconfigureAP() {
|
||||
|
||||
void APSettingsService::loop() {
|
||||
// if we have an ETH connection, quit
|
||||
if (ETH.linkUp()) {
|
||||
if (emsesp::System::ethernet_connected()) {
|
||||
return;
|
||||
}
|
||||
unsigned long currentMillis = uuid::get_uptime();
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include <DNSServer.h>
|
||||
#include <IPAddress.h>
|
||||
|
||||
#include <ETH.h>
|
||||
|
||||
#include <uuid/common.h>
|
||||
|
||||
#include "../../src/system.h" // proddy added
|
||||
|
||||
#define MANAGE_NETWORK_DELAY 10000
|
||||
|
||||
#define AP_MODE_ALWAYS 0
|
||||
@@ -59,8 +59,7 @@ class APSettings {
|
||||
IPAddress subnetMask;
|
||||
|
||||
bool operator==(const APSettings & settings) const {
|
||||
return provisionMode == settings.provisionMode && ssid == settings.ssid && password == settings.password && localIP == settings.localIP
|
||||
&& gatewayIP == settings.gatewayIP && subnetMask == settings.subnetMask;
|
||||
return provisionMode == settings.provisionMode && ssid == settings.ssid && password == settings.password && localIP == settings.localIP && gatewayIP == settings.gatewayIP && subnetMask == settings.subnetMask;
|
||||
}
|
||||
|
||||
static void read(APSettings & settings, JsonObject & root) {
|
||||
|
||||
@@ -34,8 +34,6 @@ void NTPSettingsService::WiFiEvent(WiFiEvent_t event) {
|
||||
configureNTP();
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <lwip/apps/sntp.h>
|
||||
#include <ETH.h>
|
||||
|
||||
#ifndef FACTORY_NTP_ENABLED
|
||||
#define FACTORY_NTP_ENABLED true
|
||||
|
||||
@@ -8,7 +8,7 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) {
|
||||
AsyncJsonResponse * response = new AsyncJsonResponse(false, MAX_NETWORK_STATUS_SIZE);
|
||||
JsonObject root = response->getRoot();
|
||||
|
||||
bool ethernet_connected = ETH.linkUp();
|
||||
bool ethernet_connected = emsesp::System::ethernet_connected();
|
||||
wl_status_t wifi_status = WiFi.status();
|
||||
|
||||
// see if Ethernet is connected
|
||||
@@ -36,7 +36,7 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) {
|
||||
if (dnsIP2 != INADDR_NONE) {
|
||||
root["dns_ip_2"] = dnsIP2.toString();
|
||||
}
|
||||
} else if (ETH.linkUp()) {
|
||||
} else if (ethernet_connected) {
|
||||
// Ethernet
|
||||
root["local_ip"] = ETH.localIP().toString();
|
||||
root["mac_address"] = ETH.macAddress();
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
#define NetworkStatus_h
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <ETH.h>
|
||||
#include <AsyncTCP.h>
|
||||
|
||||
#include "../../src/system.h" // proddy added
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <AsyncJson.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
|
||||
Reference in New Issue
Block a user