You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This problem has been reproduced with https://github.com/esp8266/Arduino at master, 2.4.0-rc1, and update_sdk_2.1.0, which includes version 2.1.0 of this repository, as you would expect.
Description
The SoftAP never populates station info list after short power-off cycle. It will behave normally when booting after a long power-off time, or when a client manually disconnects and then reconnects.
But after only a short power-cycle, the client will automatically reconnect but not be included in the station info list. It will report the correct number of authenticated stations in wifi_softap_get_station_num(), but will not refresh their DHCP lease or add them to the list accessible via wifi_softap_get_station_info().
Sketch
#include<ESP8266WiFi.h>// include plain C libraryextern"C" {
#include"user_interface.h"
}
/* Define your own special thing that looks like a HardwareSerial and include it by building with * -DDEBUG_ESP_PORT=Debug, if you like. You don't want mine. ;-) */
#ifdef DEBUG_ESP_PORT
#include"Debug.h"
SerialDebugOut Debug;
#else
#defineDebug Serial
#endif
#defineYOUR_WIFI_SSID"esp8266_ap"
#defineYOUR_WIFI_PASSWD""
boolean waitingDHCP=false;
char last_mac[18];
// Manage incoming device connection on ESP access pointvoidonNewStation(WiFiEventSoftAPModeStationConnected sta_info) {
Debug.printf("New Station :\n");
sprintf(last_mac, MACSTR, MAC2STR(sta_info.mac));
Debug.printf("MAC address : %s\n",last_mac);
Debug.printf("Id : %d\n", sta_info.aid);
waitingDHCP=true;
}
voidsetup() {
static WiFiEventHandler e1;
Debug.begin(921600);
Debug.setDebugOutput(true);
Debug.println();
WiFi.mode(WIFI_AP);
WiFi.softAP( YOUR_WIFI_SSID, YOUR_WIFI_PASSWD );
// Event subscriptione1 = WiFi.onSoftAPModeStationConnected(onNewStation);
}
boolean deviceIP(char* mac_device, String &cb, int& list_len);
voidloop() {
if (waitingDHCP) {
String cb;
int list_len = 0;
if (deviceIP(last_mac, cb, list_len)) {
Debug.printf( "Ip address: %s\n", cb.c_str() );
} else {
Debug.printf( "Problem during ip address request: %s", cb.c_str() );
}
Debug.printf( "Stations: %d list: %d\n", wifi_softap_get_station_num(), list_len );
}
delay(2000);
}
boolean deviceIP(char* mac_device, String &cb, int& list_len) {
structstation_info *station_list = wifi_softap_get_station_info();
list_len = 0;
while (station_list != NULL) {
++list_len;
char station_mac[18] = {0}; sprintf(station_mac, MACSTR, MAC2STR(station_list->bssid));
String station_ip = IPAddress((&station_list->ip)->addr).toString();
if (strcmp(mac_device,station_mac)==0) {
waitingDHCP=false;
cb = station_ip;
returntrue;
}
station_list = station_list->next;
}
wifi_softap_free_station_info();
cb = "DHCP not ready or bad MAC address";
returnfalse;
}
Debug Messages
<power on, and manually connect PC client a little later>
[AP] softap config unchanged
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
add 1
aid 1
station: 74:da:38:09:bc:0b join, AID = 1
wifi evt: 5
New Station :
MAC address : 74:da:38:09:bc:0b
Id : 1
Ip address: 192.168.4.2
Stations: 1 list: 1
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
<short (<10 second) power-off-on cycle here>
[AP] softap config unchanged
add 1
aid 1
station: 74:da:38:09:bc:0b join, AID = 1
wifi evt: 5
New Station :
MAC address : 74:da:38:09:bc:0b
Id : 1
Problem during ip address request: DHCP not ready or bad MAC address
Stations: 1 list: 0
Problem during ip address request: DHCP not ready or bad MAC address
Stations: 1 list: 0
Problem during ip address request: DHCP not ready or bad MAC address
Stations: 1 list: 0
Problem during ip address request: DHCP not ready or bad MAC address
Stations: 1 list: 0
wifi evt: 7
wifi evt: 7
wifi evt: 7
Problem during ip address request: DHCP not ready or bad MAC address
Stations: 1 list: 0
As you can see, the low-level debug output goes through the same sequence of events in both cases. In the short power-off case, the "wifi evt: 5" station connected event does trigger the user station connected handler, and count the client in the number of connected stations. The PC client actually connects, and reuses their previous DHCP lease, but the lease isn't refreshed (no dhcp client output in syslog), and the client list doesn't contain any items in the linked list.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Basic Information
This is a copy of the issue esp8266/Arduino#3638, because I believe the ultimate problem is in the closed-source low-level SDK.
https://github.com/esp8266/Arduino + https://github.com/plerup/makeEspArduino
This problem has been reproduced with https://github.com/esp8266/Arduino at master, 2.4.0-rc1, and update_sdk_2.1.0, which includes version 2.1.0 of this repository, as you would expect.
Description
The SoftAP never populates station info list after short power-off cycle. It will behave normally when booting after a long power-off time, or when a client manually disconnects and then reconnects.
But after only a short power-cycle, the client will automatically reconnect but not be included in the station info list. It will report the correct number of authenticated stations in wifi_softap_get_station_num(), but will not refresh their DHCP lease or add them to the list accessible via wifi_softap_get_station_info().
Sketch
Debug Messages
As you can see, the low-level debug output goes through the same sequence of events in both cases. In the short power-off case, the "wifi evt: 5" station connected event does trigger the user station connected handler, and count the client in the number of connected stations. The PC client actually connects, and reuses their previous DHCP lease, but the lease isn't refreshed (no dhcp client output in syslog), and the client list doesn't contain any items in the linked list.
The text was updated successfully, but these errors were encountered: