kolban wrote:It does appear that the semantics are documented ... see:
https://arduino-esp8266.readthedocs.io/ ... html#begin
Notes: * It is possible that calling begin will result in the module being in STA + softAP mode if the module was previously placed into AP mode.
Ok, thats documentation for an ESP8266 not an ESP32 which i have the problem with. See:
https://github.com/espressif/arduino-es ... Client.ino That particular demo from the ESP32 arduino repository may or may not start a softAP with who knows what configuration, and it doesn't handle it. In fact, reading the code one is under the impression that ONLY a Station is being set up. One may or may not be wrong in that regard, hence my problem. What the code does is not Deterministic.
But in any event, the quote does not tell you that this "previously" includes code that ran before the current session and isn't running now. It could easily just mean, if you have previously IN THIS PROGRAM placed the module in AP mode and that's what one would normally think, without the special knowledge that No, the ESP32 will use it's psychic abilities to determine what you mean, not based on what you are telling it to do NOW, but based on what someone once told it to do. Or does it mean that it is a one-way street? Once in softAP mode, always in softAP mode? thatS kind of what the quote could also imply. There is no documentation on how to reverse or compensate for this state of affairs.
The ESP32 documentation does some handwaving and makes cryptic mention of Wifi NVS:
Wi-Fi NVS Flash
If the Wi-Fi NVS flash is enabled, all Wi-Fi configurations set via the Wi-Fi APIs will be stored into flash, and the Wi-Fi driver will start up with these configurations next time it powers on/reboots. However, the application can choose to disable the Wi-Fi NVS flash if it does not need to store the configurations into persistent memory, or has its own persistent storage, or simply due to debugging reasons, etc.
No discussion however of how this impacts the Arduino Libraries, which should have a known functionality. This behaviour is not good, and certainly not good for a person coming at ESP32s fresh. This sort of behaviour (if it exists AT ALL) should be opt-in, not opt-out (however one does that, because the docs don't tell you).
Documented or not does not change the brokenness of the implementation. Further, it is NOT documented that it will be put into a softAP mode if you erase the flash. Which is what happens. The problem is the way it's implemented the behaviour of WiFi.Begin is not deterministic, it's never possible to know what it will do, because what it will do relies on something else which may or may not have happened in the past. Further, none of the demonstration code published takes this into account, and will spuriously start softAP's sometimes, depending, on whatever.
There is also the issue that this creates excessive battery drain, and pollutes half the Wifi band (Channels 1-7) with AP's which are non functional. If you happen to have set up a ESP32 as a master in the past, and then switch it to a slave, it remembers what you did, and you can end up with Multiple AP's with the same name on air at once which leads to all sorts of problems.
ALSO, it is completely at odds with Arduino which is the source of this API. Arduino does not do this at all. It seems to have no valid purpose, although it clearly was implemented to do this very strange thing. If the code has not asked for an AP to be started, then why is one being started at all? It has no functionality, other than to advertise itself, accept connections and cause problems.