-->
Page 1 of 2

Disabling the default SoftAP?

PostPosted: Thu Sep 13, 2018 4:16 pm
by Darren Humphrey
I am using the softAP functionality to start a SoftAP with a custom name (i.e. "MyApName"). This is working fine. But sometimes I see an AP named ESP_XXYYZZ, where XXYYZZ is the last 3 bytes of the MAC address.

Is there a way to prevent ESP_XXYYZZ from appearing? I can't find any reference to it anywhere.

Re: Disabling the default SoftAP?

PostPosted: Fri Sep 14, 2018 1:06 am
by Pablo2048
Show us your code, where you are setting WiFi class (probably in your setup()).

Re: Disabling the default SoftAP?

PostPosted: Fri Sep 14, 2018 4:21 pm
by Darren Humphrey
Pablo2048 wrote:Show us your code, where you are setting WiFi class (probably in your setup()).


Here it is. Some of the code may be unneeded. I was having a lot of trouble with wifi reliability and was trying some of the solutions I found online.

// This generates a string based on the mac address: like MyAp_XXYYZZ
String apName = MakeAccessPointName();

// Shut down Wifi first
WiFi.persistent(false);
WiFi.disconnect(true);
WiFi.mode(WIFI_OFF);
delay(100);

// disable modem sleep to prevent wifi disconnects
WiFi.setSleepMode(WIFI_NONE_SLEEP);

WiFi.hostname( apName.c_str() );

bool success = WiFi.softAP(apName.c_str(), _apPassword->Value().c_str());

if (!success)
{
Serial.printf("SoftAP Failed To Start");
}
else
{
WiFi.mode(WIFI_AP);
Serial.printf("Started SoftAP '%s"),apName.c_str());

IPAddress ipAddr(192,168,4,1);

WiFi.softAPConfig( ipAddr, ipAddr, IPAddress(255, 255, 255, 0));

delay(500);

}

Re: Disabling the default SoftAP?

PostPosted: Sat Sep 15, 2018 2:41 am
by Pablo2048
The problem can be in sequence of calls to SoftAP initialization IMHO. I'm using this:
Code: Select allWiFi.persistent(true);
WiFi.mode(WIFI_AP);
boolean result = WiFi.softAP("SoftAP_xxyy", "admin");

There is no need to set AP mode after .softAP() call IMHO and softAPConfig has to be called after delay(100).