Skip to content

Commit

Permalink
Fix main class in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lbussy committed Aug 9, 2022
1 parent 3ad750f commit f2b38ca
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion examples/Basic/Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void setup() {
// put your setup code here, to run once:
Serial.begin(115200);

//WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
//AsyncWiFiManager, Local intialization. Once its business is done, there is no need to keep it around
AsyncWiFiManager wm;

// reset settings - wipe stored credentials for testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,36 @@ void setup() {

//AsyncWiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
AsyncWiFiManager wifiManager;
AsyncWiFiManager wm;

//set config save notify callback
wifiManager.setSaveConfigCallback(saveConfigCallback);
wm.setSaveConfigCallback(saveConfigCallback);

//set static ip
wifiManager.setSTAStaticIPConfig(IPAddress(10, 0, 1, 99), IPAddress(10, 0, 1, 1), IPAddress(255, 255, 255, 0));
wm.setSTAStaticIPConfig(IPAddress(10, 0, 1, 99), IPAddress(10, 0, 1, 1), IPAddress(255, 255, 255, 0));

//add all your parameters here
wifiManager.addParameter(&custom_mqtt_server);
wifiManager.addParameter(&custom_mqtt_port);
wifiManager.addParameter(&custom_api_token);
wm.addParameter(&custom_mqtt_server);
wm.addParameter(&custom_mqtt_port);
wm.addParameter(&custom_api_token);

//reset settings - for testing
//wifiManager.resetSettings();
//wm.resetSettings();

//set minimu quality of signal so it ignores AP's under that quality
//defaults to 8%
//wifiManager.setMinimumSignalQuality();
//wm.setMinimumSignalQuality();

//sets timeout until configuration portal gets turned off
//useful to make it all retry or go to sleep
//in seconds
//wifiManager.setTimeout(120);
//wm.setTimeout(120);

//fetches ssid and pass and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
if (!wifiManager.autoConnect("AutoConnectAP", "password")) {
if (!wm.autoConnect("AutoConnectAP", "password")) {
Serial.println("failed to connect and hit timeout");
delay(3000);
//reset and try again, or maybe put it to deep sleep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,41 +100,41 @@ void setup() {

//AsyncWiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
AsyncWiFiManager wifiManager;
AsyncWiFiManager wm;

//set config save notify callback
wifiManager.setSaveConfigCallback(saveConfigCallback);
wm.setSaveConfigCallback(saveConfigCallback);

//set static ip
IPAddress _ip, _gw, _sn;
_ip.fromString(static_ip);
_gw.fromString(static_gw);
_sn.fromString(static_sn);

wifiManager.setSTAStaticIPConfig(_ip, _gw, _sn);
wm.setSTAStaticIPConfig(_ip, _gw, _sn);

//add all your parameters here
wifiManager.addParameter(&custom_mqtt_server);
wifiManager.addParameter(&custom_mqtt_port);
wifiManager.addParameter(&custom_api_token);
wm.addParameter(&custom_mqtt_server);
wm.addParameter(&custom_mqtt_port);
wm.addParameter(&custom_api_token);

//reset settings - for testing
//wifiManager.resetSettings();
//wm.resetSettings();

//set minimu quality of signal so it ignores AP's under that quality
//defaults to 8%
wifiManager.setMinimumSignalQuality();
wm.setMinimumSignalQuality();

//sets timeout until configuration portal gets turned off
//useful to make it all retry or go to sleep
//in seconds
//wifiManager.setTimeout(120);
//wm.setTimeout(120);

//fetches ssid and pass and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
if (!wifiManager.autoConnect("AutoConnectAP", "password")) {
if (!wm.autoConnect("AutoConnectAP", "password")) {
Serial.println("failed to connect and hit timeout");
delay(3000);
//reset and try again, or maybe put it to deep sleep
Expand Down
8 changes: 4 additions & 4 deletions examples/Super/OnDemandConfigPortal/OnDemandConfigPortal.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const char* modes[] = { "NULL", "STA", "AP", "STA+AP" };
unsigned long mtime = 0;


WiFiManager wm;
AsyncWiFiManager wm;


// TEST OPTION FLAGS
Expand All @@ -37,7 +37,7 @@ bool WMISBLOCKING = true; // use blocking or non blocking mode, non global pa

//callbacks
// called after AP mode and config portal has started
// setAPCallback( std::function<void(WiFiManager*)> func );
// setAPCallback( std::function<void(AsyncWiFiManager*)> func );
// called after webserver has started
// setWebServerCallback( std::function<void()> func );
// called when settings reset have been triggered
Expand All @@ -55,8 +55,8 @@ void saveWifiCallback(){
Serial.println("[CALLBACK] saveCallback fired");
}

//gets called when WiFiManager enters configuration mode
void configModeCallback (WiFiManager *myWiFiManager) {
//gets called when AsyncWiFiManager enters configuration mode
void configModeCallback (AsyncWiFiManager *myWiFiManager) {
Serial.println("[CALLBACK] configModeCallback fired");
// myWiFiManager->setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
// Serial.println(WiFi.softAPIP());
Expand Down
12 changes: 6 additions & 6 deletions examples/Unique/cb/AnonymousCB.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ bool _enteredConfigMode = false;

void setup(){
Serial.begin(115200);
WiFiManager wifiManager;
AsyncWiFiManager wm;

// wifiManager.setAPCallback([this](WiFiManager* wifiManager) {
wifiManager.setAPCallback([&](WiFiManager* wifiManager) {
// wm.setAPCallback([this](AsyncWiFiManager* wm) {
wm.setAPCallback([&](AsyncWiFiManager* wm) {
Serial.printf("Entered config mode:ip=%s, ssid='%s'\n",
WiFi.softAPIP().toString().c_str(),
wifiManager->getConfigPortalSSID().c_str());
wm->getConfigPortalSSID().c_str());
_enteredConfigMode = true;
});
wifiManager.resetSettings();
if (!wifiManager.autoConnect()) {
wm.resetSettings();
if (!wm.autoConnect()) {
Serial.printf("*** Failed to connect and hit timeout\n");
ESP.restart();
delay(1000);
Expand Down
6 changes: 3 additions & 3 deletions src/strings_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const char HTTP_SCRIPT[] PROGMEM = "<script>function c(l){"

const char HTTP_HEAD_END[] PROGMEM = "</head><body class='{c}'><div class='wrap'>"; // {c} = _bodyclass
// example of embedded logo, base64 encoded inline, No styling here
// const char HTTP_ROOT_MAIN[] PROGMEM = "<img title=' alt=' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADQElEQVRoQ+2YjW0VQQyE7Q6gAkgFkAogFUAqgFQAVACpAKiAUAFQAaECQgWECggVGH1PPrRvn3dv9/YkFOksoUhhfzwz9ngvKrc89JbnLxuA/63gpsCmwCADWwkNEji8fVNgotDM7osI/x777x5l9F6JyB8R4eeVql4P0y8yNsjM7KGIPBORp558T04A+CwiH1UVUItiUQmZ2XMReSEiAFgjAPBeVS96D+sCYGaUx4cFbLfmhSpnqnrZuqEJgJnd8cQplVLciAgX//Cf0ToIeOB9wpmloLQAwpnVmAXgdf6pwjpJIz+XNoeZQQZlODV9vhc1Tuf6owrAk/8qIhFbJH7eI3eEzsvydQEICqBEkZwiALfF70HyHPpqScPV5HFjeFu476SkRA0AzOfy4hYwstj2ZkDgaphE7m6XqnoS7Q0BOPs/sw0kDROzjdXcCMFCNwzIy0EcRcOvBACfh4k0wgOmBX4xjfmk4DKTS31hgNWIKBCI8gdzogTgjYjQWFMw+o9LzJoZ63GUmjWm2wGDc7EvDDOj/1IVMIyD9SUAL0WEhpriRlXv5je5S+U1i2N88zdPuoVkeB+ls4SyxCoP3kVm9jsjpEsBLoOBNC5U9SwpGdakFkviuFP1keblATkTENTYcxkzgxTKOI3jyDxqLkQT87pMA++H3XvJBYtsNbBN6vuXq5S737WqHkW1VgMQNXJ0RshMqbbT33sJ5kpHWymzcJjNTeJIymJZtSQd9NHQHS1vodoFoTMkfbJzpRnLzB2vi6BZAJxWaCr+62BC+jzAxVJb3dmmiLzLwZhZNPE5e880Suo2AZgB8e8idxherqUPnT3brBDTlPxO3Z66rVwIwySXugdNd+5ejhqp/+NmgIwGX3Py3QBmlEi54KlwmjkOytQ+iJrLJj23S4GkOeecg8G091no737qvRRdzE+HLALQoMTBbJgBsCj5RSWUlUVJiZ4SOljb05eLFWgoJ5oY6yTyJp62D39jDANoKKcSocPJD5dQYzlFAFZJflUArgTPZKZwLXAnHmerfJquUkKZEgyzqOb5TuDt1P3nwxobqwPocZA11m4A1mBx5IxNgRH21ti7KbAGiyNn3HoF/gJ0w05A8xclpwAAAABJRU5ErkJggg==' /><h1>{v}</h1><h3>WiFiManager</h3>";
// const char HTTP_ROOT_MAIN[] PROGMEM = "<img title=' alt=' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADQElEQVRoQ+2YjW0VQQyE7Q6gAkgFkAogFUAqgFQAVACpAKiAUAFQAaECQgWECggVGH1PPrRvn3dv9/YkFOksoUhhfzwz9ngvKrc89JbnLxuA/63gpsCmwCADWwkNEji8fVNgotDM7osI/x777x5l9F6JyB8R4eeVql4P0y8yNsjM7KGIPBORp558T04A+CwiH1UVUItiUQmZ2XMReSEiAFgjAPBeVS96D+sCYGaUx4cFbLfmhSpnqnrZuqEJgJnd8cQplVLciAgX//Cf0ToIeOB9wpmloLQAwpnVmAXgdf6pwjpJIz+XNoeZQQZlODV9vhc1Tuf6owrAk/8qIhFbJH7eI3eEzsvydQEICqBEkZwiALfF70HyHPpqScPV5HFjeFu476SkRA0AzOfy4hYwstj2ZkDgaphE7m6XqnoS7Q0BOPs/sw0kDROzjdXcCMFCNwzIy0EcRcOvBACfh4k0wgOmBX4xjfmk4DKTS31hgNWIKBCI8gdzogTgjYjQWFMw+o9LzJoZ63GUmjWm2wGDc7EvDDOj/1IVMIyD9SUAL0WEhpriRlXv5je5S+U1i2N88zdPuoVkeB+ls4SyxCoP3kVm9jsjpEsBLoOBNC5U9SwpGdakFkviuFP1keblATkTENTYcxkzgxTKOI3jyDxqLkQT87pMA++H3XvJBYtsNbBN6vuXq5S737WqHkW1VgMQNXJ0RshMqbbT33sJ5kpHWymzcJjNTeJIymJZtSQd9NHQHS1vodoFoTMkfbJzpRnLzB2vi6BZAJxWaCr+62BC+jzAxVJb3dmmiLzLwZhZNPE5e880Suo2AZgB8e8idxherqUPnT3brBDTlPxO3Z66rVwIwySXugdNd+5ejhqp/+NmgIwGX3Py3QBmlEi54KlwmjkOytQ+iJrLJj23S4GkOeecg8G091no737qvRRdzE+HLALQoMTBbJgBsCj5RSWUlUVJiZ4SOljb05eLFWgoJ5oY6yTyJp62D39jDANoKKcSocPJD5dQYzlFAFZJflUArgTPZKZwLXAnHmerfJquUkKZEgyzqOb5TuDt1P3nwxobqwPocZA11m4A1mBx5IxNgRH21ti7KbAGiyNn3HoF/gJ0w05A8xclpwAAAABJRU5ErkJggg==' /><h1>{v}</h1><h3>AsyncWiFiManager</h3>";
const char HTTP_ROOT_MAIN[] PROGMEM = "<h1>{t}</h1><h3>{v}</h3>";

const char *const HTTP_PORTAL_MENU[] PROGMEM = {
Expand Down Expand Up @@ -211,12 +211,12 @@ const char HTTP_INFO_stamac[] PROGMEM = "<dt>Station MAC</dt><dd>{1}</dd>";
const char HTTP_INFO_conx[] PROGMEM = "<dt>Connected</dt><dd>{1}</dd>";
const char HTTP_INFO_autoconx[] PROGMEM = "<dt>Autoconnect</dt><dd>{1}</dd>";

const char HTTP_INFO_aboutver[] PROGMEM = "<dt>WiFiManager</dt><dd>{1}</dd>";
const char HTTP_INFO_aboutver[] PROGMEM = "<dt>AsyncWiFiManager</dt><dd>{1}</dd>";
const char HTTP_INFO_aboutarduino[] PROGMEM = "<dt>Arduino</dt><dd>{1}</dd>";
const char HTTP_INFO_aboutsdk[] PROGMEM = "<dt>ESP-SDK/IDF</dt><dd>{1}</dd>";
const char HTTP_INFO_aboutdate[] PROGMEM = "<dt>Build Date</dt><dd>{1}</dd>";

const char S_brand[] PROGMEM = "WiFiManager";
const char S_brand[] PROGMEM = "AsyncWiFiManager";
const char S_debugPrefix[] PROGMEM = "*wm:";
const char S_y[] PROGMEM = "Yes";
const char S_n[] PROGMEM = "No";
Expand Down

0 comments on commit f2b38ca

Please sign in to comment.