Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi - Static IP fails to connect wifi #1081

Closed
mistergreen opened this issue Feb 5, 2018 · 4 comments
Closed

WiFi - Static IP fails to connect wifi #1081

mistergreen opened this issue Feb 5, 2018 · 4 comments

Comments

@mistergreen
Copy link

mistergreen commented Feb 5, 2018

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.

@jliegner
Copy link

jliegner commented Feb 9, 2018

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.

@baggior
Copy link
Contributor

baggior commented Feb 11, 2018

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

@baggior
Copy link
Contributor

baggior commented Feb 20, 2018

created the PR #1129 to fix this

@copercini
Copy link
Contributor

Closed due it's fixed here: #1129

Thanks @baggior !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants