ESP8266: Always call ‘wifi_wps_enable’ before ‘wifi_set_wps_cb’

For WPS to work on the ESP8266 and using the non-OS SDK, be sure to call wifi_wps_enable() before setting the callback function with wifi_set_wps_cb().

For example:

void wps_start()
{
    wifi_wps_enable(WPS_TYPE_PBC);
    wifi_set_wps_cb(wps_callback);
    wifi_wps_start();
}

In the callback itself, call wifi_wps_disable() before wifi_station_connect().

For example:

void wps_callback(int status)
{
    wifi_wps_disable();
    wifi_station_connect();
}

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.