Ildarmustafin86
Active member
Раньше я делал так:
C++:
void WiFiEvent(WiFiEvent_t event) {
wifi.working = event;
}
void wifi_connect(byte e) {
switch (e) {
case 0: // WIFI_EVENT_STAMODE_CONNECTED
DEBUG_PRINT("WIFI_EVENT_STAMODE_CONNECTED\n");
break;
case 1: // WIFI_EVENT_STAMODE_DISCONNECTED
WiFi.reconnect();
if (--wifi.countDS) {
DEBUG_PRINT("CONNECTING...TRY:%i\n", wifi.countDS);
} else {
wifi.working = 7;
WiFi_initAP();
wifi.countDS = recTime;
}
break;
case 3: // WIFI_EVENT_STAMODE_GOT_IP
DEBUG_PRINT("WIFI_EVENT_STAMODE_GOT_IP\n");
break;
case 5: // WIFI_EVENT_SOFTAPMODE_STACONNECTED
DEBUG_PRINT("USER CONNECTED\n");
break;
case 6: // WIFI_EVENT_SOFTAPMODE_STADISCONNECTED
DEBUG_PRINT("USER DISCONNECTED\n");
break;
case 7: // WIFI_EVENT_SOFTAPMODE_PROBEREQRECVED
DEBUG_PRINT("WIFI_EVENT_SOFTAPMODE_PROBEREQRECVED\n");
WiFi.scanNetworksAsync(printScanResult);
break;
}
}
//Где-то в коде===================
wifi_connect(wifi.working);
//================================