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

v3.0.0 compile error with ESPhttpUpdate #8052

Closed
JimDrewGH opened this issue May 19, 2021 · 8 comments
Closed

v3.0.0 compile error with ESPhttpUpdate #8052

JimDrewGH opened this issue May 19, 2021 · 8 comments
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.

Comments

@JimDrewGH
Copy link

JimDrewGH commented May 19, 2021

[X] This issue complies with the issue POLICY doc.
[X] I have read the documentation at readthedocs and the issue is not addressed there.
[X] I have tested that the issue is present in current master branch (aka latest git).
[X] I have searched the issue tracker for a similar issue.
[ ] If there is a stack dump, I have decoded it.
[X] I have filled out all fields below.

  • Hardware: ESP-12F

  • Core Version: v3.0.0 (05/18/2021) - release

  • Development Env: Arduino IDE

  • Operating System: Windows|

  • Module: Nodemcu 1.0 (and others)

  • Flash Mode: qio

  • Flash Size: 4MB

  • lwip Variant: v2 Lower Memory (ALL other options also tested)

  • Reset Method: nodemcu

  • Flash Frequency: 40Mhz

  • CPU Frequency: 80Mhz

  • Upload Using: SERIAL

  • Upload Speed: 115200

PROBLEM

Any code using any part of the ESP8266httpUpdate class no longer compiles successfully as of v3.0.0. It works fine with all previous versions. Below is the error, followed by a sketch which is the example given on the current documentation page, found here:

https://arduino-esp8266.readthedocs.io/en/3.0.0/ota_updates/readme.html#http-server

ERROR:

update_error.txt

SKETCH:


#include <ESP8266httpUpdate.h>

void setup() {
  // put your setup code here, to run once:

  DoUpdate();
}

void loop() {
  // put your main code here, to run repeatedly:

}


void DoUpdate() {
 t_httpUpdate_return ret = ESPhttpUpdate.update("192.168.0.2", 80, "/esp/update/arduino.php", "optional current version string here");

  switch (ret) {
    case HTTP_UPDATE_FAILED:
      Serial.println("[update] Update failed.");
      break;
    case HTTP_UPDATE_NO_UPDATES:
      Serial.println("[update] Update no Update.");
      break;
    case HTTP_UPDATE_OK:
      Serial.println("[update] Update ok."); // may not be called since we reboot the ESP
      break;
  }

@JimDrewGH JimDrewGH changed the title v3.0.0 compile error with ESPhttpupdate v3.0.0 compile error with ESPhttpUpdate May 19, 2021
@earlephilhower
Copy link
Collaborator

What exact version of the core does your example compile on? I see nothing like the prototype you're using in the change logs from 2.7.4 to now.

It's quite possible the docs got rusty over time, true, but we do have examples in the core that build and run w/the update and supported update prototypes as part of CI.

@earlephilhower earlephilhower added the waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. label May 19, 2021
@earlephilhower
Copy link
Collaborator

@JimDrewGH
Copy link
Author

JimDrewGH commented May 19, 2021

The example compiles on EVERY version of the core from 2.3.0 to 2.7.4. I have literally used every single version as they were released over the last 5 or so years with zero issues. Today I updated to 3.0.0 (using the Arduino IDE's board manager function) and get the error you see. Going back to 2.7.4 fixed it. I then went to 2.3.0 and that worked, back 3.0.0 and it failed - back to 2.4.0 and that worked - back to 3.0.0 and it failed. So, I am back on 2.7.4 until this issue is resolved. I have to have the OTA function.

@JimDrewGH
Copy link
Author

JimDrewGH commented May 19, 2021

Just copy and paste the above simple example (it's not mine - that came right from the v3.0.0 documentation page) into a new project and run the compiler. Try with the v3.0.0 core and you will see the error, then go install the v2.7.4 core and you will see that it compiles just fine.

@earlephilhower
Copy link
Collaborator

Per 2.7.4's compile warnings, the example used a deprecated in 2.7.4, removed in 3.0 way of accessing httpUpdate.

This is as-intended, because there are issues when the connection is not owned by the app itself.

/home/earle/Arduino/sketch_may18a/sketch_may18a.ino: In function 'void DoUpdate()':
/home/earle/Arduino/sketch_may18a/sketch_may18a.ino:16:133: warning: 't_httpUpdate_return ESP8266HTTPUpdate::update(const String&, uint16_t, const String&, const String&)' is deprecated (declared at /home/earle/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:131) [-Wdeprecated-declarations]
  t_httpUpdate_return ret = ESPhttpUpdate.update("192.168.0.2", 80, "/esp/update/arduino.php", "optional current version string here");

You're going to have to update the application, or stick to the obsolete core versions.

@JimDrewGH
Copy link
Author

FWIW, even in verbose mode under the Arduino IDE I do not get this deprecated warning during the compile.

@JimDrewGH
Copy link
Author

BTW, you DO get a deprecated warning when using Platform I/O (which I do not use), but there is NO such warning under the Arduino IDE, even in verbose mode.

@ramanraja
Copy link

Was this issue settled? I stumbled upon the same error with the same code. Then I realized that the signature of ESPhttpUpdate.update() has changed. Now it takes an additional parameter of a client object (like WiFiClient) before the URL.

WiFiClient client;
ESPhttpUpdate.update(client, url) ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

No branches or pull requests

3 participants