tzapu / WiFiManager

ESP8266 WiFi Connection manager with web captive portal
http://tzapu.com/esp8266-wifi-connection-manager-library-arduino-ide/
MIT License
6.59k stars 1.97k forks source link

Esp32 testing #513

Open tablatronix opened 6 years ago

tablatronix commented 6 years ago

This has been merged into development

The Development branch implements support for esp8266 and esp32

The espressif esp32 platform does not include webserver Tested with https://github.com/bbx10/WebServer_tng

Known Isssues

NVS corruption

W (84) wifi: wifi nvs_open fail ret=4353 or wifi wont connect with ap not found error

There seems to be some kind of corruption of NVS in some version of core lib, or the partition was changed at some point. Reformatting NVS might help. how to fix https://desire.giesecke.tk/index.php/2018/02/26/wifi-connection-problem-nvs-corrupted/ I also added some capability in wifimanager to do this with special define

tablatronix commented 6 years ago

241

500

gepd commented 6 years ago

I'll let here a funtional example to compile the esp32 branch with PlatformIO, it includes the patched libraries webserver and dnsserver. The WiFiManager library will be downloaded automatically. (needs git installed)

I hope this can save time to anyone who like to test the branch.

WiFiManager_esp32.zip

tablatronix commented 6 years ago

merged into development!

gepd commented 6 years ago

I've been testing the library so far it's very stable.

I've just missing an option to configure the hostname. I've manually solve this with:

void WiFiEvent(WiFiEvent_t event){
    switch(event) {
        case SYSTEM_EVENT_AP_START:
            WiFi.softAPsetHostname(HOSTNAME);
            break;
        case SYSTEM_EVENT_STA_START:
            WiFi.setHostname(HOSTNAME);
            break;
        default:
            break;
    }
}

void setup(){
    WiFi.disconnect(true);
    WiFi.onEvent(WiFiEvent);
    WiFi.begin();

// checks connection and perform a call to the config portal if it's neccessary
}

I've update handleWifi to get the list of available networks asynchronously, that way the UI loads within a second and then shows the list, I'll send a PR if you are interested

The last thing I'm missing is an option to display the reason why the connection wasn't able to be perform in the last try (STA mode). You will no always have access to read the debug output.

What could be the best way to implement this? EEPROM, SPIFFS?

tablatronix commented 6 years ago

Yeah that was on my list of todos

tablatronix commented 6 years ago

Do you need to store it, or can it be a lifetime variable with a getter?

tablatronix commented 6 years ago

The goal was to get esp32 working, then add additional features as needed and add special support for esp32 stuff that is not supported in esp8266 and also polyfill some stuff that is

tablatronix commented 6 years ago

Feel free to create issues for that because I have not had a chance to work much with it.

gepd commented 6 years ago

I've create two issues, and will send a PR for the asynchronous fix

tablatronix commented 6 years ago

✔️ DNS Server has been fixed in esp32 core

twinotter commented 6 years ago

I'd like to try this, but I'm a bit confused by the mulitple webserver approaches I've found online. Tablatronix, can you tell me how you set up your webserver library? Thanks!

tablatronix commented 6 years ago

You need https://github.com/bbx10/WebServer_tng Stick in esp32 libraries

I have not updated my fork , so do not suggest using it

twinotter commented 6 years ago

thanks for the fast response! I got a little further using bbx10's WifiManager and WebServer_tng. But I'm still getting this error in compiling: user_interface.h: No such file or directory

Any ideas? I can't find user_interface.h in any of the Arduino libraries...

tablatronix commented 6 years ago

No idea, you need to use development branch of wifimanager...

tablatronix commented 6 years ago

Shit i posted the wrong link, so sorry for wasting your time.

Doh Use this repo/development And https://github.com/bbx10/WebServer_tng

Sorry for the confusion

tablatronix commented 6 years ago

I updated first post for clarity

twinotter commented 6 years ago

It looks like the missing user_interface.h is related to a fairly different structure of the esp32 library from the esp8266 library. I installed the 8266 library and found the file in the tools/sdk folder. The equivalent folder in the esp32 folder structure doesn't have user_interface.h, os_types.h, and many others...

Perhaps this is a fundamentally different way that the esp32 libraries were installed? I used the Windows install path and everything seem to be updated... and I've compiled and run code on an ESP32 dev kit C... Is there a step I'm missing?

tablatronix commented 6 years ago

Are you using development branch? Esp32 doesnt use this file that I know of, what is including it?

twinotter commented 6 years ago

!! Okay, so my understanding of git is clearly very limited. Not sure how to use the gui to checkout a branch. But I found a command-line that would do it and used that, so now I'm at least looking at the same files. :)

git clone https://github.com/tzapu/WiFiManager.git --branch development --single-branch WiFiManager

btw, the way NOT to do it: don't select the branch from the main git page and then expect that the clone link has been updated. :)

That portion of the code compiled and I'm off working on other bugs now. Thank you!

tablatronix commented 6 years ago

Yeah the clone does the repo not a branch, to do a branch select development from be branch dropdown and download the zip. Or use girhub desktop and just change branch.

bkrajendra commented 6 years ago

What's the issue if we use https://github.com/me-no-dev/ESPAsyncWebServer for both eso8266 and esp32? Its more stable and working library.

tablatronix commented 6 years ago

Its larger... and not official either

naveenneog commented 6 years ago

ESP32 WebServer is now available in the core PR#430 is closed