Arduino-esp32: WiFi - Static IP fails to connect wifi

Created on 5 Feb 2018  ·  4Comments  ·  Source: espressif/arduino-esp32

Hardware:

Board: WEMOS lolin32
Core Installation/update date: Jan/2018
IDE name: Arduino IDE

Description:

IPAddress ip(192,168,1,129);
IPAddress gateway(192,168,1,1); 
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(8, 8, 8, 8); //optional
IPAddress secondaryDNS(8, 8, 4, 4); //optional

if (!WiFi.config(ip, gateway, subnet, primaryDNS, secondaryDNS)) {
    Serial.println("STA Failed to configure");
  }

  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

WiFi.status() won't connect.

If I get rid of WiFi.config(), going with the localIP, Wifi can connect.

Most helpful comment

I can confirm the issue and the solution too
please fix
(Same as #1086 )

All 4 comments

the esp fire in this mode not the event SYSTEM_EVENT_STA_CONNECTED but only SYSTEM_EVENT_STA_GOT_IP.
In WiFiGeneric.cpp Line 318:
WiFiSTAClass::_setStatus(WL_IDLE_STATUS); } else if(event->event_id == SYSTEM_EVENT_STA_GOT_IP) { // JL // if(WiFiSTAClass::status() == WL_IDLE_STATUS) { WiFiSTAClass::_setStatus(WL_CONNECTED); } }
i comment out the line that check of WL_IDLE_STATUS. This help.

I can confirm the issue and the solution too
please fix
(Same as #1086 )

created the PR #1129 to fix this

Closed due it's fixed here: https://github.com/espressif/arduino-esp32/pull/1129

Thanks @baggior !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxgerhardt picture maxgerhardt  ·  3Comments

Darkhub picture Darkhub  ·  3Comments

merlinschumacher picture merlinschumacher  ·  4Comments

mehrdad987 picture mehrdad987  ·  4Comments

Curclamas picture Curclamas  ·  4Comments