Page 1 of 1

Switch from promiscuous to AP mode

Posted: Thu Oct 10, 2019 11:13 pm
by vangalvin
In my setup I have the following to enable me to scan and see if there is a know MAC address near by. Seems to work quite well.
The goal is if there is a known MAC address the unit will switch in to AP mode however I cant seem to find any information about changing this mode on the fly.

Is it possible to do that or will I need to set up a restart on the ESP32 before switching modes?

In my void setup()

Code: Select all

  /* setup wifi */
  wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
  esp_wifi_init(&cfg);
  esp_wifi_set_storage(WIFI_STORAGE_RAM);
  esp_wifi_set_mode(WIFI_MODE_NULL);
  esp_wifi_start();
  esp_wifi_set_promiscuous(true);
  esp_wifi_set_promiscuous_filter(&filt);
  esp_wifi_set_promiscuous_rx_cb(&sniffer);
  esp_wifi_set_channel(curChannel, WIFI_SECOND_CHAN_NONE);