Open
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: ESP-12
- Core Version: 2.5.0
- Development Env: Arduino IDE
- Operating System: Windows
Settings in IDE
- Module: Generic ESP8266 Module
- Flash Mode: Dout
- Flash Size: 4MB
- lwip Variant: v2 Lower Memory
- Reset Method: ck
- Flash Frequency: 40Mhz
- CPU Frequency: 80Mhz
- Upload Using: SERIAL
- Upload Speed: 115200
Problem Description
unknown device must get ip 192.168.0.102 but never get that ip Sometimes get IP 192.168.0.100 and sometimes 192.168.0.2
MCVE Sketch
#include <ESP8266WiFi.h>
const char *ssid = "ESPap";
const char *password = "thereisnospoon";
IPAddress apIP(192, 168, 0, 1);
void setup() {
struct station_info *stat_info;
String address;
uint8_t i;
uint8 mac_CAM[6] = { 0x00, 0x0C, 0x43, 0x01, 0x60, 0x15 };
uint8 mac_PC[6] = { 0xb4, 0x52, 0x7e, 0x9a, 0x19, 0xa5 };
Serial.begin(74880);
Serial.println();
Serial.println("Configuring access point...");
WiFi.persistent(false);
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
wifi_softap_add_dhcps_lease(mac_CAM); // always 192.168.0.100
wifi_softap_add_dhcps_lease(mac_PC); // always 192.168.0.101
WiFi.softAP(ssid, password);
Serial.print("AP IP address: ");
Serial.println(WiFi.softAPIP());
Serial.println("HTTP server started");
while ( WiFi.softAPgetStationNum() == 0 ) {
delay ( 500 ); Serial.print ( "." );
}
stat_info = wifi_softap_get_station_info();
while (stat_info != NULL) {
address = IPAddress(stat_info->ip).toString();
Serial.print("client= ");
Serial.print(i);
Serial.print(" IP adress is = ");
Serial.print((address));
Serial.print(" Mac : ");
Serial.printf("%02X:%02X:%02X:%02X:%02X:%02X", MAC2STR(stat_info->bssid));
stat_info = STAILQ_NEXT(stat_info, next);
i++;
Serial.println();
}
}
void loop() {
}
Debug Messages
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v951aeffa
~ld
SDK:3.0.0-dev(c0f7b44)/Core:2.5.0=20500000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1/BearSSL:6778687
Configuring access point...
[APConfig] local_ip: 192.168.0.1 gateway: 192.168.0.1 subnet: 255.255.255.0
[APConfig] DHCP IP start: 192.168.0.100
[APConfig] DHCP IP end: 192.168.0.200
bcn 0
del if1
usl
add if1
dhcp server start:(ip:192.168.0.1,mask:255.255.255.0,gw:192.168.0.1)
bcn 100
AP IP address: 192.168.0.1
HTTP server started
..........
wifi evt: 7
add 1
aid 1
station: 40:4a:03:57:a0:de join, AID = 1
wifi evt: 5
wifi evt: 9
client= 0 IP adress is = 192.168.0.2 Mac : 40:4A:03:57:A0:DE