zhouhan0126/WIFIMANAGER-ESP32

Can't get custom parameters to work

JasXSL opened this issue · 1 comments

Code:

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?

Just realized I posted on the wrong repo, closing as invalid I guess