Page 1 of 1

Call sequence to stop being a station and become an access point ....

Posted: Wed Dec 21, 2016 6:21 am
by kolban
Imagine my ESP32 boots up and connects as a station to an access point. The common flow appears to be:

* esp_wifi_set_mode(WIFI_MODE_STA)
* esp_wifi_set_config(WIFI_IF_STA, ...)
* esp_wifi_start()
* esp_wifi_connect()

Now imagine that the logic of the program decides it wishes to be an access point. What is the "right way" to transition over to this?

There appears to be many possible permutations.

* Do I need to issue a disconnect?
* Do I need to issue an esp_wifi_stop()?
* Should I set the config before switching mode, after switching mode or it doesn't matter?

I tried:
* esp_wifi_set_mode(WIFI_MODE_AP)
* esp_wifi_set_config(WIFI_IF_AP, ...)

But seem to see TWO (i.e. two pairs) of AP_START/AP_STOP events ...

I'm going to experiment more ... but am wondering if there is a recommended recipe?