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

ESP32 Compatability #241

Closed
forthlightning opened this issue Nov 3, 2016 · 144 comments
Closed

ESP32 Compatability #241

forthlightning opened this issue Nov 3, 2016 · 144 comments
Labels
enhancement Feature Request ESP32 Esp 32 related issue In Progress
Milestone

Comments

@forthlightning
Copy link

Thinking of porting this wonderful library over to the new ESP32 module?

I'd be willing to contribute if you can point me in the right direction.

@kentaylor
Copy link

I'm wondering how much pointing is required. The code is all here, just go for it. I'm fond of this derivation for the reasons given there but you may not like it or prefer to roll your own.

@tzapu
Copy link
Owner

tzapu commented Nov 3, 2016

as far as i can see webserver is not working yet on esp32 so this won't work either i'm afraid
https://github.com/espressif/arduino-esp32
got an esp32 in front of me that i didn t have a chance to play with yet, I do hope there will be some more progress on the arduino port as well

good luck and let us know if you get anywhere with it

@forthlightning
Copy link
Author

@kentaylor nice fork! Some of these are features I have been hoping for.

@tzapu thanks for the heads up about webserver, I'll poke around and see what there is to see.

@Jorgen-VikingGod
Copy link

Jorgen-VikingGod commented Jan 5, 2017

@tzapu webserver is working on current master. There are not all libs in yet - but I just try to use the webserver yesterday - it worked good.

@seopyoon
Copy link

seopyoon commented Feb 3, 2017

Does this work without the DNSServer.h? Where can I find DNSServer.h for esp32?

@tzapu
Copy link
Owner

tzapu commented Feb 3, 2017 via email

@seopyoon
Copy link

seopyoon commented Feb 3, 2017

The WiFiServer.h provided by the arduino-esp32 repo, does not support void on(args) functions, so I failed to port it over =(

@xinort
Copy link

xinort commented Feb 14, 2017

=(

@Curclamas
Copy link

So if I understand correctly we would need an arduino-esp32 equivalent of "ESP8266WebServer" https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer since "WiFiServer" ist not a full blown HTTP/Webserver.
Does anybody of you know of any developments here?

@Curclamas
Copy link

It looks like the issue I've referenced above has been resolved. So from what I understand it should now be possible to port (just copy it into the arduino esp32 libs folder) the webserver lib and cosequently the WiFiManager should work.

@xinort
Copy link

xinort commented Mar 14, 2017

has anyone tried this?

@zarya
Copy link

zarya commented May 2, 2017

After patching some of the includes to the ESP32 includes i was not able to get the ESP8266Webserver to be happy to much compile errors for me.

In file included from lib/ESP8266WebServer/src/ESP8266WebServer.cpp:30:0: lib/ESP8266WebServer/src/detail/RequestHandlersImpl.h: In constructor 'StaticRequestHandler::StaticRequestHandler(fs::FS&, const char*, const char*, const char*)': lib/ESP8266WebServer/src/detail/RequestHandlersImpl.h:62:119: error: 'DEBUGV' was not declared in this scope DEBUGV("StaticRequestHandler: path=%s uri=%s isFile=%d, cache_header=%s\r\n", path, uri, _isFile, cache_header); ^ lib/ESP8266WebServer/src/detail/RequestHandlersImpl.h: In member function 'virtual bool StaticRequestHandler::handle(ESP8266WebServer&, HTTPMethod, String)': lib/ESP8266WebServer/src/detail/RequestHandlersImpl.h:80:104: error: 'DEBUGV' was not declared in this scope DEBUGV("StaticRequestHandler::handle: request=%s _uri=%s\r\n", requestUri.c_str(), _uri.c_str()); ^ lib/ESP8266WebServer/src/ESP8266WebServer.cpp: In member function 'void ESP8266WebServer::close()': lib/ESP8266WebServer/src/ESP8266WebServer.cpp:223:11: error: 'class WiFiServer' has no member named 'close' _server.close(); ^ In file included from lib/ESP8266WebServer/src/ESP8266WebServer.cpp:28:0: lib/ESP8266WebServer/src/ESP8266WebServer.h: In instantiation of 'size_t ESP8266WebServer::streamFile(T&, const String&) [with T = fs::File; size_t = unsigned int]': lib/ESP8266WebServer/src/detail/RequestHandlersImpl.h:111:41: required from here lib/ESP8266WebServer/src/ESP8266WebServer.h:132:60: error: no matching function for call to 'WiFiClient::write(fs::File&, int)' return _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE); ^ In file included from /home/zarya/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiServer.h:24:0, from lib/ESP8266WebServer/src/ESP8266WebServer.cpp:26: /home/zarya/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.h:43:12: note: candidate: virtual size_t WiFiClient::write(uint8_t) size_t write(uint8_t data); ^ /home/zarya/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.h:43:12: note: candidate expects 1 argument, 2 provided /home/zarya/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.h:44:12: note: candidate: virtual size_t WiFiClient::write(const uint8_t*, size_t) size_t write(const uint8_t *buf, size_t size); ^ /home/zarya/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.h:44:12: note: no known conversion for argument 1 from 'fs::File' to 'const uint8_t* {aka const unsigned char*}' In file included from /home/zarya/.platformio/packages/framework-arduinoespressif32/cores/esp32/Stream.h:26:0, from /home/zarya/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:150, from lib/ESP8266WebServer/src/ESP8266WebServer.cpp:24: /home/zarya/.platformio/packages/framework-arduinoespressif32/cores/esp32/Print.h:69:12: note: candidate: size_t Print::write(const char*, size_t) size_t write(const char *buffer, size_t size) ^ /home/zarya/.platformio/packages/framework-arduinoespressif32/cores/esp32/Print.h:69:12: note: no known conversion for argument 1 from 'fs::File' to 'const char*' /home/zarya/.platformio/packages/framework-arduinoespressif32/cores/esp32/Print.h:61:12: note: candidate: size_t Print::write(const char*) size_t write(const char *str) ^ /home/zarya/.platformio/packages/framework-arduinoespressif32/cores/esp32/Print.h:61:12: note: candidate expects 1 argument, 2 provided *** [.pioenvs/esp32/lib/ESP8266WebServer/ESP8266WebServer.o] Error 1

@davidwallis
Copy link

Has anyone got this working with the esp32?

@bbx10
Copy link

bbx10 commented May 27, 2017

@tzapu There is discussion at espressif/arduino-esp32 on how best to merge WebServer and DNSServer libraries. Once that happens, it should be easier to port other libraries such as WiFiManager.

espressif/arduino-esp32#395

@bbx10
Copy link

bbx10 commented Jun 10, 2017

Libraries for the adventurous. They are good enough for me to port my personal projects to ESP32 but there are TODOs, a patch, and an issue.

Be sure to use the esp32 branch.
https://github.com/bbx10/WiFiManager/tree/esp32

Patch required but not merged. Patch your local fork. UPDATE: Patch merged so git pull.
espressif/arduino-esp32#428

Still a problem but the issue is currently closed.
espressif/arduino-esp32#400

My personal projects are working on ESP32 with these libraries but your mileage may vary. The following are NOT supported by Espressif.
https://github.com/bbx10/WebServer_tng
https://github.com/bbx10/DNSServer_tng

@yurykk
Copy link

yurykk commented Jun 21, 2017

Hi

I'm getting an error message when I'm trying to compile the example :

Multiple libraries were found for "WiFi.h"
Used: ..[censored]../Arduino/hardware/espressif/esp32/libraries/WiFi
Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi

Please advise...

@bbx10
Copy link

bbx10 commented Jun 21, 2017

This is expected and not a problem. When there are include files with the same name in different directories the IDE reports which include it used to build the program. The correct one in this case is the ESP32 version.

@yurykk
Copy link

yurykk commented Jun 21, 2017

but sketch will not compile because of this conflict.... Interesting, but I don't have this issue compiling ESP32 sample Web server sketch...

@bbx10
Copy link

bbx10 commented Jun 21, 2017

The compile is probably failing for some other reason. The following a successful compile which includes the multiple libraries warning but goes on to build the bin file.

Multiple libraries were found for "WiFi.h"
 Used: /home/me/esp32/arduino-1.8.2/hardware/espressif/esp32/libraries/WiFi
 Not used: /home/me/esp32/arduino-1.8.2/libraries/WiFi
Using library WiFi at version 1.0 in folder: /home/me/esp32/arduino-1.8.2/hardware/espressif/esp32/libraries/WiFi 
Using library HTTPClient at version 1.1 in folder: /home/me/esp32/arduino-1.8.2/hardware/espressif/esp32/libraries/HTTPClient 
Using library ArduinoJson at version 5.10.0 in folder: /home/me/esp32/arduino-1.8.2/portable/sketchbook/libraries/ArduinoJson 
Using library WiFiClientSecure at version 1.0 in folder: /home/me/esp32/arduino-1.8.2/hardware/espressif/esp32/libraries/WiFiClientSecure 
Sketch uses 444851 bytes (33%) of program storage space. Maximum is 1310720 bytes.
Global variables use 32868 bytes (11%) of dynamic memory, leaving 262044 bytes for local variables. Maximum is 294912 bytes.

@TheChapu
Copy link

WARNING: library DNSServer claims to run on [esp8266] architecture(s) and may be incompatible with your current board which runs on [esp32] architecture(s).
In file included from /tmp/arduino_modified_sketch_96123/sketch_jun22a.ino:12:0:
/opt/arduino-1.8.1/libraries/webserver/WebServer.h:131:37: error: conflicting declaration of C function 'long unsigned int millis()'
extern "C" unsigned long millis(void);
^
In file included from /home/yo/Arduino/hardware/espressif/esp32/cores/esp32/Arduino.h:35:0,
from sketch/sketch_jun22a.ino.cpp:1:
/home/yo/Arduino/hardware/espressif/esp32/cores/esp32/esp32-hal.h:65:10: note: previous declaration 'uint32_t millis()'
uint32_t millis();
^
In file included from /tmp/arduino_modified_sketch_96123/sketch_jun22a.ino:12:0:
/opt/arduino-1.8.1/libraries/webserver/WebServer.h: In member function 'int WebServer::read()':
/opt/arduino-1.8.1/libraries/webserver/WebServer.h:793:40: error: call of overloaded 'millis()' is ambiguous
unsigned long timeoutTime = millis() + WEBDUINO_READ_TIMEOUT_IN_MS;
^
In file included from /home/yo/Arduino/hardware/espressif/esp32/cores/esp32/Arduino.h:35:0,
from sketch/sketch_jun22a.ino.cpp:1:
/home/yo/Arduino/hardware/espressif/esp32/cores/esp32/esp32-hal.h:65:10: note: candidate: uint32_t millis()
uint32_t millis();
^
In file included from /tmp/arduino_modified_sketch_96123/sketch_jun22a.ino:12:0:
/opt/arduino-1.8.1/libraries/webserver/WebServer.h:131:26: note: candidate: long unsigned int millis()
extern "C" unsigned long millis(void);
^
/opt/arduino-1.8.1/libraries/webserver/WebServer.h:835:36: error: call of overloaded 'millis()' is ambiguous
unsigned long now = millis();
^
In file included from /home/yo/Arduino/hardware/espressif/esp32/cores/esp32/Arduino.h:35:0,
from sketch/sketch_jun22a.ino.cpp:1:
/home/yo/Arduino/hardware/espressif/esp32/cores/esp32/esp32-hal.h:65:10: note: candidate: uint32_t millis()
uint32_t millis();
^
In file included from /tmp/arduino_modified_sketch_96123/sketch_jun22a.ino:12:0:
/opt/arduino-1.8.1/libraries/webserver/WebServer.h:131:26: note: candidate: long unsigned int millis()
extern "C" unsigned long millis(void);
^
In file included from /opt/arduino-1.8.1/libraries/Ethernet/src/Ethernet.h:9:0,
from /opt/arduino-1.8.1/libraries/webserver/WebServer.h:32,
from /tmp/arduino_modified_sketch_96123/sketch_jun22a.ino:12:
/home/yo/Arduino/hardware/espressif/esp32/tools/sdk/include/lwip/apps/dhcpserver.h: At global scope:
/opt/arduino-1.8.1/libraries/Ethernet/src/Dhcp.h:47:19: error: expected identifier before string constant
#define HOST_NAME "WIZnet"

               ^

/home/yo/Arduino/hardware/espressif/esp32/tools/sdk/include/lwip/apps/dhcpserver.h:58:5: note: in expansion of macro 'HOST_NAME'
HOST_NAME = 12,
^
/opt/arduino-1.8.1/libraries/Ethernet/src/Dhcp.h:47:19: error: expected '}' before string constant
#define HOST_NAME "WIZnet"

               ^

/home/yo/Arduino/hardware/espressif/esp32/tools/sdk/include/lwip/apps/dhcpserver.h:58:5: note: in expansion of macro 'HOST_NAME'
HOST_NAME = 12,
^
/opt/arduino-1.8.1/libraries/Ethernet/src/Dhcp.h:47:19: error: expected unqualified-id before string constant
#define HOST_NAME "WIZnet"

               ^

/home/yo/Arduino/hardware/espressif/esp32/tools/sdk/include/lwip/apps/dhcpserver.h:58:5: note: in expansion of macro 'HOST_NAME'
HOST_NAME = 12,
^
In file included from /home/yo/Arduino/hardware/espressif/esp32/tools/sdk/include/tcpip_adapter/tcpip_adapter.h:48:0,
from /home/yo/Arduino/hardware/espressif/esp32/tools/sdk/include/esp32/esp_event.h:23,
from /home/yo/Arduino/hardware/espressif/esp32/tools/sdk/include/esp32/esp_wifi.h:68,
from /opt/arduino-1.8.1/libraries/WiFiManager-esp32/WiFiManager.h:32,
from /tmp/arduino_modified_sketch_96123/sketch_jun22a.ino:14:
/home/yo/Arduino/hardware/espressif/esp32/tools/sdk/include/lwip/apps/dhcpserver.h:154:1: error: expected declaration before '}' token
} dhcp_msg_option;
^
exit status 1
Error compiling for board ESP32 Dev Module.

