Chat freely about anything...

User avatar
By lucasromeiro
#74743
martinayotte wrote:ESPhttpUpdate is using ESP8266HTTPClient which is using WiFiClient not WiFiSecureClient, therefore no HTTPS ...
You will need to create some kind of ESP8266HTTPSecureClient along with ESPhttpsUpdate to do that.


I try... with this code. but dont work...

ERRORS:

/Users/lucas/Documents/Arduino/sketch_mar05a/sketch_mar05a.ino: In function 'void setup()':
sketch_mar05a:72: error: no matching function for call to 'ESP8266HTTPUpdate::update(WiFiClientSecure&, const char*&, const char*&)'
auto ret = ESPhttpUpdate.update(client, host, url);
^
/Users/lucas/Documents/Arduino/sketch_mar05a/sketch_mar05a.ino:72:52: note: candidates are:
In file included from /Users/lucas/Documents/Arduino/sketch_mar05a/sketch_mar05a.ino:15:0:
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:75:25: note: t_httpUpdate_return ESP8266HTTPUpdate::update(const String&, const String&, const String&, bool)
t_httpUpdate_return update(const String& url, const String& currentVersion,
^
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:75:25: note: candidate expects 4 arguments, 3 provided
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:77:25: note: t_httpUpdate_return ESP8266HTTPUpdate::update(const String&, const String&)
t_httpUpdate_return update(const String& url, const String& currentVersion = "");
^
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:77:25: note: candidate expects 2 arguments, 3 provided
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:78:25: note: t_httpUpdate_return ESP8266HTTPUpdate::update(const String&, const String&, const String&)
t_httpUpdate_return update(const String& url, const String& currentVersion,
^
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:78:25: note: no known conversion for argument 1 from 'WiFiClientSecure' to 'const String&'
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:82:25: note: t_httpUpdate_return ESP8266HTTPUpdate::update(const String&, uint16_t, const String&, const String&, bool, const String&, bool)
t_httpUpdate_return update(const String& host, uint16_t port, const String& uri, const String& currentVersion,
^
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:82:25: note: candidate expects 7 arguments, 3 provided
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:85:25: note: t_httpUpdate_return ESP8266HTTPUpdate::update(const String&, uint16_t, const String&, const String&)
t_httpUpdate_return update(const String& host, uint16_t port, const String& uri = "/",
^
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:85:25: note: no known conversion for argument 1 from 'WiFiClientSecure' to 'const String&'
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:87:25: note: t_httpUpdate_return ESP8266HTTPUpdate::update(const String&, uint16_t, const String&, const String&, const String&)
t_httpUpdate_return update(const String& host, uint16_t port, const String& url,
^
/Users/lucas/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h:87:25: note: candidate expects 5 arguments, 3 provided
exit status 1
no matching function for call to 'ESP8266HTTPUpdate::update(WiFiClientSecure&, const char*&, const char*&)'
Biblioteca inválida encontrada em /Users/lucas/Documents/Arduino/libraries/Arduino_POST_HTTP_Parser: Missing


Code: Select all/*
    OTA update over HTTPS
   
    As an example, we download and install ESP8266Basic firmware from github.
   
    Requires latest git version of the core (November 17, 2015)
   
    Created by Ivan Grokhotkov, 2015.
    This example is in public domain.
*/

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <FS.h>
#include "ESP8266httpUpdate.h"

const char* ssid = "...";
const char* password = "...";

const char* host = "raw.githubusercontent.com";
const int httpsPort = 443;

// Use web browser to view and copy
// SHA1 fingerprint of the certificate
const char* fingerprint = "CC AA 48 48 66 46 0E 91 53 2C 9C 7C 23 2A B1 74 4D 29 9D 33";

const char* url = "/esp8266/Basic/master/Flasher/Build/4M/ESP8266Basic.cpp.bin";

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  WiFi.mode(WIFI_STA);
  delay(5000);
  Serial.println();
  Serial.print("connecting to ");
  Serial.println(ssid);

  if (WiFi.SSID() != ssid) {
    WiFi.begin(ssid, password);
  }
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  // configure time
  configTime(3 * 3600, 0, "pool.ntp.org");

  // Use WiFiClientSecure class to create TLS connection
  WiFiClientSecure client;
  Serial.print("connecting to ");
  Serial.println(host);
  if (!client.connect(host, httpsPort)) {
    Serial.println("connection failed");
    return;
  }

  if (client.verify(fingerprint, host)) {
    Serial.println("certificate matches");
  } else {
    Serial.println("certificate doesn't match");
    return;
  }

  Serial.print("Starting OTA from: ");
  Serial.println(url);
 
  auto ret = ESPhttpUpdate.update(client, host, url);
  // if successful, ESP will restart
  Serial.println("update failed");
  Serial.println((int) ret);
}

void loop() {
}
User avatar
By lucasromeiro
#75160 I have had some progress, but when trying to make the update it happens exception 29. lack of memoria.vi this has occurred for some time. Has anyone managed to solve ?? I updated everything, but nothing changed.