Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethernet::begin incompatible with ESP8266 #34

Open
GiovanniCmpaner opened this issue May 27, 2019 · 3 comments
Open

Ethernet::begin incompatible with ESP8266 #34

GiovanniCmpaner opened this issue May 27, 2019 · 3 comments

Comments

@GiovanniCmpaner
Copy link

GiovanniCmpaner commented May 27, 2019

Currently using
void EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet)
generates a compiler error, as IPAddress from the ESP8266 core doesn't have a _address member:
https://github.com/esp8266/Arduino/blob/master/cores/esp8266/IPAddress.h

These lines:

#if ARDUINO > 106 || TEENSYDUINO > 121
W5100.setIPAddress(ip._address.bytes);
W5100.setGatewayIp(gateway._address.bytes);
W5100.setSubnetMask(subnet._address.bytes);
#else
W5100.setIPAddress(ip._address);
W5100.setGatewayIp(gateway._address);
W5100.setSubnetMask(subnet._address);
#endif

Should be:

W5100.setIPAddress(ip.raw_address());
W5100.setGatewayIp(gateway.raw_address());
W5100.setSubnetMask(subnet.raw_address());

It isn't necessary to check the version, as raw_address() is available since Arduino 1.0.5:
https://github.com/arduino/Arduino/blob/22997bbfd5c841a60e9a5909868c62cd459c798d/hardware/arduino/cores/arduino/IPAddress.h

@michaelradhuber
Copy link

Thanks @GiovanniCmpaner , I would like to confirm that. @PaulStoffregen could you plz implement those changes? Thank you very much! Great work!

@PaulStoffregen
Copy link
Owner

PaulStoffregen commented Oct 5, 2019

Which boards have you tested with this change?

@GiovanniCmpaner
Copy link
Author

GiovanniCmpaner commented Oct 5, 2019

Any board that uses ESP8266 Arduino Core.
As you can see in the source: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/IPAddress.h
The class doesn't have a _address variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants