Skip to content

how to use AP_STADISCONNECTED to reset ESP #7434

Answered by mrengineer7777
fikririzal asked this question in Q&A
Discussion options

You must be logged in to vote

You can register a WiFi event callback:

//-------------------Local function definitions-------------------
void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info);
//-------------------Local function definitions-------------------

void setup() {
   wifi_event_id_t eventhandler_id = WiFi.onEvent(WiFiEvent);
}

void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
   if(event==ARDUINO_EVENT_WIFI_STA_DISCONNECTED) {
       //Do something based on reason in info.wifi_sta_disconnected.reason
   }
}

Note AP_STADISCONNECTED is actually a client disconnecting from your SoftAP.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fikririzal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants