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

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

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

Postby kolban » Wed Dec 21, 2016 6:21 am

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?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 130 guests