void initWifi( bool force ){
WiFiManager wifiManager;
wifiManager.setAPCallback(configModeCallback);
wifiManager.setSaveConfigCallback(configModeSaveCallback);
WiFiManagerParameter par("Device ID", "Your device ID", "", 64);
wifiManager.addParameter(&par);
String ssid = getssid();
if( force ){
if( !wifiManager.startConfigPortal(ssid.c_str()) ){
Serial.println("failed to connect and hit timeout");
//reset and try again, or maybe put it to deep sleep
ESP.restart();
delay(1000);
}
}
else if( !wifiManager.autoConnect(ssid.c_str()) ){
Serial.println("failed to connect and hit timeout");
//reset and try again, or maybe put it to deep sleep
ESP.restart();
delay(1000);
}
Serial.println("New device ID: ");
Serial.println(par.getValue());
}
Problem I'm facing is that par.getValue always prints a blank line, regardless of what I put in the box. Wifi settings are updated properly and it connects. Am I doing something wrong here?
Code:
Problem I'm facing is that par.getValue always prints a blank line, regardless of what I put in the box. Wifi settings are updated properly and it connects. Am I doing something wrong here?