esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
15.89k stars 13.35k forks source link

Feature Request... Synchronize the WiFi (And WiFiMulti) APIs between ESP 8266 and ESP 32 #5911

Open dachshund-digital opened 5 years ago

dachshund-digital commented 5 years ago

Feature Request... Synchronize the WiFi (And WiFiMulti) APIs between ESP 8266 and ESP 32. This would be a good thing. I just finished writing programming logic identical on ESP 32 and ESP 8266 devices, and frankly there is not good reason the APIs differ. It is quite user unfriendly. I wasted a lot of time having to use #defines and such to deal with the variances between the APIs in question.

JAndrassy commented 5 years ago

what differences? the API is defined by Arduino networking libraries (Ethernet, WiFi). you mean this problem https://github.com/esp8266/Arduino/issues/5749? use esp8266 package 2.4.2

d-a-v commented 5 years ago

@dachshund-digital please elaborate

dachshund-digital commented 5 years ago

You are kidding right? Sorry, but I find your request a bit of surprise. If you compare the ESP32 and ESP8266 APIs the deviations are obvious.

A common API, is a common API, meaning function calls named the same, function the same, and support the same parameters per API function. This is not done at this time, meaning that custom code must be written to do the same basic tasks. Today when when writing code for ESP32 and ESP8266 you have to deviate code logic per device.

One obvious example, is hostname() versus sethostname(), there are several more just in WiFi and WiFiMulti APIs alone. The various time libraries, etc. all exhibit many variances that add complexity to projects that should not be required, IMHO.

I suggest the core authors of the WiFi and WiFiMulti APIs, to start, for ESP32 and ESP8266 compare notes and eliminate the various deviations so that when a programmer writes code for ESP8266 for example, that same code without modification works on ESP32, to the greatest extent possible. Obviously there will be some differences because ESP32 supports difference interrupt vectors for example, but within the basic API function calls the degree of consistence should be very high. It is not as of now.

I just finish a project which is transparently compatible across ESP32 and ESP8266 devices, however I had to write several 100s of lines of code to align the logical functionality of the various API deltas. Said project is not and never will be in the public domain, so I will not and can not itemize the various API deltas since there is a code ownership issue.

The above said, writing such glue code should not have been required, the official APIs should be consistent and aligned. This would be most programmer friendly scenario, hence my feature request.

d-a-v commented 5 years ago

the official APIs should be consistent and aligned

Where are official api specifications ?