void WifiConnetionEspAT::begin(){
	tcpTimeout.enable();
	statusTimeout.enable();
	memset(ipaddress, 0, 15);

	if((_mode == WIFI_AP || _mode == WIFI_AP_STA) && !softAPEnabled /* => Avoid duplicate config*/ ){
		softAP(Config.moduleName, ""); // no password
	}

	bool status = ESP->enableMUX();

#if DEBUG_SETUP
	Logger.debug("MUX", (status ? "OK" : "FAIL")); // FIXME: use F("...") to reduce memory.
#endif

	status = ESP->startTCPServer(DEFAULT_SERVER_PORT);

#if DEBUG_SETUP
	Logger.debug("TCP", (status ? "OK" : "FAIL")); // FIXME: use F("...") to reduce memory.
#endif

	if(status) ESP->setTCPServerTimeout(20000);

	if(status){
		_statusTcp = WL_CONNECTED;
		delay(500);
		getIP(); // required.
		Logger.debug("IP", ipaddress);
		ESP->registerUDP(DISCOVERY_ID, "", DISCOVERY_PORT); // enable discovery port
	}else{
		_statusTcp = WL_CONNECT_FAILED;
	}

	DeviceConnection::begin();

#if DEBUG_SETUP
	Logger.debug("Begin", (status ? "OK" : "FAIL")); // FIXME: use F("...") to reduce memory.
#endif

}
Ejemplo n.º 2
0
void ESP8266WiFiClass::softAP(const char* ssid)
{
    softAP(ssid, 0);
}