WiFi with Ethernet functional

This commit is contained in:
lumapu 2024-08-08 22:27:23 +02:00
parent b98e702ad8
commit e3fdb04f0c
2 changed files with 2 additions and 9 deletions

View file

@ -37,6 +37,8 @@ class AhoyEthernet : public AhoyWifi {
void OnEvent(WiFiEvent_t event) { void OnEvent(WiFiEvent_t event) {
switch(event) { switch(event) {
case SYSTEM_EVENT_STA_CONNECTED: case SYSTEM_EVENT_STA_CONNECTED:
mWifiConnecting = false;
[[fallthrough]];
case ARDUINO_EVENT_ETH_CONNECTED: case ARDUINO_EVENT_ETH_CONNECTED:
if(NetworkState::CONNECTED != mStatus) { if(NetworkState::CONNECTED != mStatus) {
mStatus = NetworkState::CONNECTED; mStatus = NetworkState::CONNECTED;

View file

@ -36,11 +36,7 @@ class AhoyWifiAp {
ah::welcome(mIp.toString(), String(F("Password: ") + String(mCfg->apPwd))); ah::welcome(mIp.toString(), String(F("Password: ") + String(mCfg->apPwd)));
#if defined(ETHERNET)
WiFi.mode(WIFI_AP);
#else
WiFi.mode(WIFI_AP_STA); WiFi.mode(WIFI_AP_STA);
#endif
WiFi.softAPConfig(mIp, mIp, IPAddress(255, 255, 255, 0)); WiFi.softAPConfig(mIp, mIp, IPAddress(255, 255, 255, 0));
WiFi.softAP(WIFI_AP_SSID, mCfg->apPwd); WiFi.softAP(WIFI_AP_SSID, mCfg->apPwd);
@ -60,12 +56,7 @@ class AhoyWifiAp {
mDns.stop(); mDns.stop();
WiFi.softAPdisconnect(); WiFi.softAPdisconnect();
#if defined(ETHERNET)
WiFi.mode(WIFI_OFF);
#else
WiFi.scanDelete();
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
#endif
mEnabled = false; mEnabled = false;
} }