Skip to content

Commit c032e65

Browse files
committed
WLED_USE_ETHERNET_ONLY to disable WiFi for performance reasons.
1 parent fb0adeb commit c032e65

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

wled00/wled.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ static const char *TAG = "WLED";
33
#include "wled.h"
44
#include "wled_ethernet.h"
55
#include <Arduino.h>
6+
#if defined(WLED_USE_ETHERNET_ONLY) && !defined(WLED_USE_ETHERNET)
7+
#define WLED_USE_ETHERNET
8+
#endif
69
#if defined(CONFIG_IDF_TARGET_ESP32P4)
710
#include "esp_ldo_regulator.h" // ESP32-P4 for higher GPIOS.
811
esp_ldo_channel_handle_t ldo2 = NULL;
@@ -815,7 +818,7 @@ void WLED::setup()
815818
#endif
816819

817820
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5,0,0)
818-
// #if !defined(WLED_USE_ETHERNET)
821+
#if !defined(WLED_USE_ETHERNET_ONLY)
819822
#if defined(ARDUINO_ARCH_ESP32P4)
820823
esp_hosted_init();
821824
#endif
@@ -841,18 +844,18 @@ void WLED::setup()
841844
}
842845
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_set_protocol((wifi_interface_t)ESP_IF_WIFI_STA, wifi_protocols));
843846
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &wifi_configuration));
844-
// wifi_tx_rate_config_t wifi_rate_config = {};
845-
// wifi_rate_config.phymode = WIFI_PHY_MODE_HT40;
846-
// wifi_rate_config.rate = WIFI_PHY_RATE_MCS3_LGI;
847-
// esp_wifi_config_80211_tx((wifi_interface_t)ESP_IF_WIFI_STA, &wifi_rate_config);
848847
esp_wifi_start();
849848
// delay(500);
850-
// #endif
849+
#endif
851850

852851
#ifdef WLED_USE_ETHERNET
853852
// Initialize TCP/IP network interface
853+
854+
#if defined(WLED_USE_ETHERNET_ONLY)
855+
// With coexistence you don't need these again (can crash!)
854856
ESP_ERROR_CHECK(esp_netif_init());
855857
ESP_ERROR_CHECK(esp_event_loop_create_default());
858+
#endif
856859

857860
// Create default Ethernet interface
858861
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();

0 commit comments

Comments
 (0)