Open badre2911 opened 5 years ago
why don't you create a pull request?
sorry, I do not know how to do with github, I've never done this kind of manipulation
There is a small bug in the function void EspDrv::setDNS(IPAddress dns_server1) , here is the fixed function that worked for me:
void EspDrv::setDNS(IPAddress dns_server1) { LOGDEBUG(F("> setDNS"));
char buf[16]; sprintf_P(buf, PSTR("%d.%d.%d.%d"), dns_server1[0], dns_server1[1], dns_server1[2], dns_server1[3]);
int ret = sendCmd(F("AT+CIPDNS_CUR=1 ,%s"), 2000, buf); delay(500);
if (ret==TAG_OK) { LOGINFO1(F("IP DNS set"), buf); } }
*** The line in bold is the one I fixed.
client.connect does not work with a hostname with firmware 1.6.2 SDK 2.2.1, I added the WiFi.setDNS method (IPAddress dns_server1) now it work with firmware below.
on file WiFiEsp.h at line 96 uncomment line below // NOT IMPLEMENTED void setDNS(IPAddress dns_server1);
On file WiFiEsp.cpp add function after function void WiFiEspClass::config(IPAddress ip) at line 82 void WiFiEspClass::setDNS(IPAddress dns_server1) { EspDrv::setDNS(dns_server1); }
On file EspDrv.h at line 255 add declaration below /*
On file EspDrv.cpp before function char* EspDrv::getFwVersion() add function below void EspDrv::setDNS(IPAddress dns_server1) { LOGDEBUG(F("> setDNS"));
char buf[16]; sprintf_P(buf, PSTR("%d.%d.%d.%d"), dns_server1[0], dns_server1[1], dns_server1[2], dns_server1[3]);
int ret = sendCmd(F("AT+CIPDNS_CUR=1,\"%s\""), 2000, buf); delay(500);
if (ret==TAG_OK) { LOGINFO1(F("IP DNS set"), buf); } }
that's all.
example using WiFi.setDNS()
IPAddress IPDns(192,168,2,25); //Add line below after WiFi.init(&Serial1) WiFi.setDNS(IPDns);