From e3fdb04f0cebe81b084417d8dc812b26db9d0b5d Mon Sep 17 00:00:00 2001 From: lumapu Date: Thu, 8 Aug 2024 22:27:23 +0200 Subject: [PATCH] WiFi with Ethernet functional --- src/network/AhoyEthernet.h | 2 ++ src/network/AhoyWifiAp.h | 9 --------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/network/AhoyEthernet.h b/src/network/AhoyEthernet.h index 5d59eb3c..e8069f02 100644 --- a/src/network/AhoyEthernet.h +++ b/src/network/AhoyEthernet.h @@ -37,6 +37,8 @@ class AhoyEthernet : public AhoyWifi { void OnEvent(WiFiEvent_t event) { switch(event) { case SYSTEM_EVENT_STA_CONNECTED: + mWifiConnecting = false; + [[fallthrough]]; case ARDUINO_EVENT_ETH_CONNECTED: if(NetworkState::CONNECTED != mStatus) { mStatus = NetworkState::CONNECTED; diff --git a/src/network/AhoyWifiAp.h b/src/network/AhoyWifiAp.h index 669e8ec8..ed1ad3a3 100644 --- a/src/network/AhoyWifiAp.h +++ b/src/network/AhoyWifiAp.h @@ -36,11 +36,7 @@ class AhoyWifiAp { ah::welcome(mIp.toString(), String(F("Password: ") + String(mCfg->apPwd))); - #if defined(ETHERNET) - WiFi.mode(WIFI_AP); - #else WiFi.mode(WIFI_AP_STA); - #endif WiFi.softAPConfig(mIp, mIp, IPAddress(255, 255, 255, 0)); WiFi.softAP(WIFI_AP_SSID, mCfg->apPwd); @@ -60,12 +56,7 @@ class AhoyWifiAp { mDns.stop(); WiFi.softAPdisconnect(); - #if defined(ETHERNET) - WiFi.mode(WIFI_OFF); - #else - WiFi.scanDelete(); WiFi.mode(WIFI_STA); - #endif mEnabled = false; }