Skip to content

Something wrong with WiFi.config(...) and WiFi.status() #6495

Closed
@ruggi99

Description

@ruggi99

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.
  • I have filled out all fields below.

Platform

  • Hardware: [ESP-12E]
  • Core Version: [2.5.2]
  • Development Env: [Arduino IDE]
  • Operating System: [Windows]

Settings in IDE

  • Module: [Generic ESP8266 Module]
  • Flash Mode: [qio|dio|other] (Don't know)
  • 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 I upload this sketch to my NodeMCU I see that WiFi.status() always returns WL_CONNECTED after a call to WiFi.config(...) and it doesn't if WiFi.config(...) is commented out. I use "Erase Sketch + WiFi settings" (option from arduino IDE's menu) each time I flash this sketch.
Even if i put a delay(1000) after WiFi.config(...) it doesn't work. Is it a bug?
Couldn't try the sketch with the latest git because it fails (it says it cannot execute "tools/python3/python3" if I understood correctly)

MCVE Sketch

#include <Arduino.h>
#include <ESP8266WiFi.h>

void setup() {
  Serial.begin(9600);
  Serial.println()
  Serial.println("Hello!");
  
  WiFi.mode(WIFI_STA);
  WiFi.config(IPAddress(192, 168, 1, 50), IPAddress(192, 168, 1, 1), IPAddress(255, 255, 255, 0));
  if (WiFi.status() == WL_CONNECTED) {
    Serial.println("Connected!");
  } else {
    Serial.println("Not connected!");
  }
}

void loop() {

}

Debug Messages


Hello!
Connected!

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