arduino-libraries / Ethernet

Ethernet Library for Arduino
http://arduino.cc/
259 stars 264 forks source link

Adding ESP32 support and fix for ESP32 v 1.0.2 #95

Closed kmpelectronics closed 5 years ago

kmpelectronics commented 5 years ago

We have added ESP32 support in Ethernet 2.0.0 library. Especially for ESP32 v1.0.2. You can delete our comments where they are necessary.

JAndrassy commented 5 years ago

my comment there https://github.com/espressif/arduino-esp32/commit/9a9ff622166149da30dd13a81485184617c56387#commitcomment-33292990

the PR should be closed, not be merged

kmpelectronics commented 5 years ago

Dear @jandrassy Why this method virtual int connect(IPAddress ip, uint16_t port, int timeout); has been added in ESP32 release v 1.0.2? Also what about do you say for virtual void begin(uint16_t port = 0); method? It isn't implemented in Arduino Ethernet.h. How do we fix the problem with it implementation?

JAndrassy commented 5 years ago

Dear @jandrassy Why this method virtual int connect(IPAddress ip, uint16_t port, int timeout); has been added in ESP32 release v 1.0.2? Also what about do you say for virtual void begin(uint16_t port = 0); method? It isn't implemented in Arduino Ethernet.h. How do we fix the problem with it implementation?

the ESP32 package should be fixed. they should not change the Arduino API classes

kmpelectronics commented 5 years ago

The method EthernetServer::init() prevent of duplicating the same code in EthernetServer::begin(uint16_t port) and EthernetServer::begin() methods.

JAndrassy commented 5 years ago

The method EthernetServer::init() prevent of duplicating the same code in EthernetServer::begin(uint16_t port) and EthernetServer::begin() methods.

Ethernet.init(pin) sets the CS pin

kmpelectronics commented 5 years ago

Where is the problem with EthernetServer::init() it inherits Server and doesn't have connection with Ethernet.init(pin)... Do you have any ideas about the name of the private method EthernetServer.init()?

JAndrassy commented 5 years ago

Where is the problem with EthernetServer::init() it inherits Server and doesn't have connection with Ethernet.init(pin)... Do you have any ideas about the name of the private method EthernetServer.init()?

sorry. yes. I mixed it. And what should be server.init()? EthernetServer has a constructor. init() is usually for additional initialisation of objects instanced in a library.

kmpelectronics commented 5 years ago

I have removed EthernetClient::connect() specific method for ESP32 and renamed from EthernetServer::init() to EthernetServer::initSocket()

JAndrassy commented 5 years ago

@kmpelectronics, port is specified in constructor. The ESP32 core changed Arduino API Server class's virtual void begin(); and should change it back to be without parameter as all networking libraries expect it in derived Server classes. Make a PR there.

kmpelectronics commented 5 years ago

OK, I will close this PR. But you should know this library does not work together with ESP32.