ManiacalLabs / ESPSerialWiFiManager

MIT License
6 stars 1 forks source link

Basic.ino - Option to always show manager #2

Closed haooken closed 8 years ago

haooken commented 8 years ago

In the Basic.ino example, would it be helpful to demonstrate a way to always have the manager show up, even if a valid network connection can be established? Currently, the manager is not displayed unless there is no valid connection. If the user configures a valid network connection, and say they want to change it later, there's no way to do that (unless the configured network is down/out of range). Maybe something like this:

#define RUN_MGR_ON_REBOOT 1 //If set to 1, the manager prompt appears every power cycle

ESPSerialWiFiManager esp = ESPSerialWiFiManager();

void setup(){
    Serial.begin(115200);
    esp.begin();

    if(RUN_MGR_ON_REBOOT || esp.status() != WL_CONNECTED)
        esp.run_menu(10);
}

This also moves the logic to run the manager into setup() and leaves loop() clear for whatever the user wants to do.