-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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.Config() setting wrong IP Address #540
Comments
How about when you use this syntax 'IPAddress chip( 192, 168, 10, 22 )' ? |
I think this is related to #500 which was closed by the original reporter. Anyway, I cannot set static IP addresses either. So probably the issue should be kept open for other people to find it. |
This seemed to work, thanks for the help. |
After IDF has been updated last night, I gave it a shot again. But I see rather confusing behaviour when trying to set a static IP address. First of all, the IP address can be set without any issue, but name resolution fails afterwards. Even though, when i read back the config the DNS server(s) have been configured correctly. Second the SoftAP sometimes ignores the configured IP address and defaults to 192.168.4.1 without me being able to recognize a pattern, when it happens. But I think when it happens, the stack canary exception will trigger the next time the WiFi Event callback is called. I would appreciate if someone could comment, if static IP configuration DOES indeed work for them INCLUDING name resolution and SoftAP (or at least name resolution). THX |
// STA Static IP
if(!WiFi.config(IPAddress(169, 254, 1, 3), IPAddress(10, 0, 0, 1), IPAddress(255, 255, 0, 0), IPAddress(10, 0, 0, 1))){
Serial.println("STA Failed to configure");
}
if(WiFi.begin(STA_SSID, STA_PASS) == WL_CONNECT_FAILED){
Serial.println("STA Failed to start");
}
// AP Static IP
if(!WiFi.softAPConfig(IPAddress(192, 168, 5, 1), IPAddress(192, 168, 5, 1), IPAddress(255, 255, 255, 0))){
Serial.println("AP Config Failed");
}
if(!WiFi.softAP(AP_SSID)){
Serial.println("AP Start Failed");
} @everslick this is what worked for me. Did not notice issues with resolution |
Static IP configuration started working after IoT was updated a view days ago, so I suggest closing this issue. The second problem regarding WiFi.softAPConfig() not setting the configuration turned out to be a race condition between calling WiFi.softAP() and then setting the config with WiFi.softAPConfig(). The solution is to:
Not waiting for the SYSTEM_EVENT_AP_START event might overwrite the config one has just set for the interface. |
Closing since the original and the related issue seem resolved. |
The following issue is present for me when using WiFi.config.
Code:
Result of code is:
Seems like every number I put in the last parameter of IPAddress is assigned as the first number of the new IP address, all other parameters are discarded.
The text was updated successfully, but these errors were encountered: