WiFi.softAPdisconnect state

Here is my wifi code, this is only code that controls wifi.

const char* ssid = wifii;
const char* password = "12345678";

IPAddress local_IP(192, 168, 4, 1);
IPAddress subnet(255, 255, 255, 0);

void setup() {
  WiFi.begin(_EEPROM.sta_ssid, _EEPROM.sta_password);

void loop() {
  if (WiFi.status() == WL_CONNECTED) {
    apSwitchMillis = millis();
    if (millis() - lcdMillis >= 5000) {
      WiFi.softAPdisconnect (true);
      lcdMillis = millis();
  } else {
    if (millis() - apSwitchMillis >= apTimeout) {
      if (!apState) {
        WiFi.softAP(ssid, password, 11, false, 8);
        WiFi.softAPConfig(local_IP, local_IP, subnet);
        apState = true;
      apSwitchMillis = millis();

Notice every 5000ms i call WiFi.softAPdisconnect (true);

if i do not do this then the ap stays on. why do i have to keep calling it? does somthing actually keep changing the state of it. i should only have to call it 1 time after ap is turned off?

From the docs it says

Function will set currently configured SSID and password of the soft-AP to null values. The parameter wifioff is optional. If set to true it will switch the soft-AP mode off.
Function will return true if operation was successful or false if otherwise.

why would i want to set ssid and pw to null? why not just turn it off?

Here bug tracker of the function but i cant gather enough information from there to know if it has been fixed or if this is even what is going on.

Your code doesn’t compile, so I guess it wasn’t never used exactly this way.