Perhaps someone can help with a esp / arduino question

sorry yes

While this looks to be a really good summary of everything ESP8266 related sadly the Arduino Core info is somewhat lacking in detail :persevere:

well I finally found the command to shut off the AP

for client mode only

WiFi.mode(WIFI_STA);

to turn AP on or off

WiFi.softAPdisconnect(true);

I don’t think this is a problem with the Arduino/ESP layer. As I’ve said before and is described in the book I mention, the ESP basically an IoT device and the native WiFi is at a lower level than the Arduino Layer. The book I reference points this out and also goes over the various APIs that are used, no doubt by the Arduino layer as well as others, to configure and control the WiFi services.

I did some basic experiments and it appears that when the ESP powers up, the WiFi tries to resume in the last mode that was set. (There is a system call to set these but I don’t see any evidence that is being used.)

Basically, if I put the ESP in AP or STA_AP mode, it will reboot in that mode, over and over again.

If I add:
WiFi.mode(WIFI_STA);
it turns off AP mode and will boot up in STA mode only in subsequent boots.

If AP is being activated implicitly by one of the WiFi methods that you are using, you may need to invoke WiFi.mode(WIFI_STA) again to clear it. You can find out what mode the WiFi is in using WiFi.getMode();

It’s all in that book. I did these experiments using a version of ESP8266SDWebServer, so everything seems to work as I have described with ESP8266WiFi, WiFiClient, ESP8266WebServer.