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

WiFi.config signature differs from Arduino docs #1168

Closed
FWeinb opened this issue Dec 7, 2015 · 11 comments
Closed

WiFi.config signature differs from Arduino docs #1168

FWeinb opened this issue Dec 7, 2015 · 11 comments

Comments

@FWeinb
Copy link

FWeinb commented Dec 7, 2015

The official Arduino docs state that the WiFi.config signature should look like this:

WiFi.config(ip); 
WiFi.config(ip, dns); 
WiFi.config(ip, dns, gateway); 
WiFi.config(ip, dns, gateway, subnet); 

But for the esp8266 lib it is implemented like:

WiFi.config(ip);
WiFi.config(ip, gateway, subnet, dns);

See ESP8266WiFi.h

This is a little confusing.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Links2004
Copy link
Collaborator

dns support where implemented later for ESP.
since every one already using
WiFi.config(ip, gateway, subnet);
at this point we add it to the end, or all the existing code where broken.

but yes its can be confusing.

@FWeinb
Copy link
Author

FWeinb commented Dec 7, 2015

Maybe in an major update this could be done. Just to smooth out some edges. Great work so far, really delighted with this amazing project.

@marvinroger
Copy link
Contributor

Btw, is the project following semver?

@ohsorry
Copy link

ohsorry commented Mar 17, 2016

I also found this, this troubled me for a long time.can anybody fix it?

@Links2004
Copy link
Collaborator

there is no real "fix" since if we change now, we break all existing code on every ESP.
one of two cases will be always broken.

@ohsorry
Copy link

ohsorry commented Mar 24, 2016

how about a "version macro" ? like:
#ifdefine _V1_ //arg1,arg2... #else //arg2,arg1... #endif

@Links2004
Copy link
Collaborator

if you define something in the ino file the define not exists in any other cpp file.
so its not that easy.
the only way to use defines for all files are setting in the plattform.txt or over the menu (like for debug)
but that not a good way to do it for this problem.

@ohsorry
Copy link

ohsorry commented Mar 24, 2016

whatever,you will change the function's declaration sooner or later.
you must make it identical with arduino docs,because users will be more and more.
btw,everyone comes here is for convenience,but this problem is very inconvenient. especially to new guy.
if code dose not work,we don't know what's wrong,because there is no diagnostic trace about gateway and netmask.

@Links2004
Copy link
Collaborator

i think that is something we can change when we go to version 3.0.0,
since with this version will have many changes in the core and will not be full compatible in all cases anyway.

@Links2004 Links2004 added this to the 3.0.0 milestone Mar 24, 2016
@igrr igrr modified the milestones: 2.4.0, 3.0.0 Jun 14, 2016
@igrr
Copy link
Member

igrr commented Jun 14, 2016

Just had an idea — we can make transition smooth because it's easy to detect argument order.
We need to distinguish between
WiFi.config(ip, dns, gateway, subnet);
and
WiFi.config(ip, gateway, subnet, dns);
So we can check the third argument — if leading octet is not 255, it means that old argument order was used, and we can correct for that.
Also reclassifying this as a bug.

@devyte
Copy link
Collaborator

devyte commented Nov 20, 2017

@igrr the check for the octet to choose the argument order interpretation would be done at runtime. How can we deprecate the "bad" order? Maybe print a message to Serial?

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

No branches or pull requests

6 participants