ayushsharma82 / EasyDDNS

Easy to Use ESP8266 & ESP32 DDNS Update Client Library.
MIT License
195 stars 59 forks source link

http.begin need WiFiClient #28

Closed kkeonline closed 3 years ago

kkeonline commented 3 years ago

By using example code I got this exception error ( Board ESP01s / DDNS dynu )

Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
PC: 0x40217e14: HTTPClient::connected() at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266HTTPClient\src\ESP8266HTTPClient.cpp line 475
EXCVADDR: 0x00000247

Decoding stack results
0x4020d05b: String::reserve(unsigned int) at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\WString.cpp line 146
0x40204ec0: HTTPClient::disconnect(bool) at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266HTTPClient\src\ESP8266HTTPClient.cpp line 434
0x40205c5c: HTTPClient::end() at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266HTTPClient\src\ESP8266HTTPClient.cpp line 425
0x402049e2: EasyDDNSClass::update(unsigned long, bool) at C:\Data\Documents\Man\Cloud\arduino\Projects\libraries\EasyDDNS\EasyDDNS.cpp line 48
0x40100494: millis() at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_wiring.cpp line 188
0x4020866d: esp8266::MDNSImplementation::MDNSResponder::_process(bool) at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266mDNS\src\LEAmDNS_Control.cpp line 90
0x40203360: ESP8266WiFiSTAClass::status() at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src\ESP8266WiFiSTA.cpp line 634
0x40201840: NTPClient::update() at C:\Data\Documents\Man\Cloud\arduino\Projects\libraries\NTPClient\NTPClient.cpp line 96
0x40201464: loop() at C:\Data\Documents\Man\Cloud\arduino\Projects\DDNS_esp01/DDNS_esp01.ino line 141
0x4010039c: ets_post(uint8, ETSSignal, ETSParam) at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 177
0x4020e008: loop_wrapper() at C:\Data\Programs\arduino\Portable\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 197

This because new ESP8266httpClient has changed as lrmoreno007 create a pullrequest sinse 16 Nov 2020

Here is how to modify code.

add between Line 26 and 27 WiFiClient client;

Line 38 from http.begin("http://ipv4bot.whatismyipaddress.com/"); to http.begin(client, "http://ipv4bot.whatismyipaddress.com/");

Line 85 from http.begin(update_url); to http.begin(client, update_url);

alanesq commented 3 years ago

After some experimenting I think the issue is that the "http.getString()" command has also changed and it seems to be returning an empty string. I experimented with using 'client.readStringUntil' instead and this does get the response although there are extra characters included. Note: My broadband is supplied by "Three" in the U.K. I did find the esp8266 did not keep resetting when connected via Virgin but can't confirm if it actually worked although I can not imagine why this would make a difference.

ayushsharma82 commented 3 years ago

Fixed with v1.7.0 release.