Skip to content

WiFi.config(fixedIP, fixedGateway, fixedNetmask) disconnects ESP on 2.5.0 (regression from 2.4.2) #5839

Closed
@newHeiko

Description

@newHeiko

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. (no stack dump)
  • I have filled out all fields below.

Platform

  • Hardware: [ESP-12]
  • Core Version: [2.5.0]
  • Development Env: [Arduino IDE]
  • Operating System: [Slackware Linux]

Settings in IDE

  • Module: [Nodemcu]
  • Flash Mode: [unknown]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

When changing the IP address configuration with WiFi.config after connecting, 2.5.0 just releases the DHCP lease and returns the IP address but does not enable the fixed IP address. This works on 2.4.2.

After a disconnect->reconnect cycle, 2.5.0 activates the fixed IP address. (Side note: This seems shaky on 2.4.2 - does not work every time)

I checked the github web interface but could not make out any relevant changes to the ESP8266WiFi tree since 2.5.0, so I hope it's OK that I did not check latest-git.

If you need any more info, just go ahead and ask :)

Heiko

May be related to #5757 ?

MCVE Sketch

#include <ESP8266WiFi.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  delay(100);

  IPAddress fixedIP(192, 168, 205, 225);
  IPAddress fixedGateway(192, 168, 205, 250);
  IPAddress fixedNetmask(255, 255, 255, 0);

  WiFi.config(0u, 0u, 0u);
  WiFi.begin("ssid", "psk");

  delay(10000);

  Serial.println("Switching to fixed IP - this is where 2.4.2 starts to respond to pings to .225, 2.5.0 does not");
  WiFi.config(fixedIP, fixedGateway, fixedNetmask);

  delay(5000);

  Serial.println("Reconnecting");
  WiFi.disconnect();
  delay(1000);
  WiFi.begin("ssid", "psk");
  Serial.println("Now 2.5.0 responds to pings to .225");
}

void loop() {
  // put your main code here, to run repeatedly:

}

Debug Messages on 2.5.0

0x2d
csum 0x2d
v951aeffa
~ld
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with jmri-american, channel 1
dhcp client start...
ip:192.168.205.228,mask:255.255.255.0,gw:192.168.205.250
Switching to fixed IP - this is where 2.4.2 starts to respond to pings to .225, 2.5.0 does not
pm open,type:2 0
Reconnecting
state: 5 -> 0 (0)
rm 0
pm close 7
Now 2.5.0 responds to pings to .225
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with jmri-american, channel 1
ip:192.168.205.225,mask:255.255.255.0,gw:192.168.205.250
ip:192.168.205.225,mask:255.255.255.0,gw:192.168.205.250
pm open,type:2 0

Debug Messages on 2.4.2

0x2d
csum 0x2d
vbb28d4a3
~ld
scandone
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with jmri-american, channel 1
dhcp client start...
ip:192.168.205.228,mask:255.255.255.0,gw:192.168.205.250
Switching to fixed IP - this is where 2.4.2 starts to respond to pings to .225, 2.5.0 does not
ip:192.168.205.225,mask:255.255.255.0,gw:192.168.205.250
pm open,type:2 0
Reconnecting
state: 5 -> 0 (0)
rm 0
pm close 7
Now 2.5.0 responds to pings to .225
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with jmri-american, channel 1
ip:192.168.205.225,mask:255.255.255.0,gw:192.168.205.250
ip:192.168.205.225,mask:255.255.255.0,gw:192.168.205.250
pm open,type:2 0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions