khoih-prog / ESPAsync_WiFiManager_Lite

Library using AsyncWebServer to configure MultiWiFi/Credentials at runtime for ESP32 (including ESP32-S2 and ESP32-C3) and ESP8266 boards. You can also specify DHCP HostName, static AP and STA IP. Use much less memory compared to full-fledge WiFiManager. Config Portal will be auto-adjusted to match the number of dynamic custom parameters. Optional default Credentials to be autoloaded into Config Portal to use or change instead of manually input. Credentials are saved in LittleFS, SPIFFS or EEPROM. New powerful-yet-simple-to-use feature to enable adding dynamic custom parameters from sketch and input using the same Config Portal. Double or MultiDetectDetector as well as Virtual Switches feature permits entering Config Portal as requested.
MIT License
57 stars 14 forks source link

Please provide a minimal example #1

Closed mvoss96 closed 3 years ago

mvoss96 commented 3 years ago

Hi, I would like to integrate your library into my project, but I am struggling to parse through the provided example. Could you provide a minimal example how to use this library?

khoih-prog commented 3 years ago

Please go through the examples and try to understand, then minimize them according to your use case.

This will benefit you in the long run than just use it, without fully understanding. I used to compare to the fast food metaphor.

Good Luck,

thenicnic commented 3 years ago

Thank you for your outstanding work, but I think a minimal config for at least the "LOAD_DEFAULT_CONFIG_DATA" and "defaultConfig" thing would be cool. Have no idea to configure to leave out the default config credentials and to just show up the AP captive portal if there aren't valid credentials in the SPIFFS.

As you know, compiling and debugging each time takes a few seconds and breaking down a few project files of code isn't what to expect from a "Lite" WiFi manager IMHO. And if I don't edit all the example files, my code gets really huge.

thenicnic commented 3 years ago

OK got it working in base config now:

ESPAsync_WiFiManager_Lite* ESPAsync_WiFiManager;
#define USE_DYNAMIC_PARAMETERS      false
#define SCAN_WIFI_NETWORKS          true
#define REQUIRE_ONE_SET_SSID_PW     true
bool LOAD_DEFAULT_CONFIG_DATA = false;

ESP_WM_LITE_Configuration defaultConfig = {};

SSID: _ESP__[YOURESPID] PW: _MyESP__[YOURESPID]

But I need to enter two APs although "REQUIRE_ONE_SET_SSID_PW" is set to "true" and the captive portal doesn't show up on my smartphone automatically. Will see if it get this fixed. And double-reset does not get me in setup mode again, only overwriting the file system does.

khoih-prog commented 3 years ago

I'm glad that you're doing good with your project. If you need any advice, I'll help, certainly only after you have done some work.

mvoss96 commented 3 years ago

Thank you for your outstanding work, but I think a minimal config for at least the "LOAD_DEFAULT_CONFIG_DATA" and "defaultConfig" thing would be cool. Have no idea to configure to leave out the default config credentials and to just show up the AP captive portal if there aren't valid credentials in the SPIFFS.

As you know, compiling and debugging each time takes a few seconds and breaking down a few project files of code isn't what to expect from a "Lite" WiFi manager IMHO. And if I don't edit all the example files, my code gets really huge.

Hi, Sadly i also couldn't get this library to work in my own code, so I ended up using the non lite espasyncwifimanager. I found this example much better to understand. Maybe it will also help you: https://github.com/khoih-prog/ESPAsync_WiFiManager/blob/master/examples/Async_ConfigOnDRD_ESP8266_minimal/Async_ConfigOnDRD_ESP8266_minimal.ino