8000 HTTPUpdate problem · Issue #6304 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

HTTPUpdate problem #6304

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

Closed
Jhony9625 opened this issue Jul 15, 2019 · 4 comments
Closed

HTTPUpdate problem #6304

Jhony9625 opened this issue Jul 15, 2019 · 4 comments

Comments

@Jhony9625
Copy link

Hello, I am using the httpUpdate example and I get wrong http code the server link is this: http://qualitysystems.com.co/Blink.bin

I searched the internet and found this 2016 post #2022 I tried what it says but it has not worked and everything I find is very old. I do not know what else to do to solve this problem.

my code:
#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>

#define USE_SERIAL Serial

#ifndef APSSID
#define APSSID "HERMES"
#define APPSK "55469347daz"
#endif

ESP8266WiFiMulti WiFiMulti;

void setup() {

USE_SERIAL.begin(115200);
// USE_SERIAL.setDebugOutput(true);

USE_SERIAL.println();
USE_SERIAL.println();
USE_SERIAL.println();

for (uint8_t t = 4; t > 0; t--) {
USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
USE_SERIAL.flush();
delay(1000);
}

WiFi.mode(WIFI_STA);
WiFiMulti.addAP(APSSID, APPSK);

}

void loop() {
// wait for WiFi connection
if ((WiFiMulti.run() == WL_CONNECTED)) {

WiFiClient client;

// The line below is optional. It can be used to blink the LED on the board during flashing
// The LED will be on during download of one buffer of data from the network. The LED will
// be off during writing that buffer to flash
// On a good connection the LED should flash regularly. On a bad connection the LED will be
// on much longer than it will be off. Other pins than LED_BUILTIN may be used. The second
// value is used to put the LED on. If the LED is on with HIGH, that value should be passed
ESPhttpUpdate.setLedPin(LED_BUILTIN, LOW);

t_httpUpdate_return ret = ESPhttpUpdate.update(client, "http://qualitysystems.com.co/Blink.bin");
// Or:
//t_httpUpdate_return ret = ESPhttpUpdate.update(client, "server", 80, "file.bin");

switch (ret) {
  case HTTP_UPDATE_FAILED:
    USE_SERIAL.printf("HTTP_UPDATE_FAILD Error (%d): %s\n", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
    break;

  case HTTP_UPDATE_NO_UPDATES:
    USE_SERIAL.println("HTTP_UPDATE_NO_UPDATES");
    break;

  case HTTP_UPDATE_OK:
    USE_SERIAL.println("HTTP_UPDATE_OK");
    break;
}

}
}

@Jeroen88
Copy link
Contributor
Jeroen88 commented Jul 16, 2019

I tried your URL for redirects with this tool. HTTPUpdate does not support redirects. I think if you try http://www.qtsolutions.com.co/Blink.bin instead, I think it will work

@liebman
Copy link
Contributor
liebman commented Jul 16, 2019

Redirects are optionally supported. You need to call ESPhttpUpdate.followRedirects(true) to enable it.

@Jhony9625
Copy link
Author

@Jeroen88 Thank you very much for the help, it has worked perfectly, now I will investigate how to make it detect if there is a new update to upload the code automatically.

@liebman I will try to prove what you say, thank you

@earlephilhower
Copy link
Collaborator

Looks like @Jeroen88 and @liebman pointed out the redirect issue, thanks. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0