@bbx10
Copy link

bbx10 commented Jun 23, 2017

Looks like you manually installed libraries in the wrong directory. The libraries may not be designed for ESP32. In arduino-1.8.1-linux64.tar.xz, I do not see a webserver library yet your log shows such a library.
/opt/arduino-1.8.1/libraries/webserver/WebServer.h: I suggest removing arduino1.8.1 directory and reinstall or upgrade to the latest. Install libraries in [sketch directory]/libraries/, not in the IDE libraries directory.

@sglvladi
Copy link

sglvladi commented Jun 29, 2017

@bbx10 You are amazing! Been waiting for this for months and you've done it all!

A BIG shout out to everyone, @bbx10's solution {https://github.com/bbx10/WiFiManager/tree/esp32} works pretty much out of the box! All that is needed is to download and install his custom WebServer {https://github.com/bbx10/WebServer_tng} and DNSServer {https://github.com/bbx10/DNSServer_tng} libs.

Pretty much identical functionality (as far as I have tested) with the original ESP8266 WiFiManager, but on the ESP32!!

Personally I think this should be shared as much as possible. I am sure there are loads of people interested.

@bbx10 Why not turn the esp32 branch into a separate repo? Give it the attention it deserves :) It's certainly worth it and would be great to also have some more details on the work you did to make it compatible.

@bbx10
Copy link

bbx10 commented Jun 29, 2017

@sglvladi Thanks, for the kind words! Ideally, my ESP32 code would be merged into this repo via PR so I am keeping it on a separate branch for now. There is activity to create official Espressif repos for WebServer and, I hope, DNSServer and Hash libraries. This should make it easier for ESP8266 library maintainers to add support for ESP32.

@yurykk
Copy link

yurykk commented Jun 30, 2017

@bbx10, I have some strange issue with WiFiManager on ESP32.

Many times it doesn't save configuration - it takes 3-4 times entering the password..

also, wifiManager.resetSettings(); doesn't work as expected. After reboot device still "remember" old settings...

Please advise...

Thanks

@bbx10
Copy link

bbx10 commented Jun 30, 2017

I have not had problems saving SSID/password.

wifiManager.resetSettings() does not work because of problem with WiFi.disconnect(true) not working. Still waiting for a fix for this. I found if WiFi.disconnect(true) is called after successfully connecting, it does erase the saved SSID/password.

@miknuc
Copy link

miknuc commented Jul 2, 2017

@bbx10
I tried your fork. Seems to compile :)
I am just wondering how to use it. I was about to move a project from esp8266 to esp32 and ran into an issue with persisting the wifi configuration:
The examples look quite like the esp8266 counterparts and make of use of SPIFFS which is still WIP for esp32 to my knowledge. I do not understand how they could work with esp32.
Am I missing something?

Michael

@bbx10
Copy link

bbx10 commented Jul 2, 2017

@miknuc SPIFFS is not available on ESP32. For configuration information, I use the ESP32 Preferences library. Similary, if an app uses the ESP8266 EEPROM library, it can be converted to use Preferences.

@programmer131
Copy link

i've removed FS related functions from library and esp8266webserver works fine with esp32. will update wifimanager library to see if it works.

@tablatronix
Copy link
Collaborator

esp32 merged into development!

@tablatronix
Copy link
Collaborator

DNS Server fixed in ESP32 core!

@tablatronix tablatronix added ESP32 Esp 32 related issue and removed ESP32 Esp 32 related issue labels Mar 14, 2018
@larissa-n
Copy link

larissa-n commented Mar 28, 2018

@tablatronix what's a stable combination of libraries? I tried a bunch and I'm getting the same errors as @eirikso reported Jan 3 (ESP32 doesn't connect although saved wifi is close-by; only if I hit reset a few times in close succession and get lucky), which you said might be ESP32 lib errors. I get *WM: [ERROR] wifi config failed (and after that it either connects or doesn't), but that probably means something's wrong.

@tablatronix
Copy link
Collaborator

tablatronix commented Mar 28, 2018

There seems to be some instability in esp32, I had issues until I reinit NVS flash.

Are you setting a config ? What are you setting?

do you have issues with dhcp instead of static ( the config code was recently updated, could be a bug )

eirikso issue is related to dns server, which has since been updated in esp32 core, and is no longer an issue afaik.

Create a new issue and provide the issue information requested

@tablatronix
Copy link
Collaborator

ok that error was a bug, I fixed it, just the debug error itself, also see known issues in #513

@tablatronix
Copy link
Collaborator

This issue is about the official development branch with es32 support.

@axwell
Copy link

axwell commented Jun 4, 2018

When this will be available in master branch ? thx

@tablatronix
Copy link
Collaborator

No idea, when I feel development is done and tested enough

@tablatronix
Copy link
Collaborator

tablatronix commented Jun 18, 2018

espressif/arduino-esp32#1393 introduces bugs to esp32 functionality.

The symptom is SAVES DO NOT WORK EVER!

I have removed persistent disabling for now, which will possibly cause problems with softap staying on after reboots, you might want to make sure you set mode in your user code to prevent this.

At this time there is no way to toggle persistent during runtime unless I find a workaround or PR a fix to esp32 if I have time.

@Curclamas
Copy link

@tablatronix it seams there was a big update today, with regards to WiFi, ESP-IDF and I think they added also WebServer functionality, so that should be a big step forward for general ESP32 support on WiFiManager.

@mikekgr
Copy link

mikekgr commented Jun 27, 2018

@Curclamas @tablatronix in this case please instruct me/us what to do, I mean now we are using a webserver unofficial library...
Thanks!

@tablatronix
Copy link
Collaborator

I will take a look thanks!

@Curclamas
Copy link

@tablatronix love to hear that!
@mikekgr I did not test it yet but in theory you could try to remove the unofficial library, pull the latest arduino-esp32 and try if WiFiManager still works :)

@tablatronix
Copy link
Collaborator

Good news the webserver seems to work fine.
Bad news saving is broken again, ill see what changed

@tablatronix
Copy link
Collaborator

Fixed saving and erasing again

@doit4fun
Copy link

hi... is there another github address for tzapu_ESP32 or we can use this one?

@doit4fun
Copy link

when compiling ESP32 is looking for esp8266.h lib and is not finding it so probably it doesn't work

@tablatronix
Copy link
Collaborator

Develoment branch

@tablatronix tablatronix modified the milestones: future, dev Dec 4, 2019
@tablatronix tablatronix removed the Branch This applies to a branch label Dec 4, 2019
@nikeee
Copy link

nikeee commented Aug 17, 2020

Is this issue still valid? I'm looking into using this for my ESP32.

@miknuc
Copy link

miknuc commented Aug 17, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature Request ESP32 Esp 32 related issue In Progress
Projects
None yet
Development

No branches or pull requests