Skip to content

ESP32 devkit v1 WiFi.h and Ethernet.h can not be simultaneously compiled #6058

Closed
@SergiiSenchurov

Description

@SergiiSenchurov

Board

esp32 devkit v1

Device Description

ESP32 DEVKIT v1 with W5500 Ethernet shield connected over the SPI

Hardware Configuration

// static const uint8_t SS = 5;
// static const uint8_t MOSI = 19;
// static const uint8_t MISO = 21;
// static const uint8_t SCK = 18;

Version

v1.0.6

IDE Name

Visual Studio Code with Arduino IDE 1.8.6

Operating System

MacOS 12.0.1

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600

Description

Simultaneous compilation of Ethernet.h and WiFi.h makes successfull compilation impossible due to the constructors syntax conflict

Workaround is

// 1. Modify "Server.h" file as follows
// class Server: public Print
// {
// public:
// // -- Remove
// // virtual void begin(uint16_t port=0) =0;
// // ++ Add
// virtual void begin() = 0;
// };
//
// 2. Modify "WiFiServer.h"
// // -- Remove void begin(uint16_t port=0);
// // ++ Add
// void begin(void);
// void begin(uint16_t port);
//
// 3. Modify "WiFiServer.cpp"
// // ++ Add
// void WiFiServer::begin(void){
// begin(0, 1);
// }
//

Sketch

void setup(){

  


  Ethernet.init(SS);
  module_state.DHCP_result = Ethernet.begin(ethernet_macaddress); // Dynamic IP setup
  module_state.hardware_status = Ethernet.hardwareStatus();


  if (Ethernet.linkStatus() == LinkON)
  {
    serverEthernet.begin();
  }


  WiFi.hostname(WIFI_HOSTNAME);
  WiFi.begin(ssid, pass);
  uint8_t delays_count = 0;
  while ((WiFi.status() != WL_CONNECTED) && (delays_count < MAX_WIFI_CONNECT_RETRIES))
  {
    delay(500);
    delays_count++;
  }

  serverWiFi.begin();
  serverWiFi.setNoDelay(true);

Debug Message

Debug impossible

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions