I'm still a newbie on the ESP8266 but I have a ESP-01 and I have flashed it with the latest AT firmware found here https://github.com/espressif/esp8266_at/tree/master/bin. I'm using the Arduino 1.6.4 IDE and everything seems to work as expected but I have a question about setting a static IP address for the device.
If I set the IP after I connect it works but based on other sources I should be able to do it before I do WiFi.begin. This works but what happens if there is no DHCP server? I assume that the device will try to get a DHCP address before looking at the next line of code and that will introduce a long wait, right?
And how do I set a DNS server? By looking at the source code here https://github.com/esp8266/Arduino/blob/esp8266-sdk-1.0/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp I thought that it could be set like this:
based on this code:
void ESP8266WiFiClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns)
struct ip_info info;
info.ip.addr = static_cast<uint32_t>(local_ip);
info.gw.addr = static_cast<uint32_t>(gateway);
info.netmask.addr = static_cast<uint32_t>(subnet);
// Set DNS-Server
d.addr = static_cast<uint32_t>(dns);
_useStaticIp = true;
but I get this
...packages/esp8266/hardware/esp8266/1.6.4-673-g8cd3697/libraries/ESP8266WiFi/src/ESP8266WiFi.h:88:10: note: candidate expects 3 arguments, 4 provided
no matching function for call to 'ESP8266WiFiClass::config(IPAddress&, IPAddress&, IPAddress&, IPAddress&)'
Thanks in advance!