Closed mazWaz closed 1 year ago
I believe your issue is that you're declaring the things like
WiFiManagerParameter custom_mqtt_server("server", "mqtt server", "", 40);
in setup() instead of in the global scope. See if that solves the issue.
If you want an example, here's a project I made that successfully combines custom parameters with a non-blocking portal https://github.com/BlaineAtkins/GenericOutletBox/blob/main/generic_wifi_box.ino
I believe your issue is that you're declaring the things like
WiFiManagerParameter custom_mqtt_server("server", "mqtt server", "", 40);
in setup() instead of in the global scope. See if that solves the issue.If you want an example, here's a project I made that successfully combines custom parameters with a non-blocking portal https://github.com/BlaineAtkins/GenericOutletBox/blob/main/generic_wifi_box.ino
need define to global scope or create new global variable
#BEGIN
WiFiManagerParameter *custom_html;
WiFiManagerParameter *custom_mqtt_server;
WiFiManagerParameter *custom_mqtt_port;
WiFiManagerParameter *custom_token;
WiFiManagerParameter *custom_tokenb;
WiFiManagerParameter *custom_ipaddress;
WiFiManagerParameter *custom_input_type;
WiFiManagerParameter *custom_checkbox;
WiFiManagerParameter *custom_html_inputs;
setup()
{
custom_html = new WiFiManagerParameter("<p style=\"color:pink;font-weight:Bold;\">This Is Custom HTML</p>"); // only custom html
custom_mqtt_server = new WiFiManagerParameter("server", "mqtt server", "", 64);
custom_mqtt_port = new WiFiManagerParameter("port", "mqtt port", "", 64);
custom_token = new WiFiManagerParameter("api_token", "api token", "", 64);
custom_tokenb = new WiFiManagerParameter("invalid token", "invalid token", "", 64); // id is invalid, cannot contain spaces
custom_ipaddress = new WiFiManagerParameter("input_ip", "input IP", "", 64, "pattern='\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}'"); // custom input attrs (ip mask)
custom_input_type = new WiFiManagerParameter("input_pwd", "input pass", "", 64, "type='password'"); // custom input attrs (ip mask)
const char _customHtml_checkbox[] = "type=\"checkbox\"";
custom_checkbox = new WiFiManagerParameter("my_checkbox", "My Checkbox", "T", 64, _customHtml_checkbox, WFM_LABEL_AFTER);
custom_html_inputs = new WiFiManagerParameter(bufferStr);
// add all your parameters here
wm.addParameter(custom_html);
wm.addParameter(custom_mqtt_server);
wm.addParameter(custom_mqtt_port);
wm.addParameter(custom_token);
wm.addParameter(custom_tokenb);
wm.addParameter(custom_ipaddress);
wm.addParameter(custom_checkbox);
wm.addParameter(custom_input_type);
wm.addParameter(custom_html_inputs);
}
#END
Basic Infos
Hardware
WiFimanager Branch/Release: Master
Esp8266/Esp32:
Hardware: ESP32-Devkit
Core Version: 2.4.0, staging
Description
Problem description i using examples/Super/OnDemandConfigPortal/OnDemandConfigPortal.ino
but addParameter not show on browser and error like this
wm:[1] [ERROR] WiFiManagerParameter is out of scope
and my custom debugSettings in IDE
Module: ESP32-Devkit
Additional libraries:
Sketch
Sketch custom debug on String WiFiManager::getParamOut()
Debug Messages