Skip to content

WiFi.disconnect() bug #4843

Closed
Closed
@aerlon

Description

@aerlon

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:
    SDK:2.2.1(cfd48f3)/Core:win-2.5.0-dev/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-10-g0c0d8c2)/BearSSL:94e9704
    SDK:2.2.1(cfd48f3)/Core:win-2.5.0-dev/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-11-gc4150ca)/BearSSL:94e9704
  • Development Env: Arduino IDE
  • Operating System: Windows

Settings in IDE

  • Module: NodeMCU 1.0
  • Flash Mode: dio
  • Flash Size: 4MB
  • lwip Variant: v2 Lower Memory
  • Reset Method: nodemcu
  • Flash Frequency: 40Mhz
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 115200

Problem Description

The fix for issue #4792 and #4711 and #4727 causes WiFi.disconnect() to misbehave. In WiFiDisconnectBug.ino (download below) one will find that WiFi.disconnect() works immediately as long as the fix is not applied. Once the lwIP2 fix is applied WiFi.disconnect() will only work the second time it is called (WiFi.status() == WL_CONNECTED is still true after the first WiFi.disconnect() call).

Due to the bug described in #4727 the example code will also fail to reconnect after the first disconnect when the lwIP2 fix is not applied. That behaviour is corrected by the fix.

Instructions for reproducing bug:

  1. Download and unzip the .ino files in WiFiDisconnectBug.zip.
  2. Make sure you are using the latest master branch of Arduino core for ESP8266 and lwIP2 without the WiFi.status() incorrect after reconnection #4792 fix.
  3. Add AP1.ino to one ESP8266 and WiFiDisconnectBug.ino to another.
  4. Observe serial output from WiFiDisconnectBug.ino. Note that the debug messages in the serial monitor show "Disconnected after we called WiFi.disconnect()."
  5. Apply the WiFi.status() incorrect after reconnection #4792 lwIP2 fix, restart IDE and re-upload WiFiDisconnectBug.ino.
  6. Observe serial output from WiFiDisconnectBug.ino. Note that the debug messages in the serial monitor first shows "Connected even though we called WiFi.disconnect()." and then the second time the code calls WiFi.disconnect() "Disconnected after we called WiFi.disconnect().".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions