esp8266 и BasicHttpsClient

fsdb
Offline
Зарегистрирован: 24.10.2015

добрый день.

пытаюсь проверить скетч из примера. загружаю данный скетч:

/**
   BasicHTTPSClient.ino

    Created on: 20.08.2018

*/

#include <Arduino.h>

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

#include <ESP8266HTTPClient.h>

#include <WiFiClientSecureBearSSL.h>
// Fingerprint for demo URL, expires on June 2, 2021, needs to be updated well before this date
const uint8_t fingerprint[20] = {0x40, 0xaf, 0x00, 0x6b, 0xec, 0x90, 0x22, 0x41, 0x8e, 0xa3, 0xad, 0xfa, 0x1a, 0xe8, 0x25, 0x41, 0x1d, 0x1a, 0x54, 0xb3};

ESP8266WiFiMulti WiFiMulti;

void setup() {

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

  Serial.println();
  Serial.println();
  Serial.println();

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

  WiFi.mode(WIFI_STA);
  WiFiMulti.addAP("router", "777877787778");
}

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

    std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);

    client->setFingerprint(fingerprint);

    HTTPClient https;

    Serial.print("[HTTPS] begin...\n");
    if (https.begin(*client, "https://jigsaw.w3.org/HTTP/connection.html")) {  // HTTPS

      Serial.print("[HTTPS] GET...\n");
      // start connection and send HTTP header
      int httpCode = https.GET();

      // httpCode will be negative on error
      if (httpCode > 0) {
        // HTTP header has been send and Server response header has been handled
        Serial.printf("[HTTPS] GET... code: %d\n", httpCode);

        // file found at server
        if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
          String payload = https.getString();
          Serial.println(payload);
        }
      } else {
        Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());
      }

      https.end();
    } else {
      Serial.printf("[HTTPS] Unable to connect\n");
    }
  }

  Serial.println("Wait 10s before next round...");
  delay(10000);
}

 

В итоге получаю такую ошибку.
Не могу понять что именно происходит

[SETUP] WAIT 4...
wifi evt: 2
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt

connected with router, channel 8
dhcp client start...
wifi evt: 0
ip:192.168.31.209,mask:255.255.255.0,gw:192.168.31.1
wifi evt: 3
[SETUP] WAIT 3...
[SETUP] WAIT 2...
[SETUP] WAIT 1...
[WIFI][APlistAdd] add SSID: router
[HTTPS] begin...
[HTTP-Client][begin] url: https://jigsaw.w3.org/HTTP/connection.html
[HTTP-Client][begin] host: jigsaw.w3.org port: 443 url: /HTTP/connection.html
[HTTPS] GET...
[HTTP-Client][sendRequest] type: 'GET' redirCount: 0
[hostByName] request IP for: jigsaw.w3.org
[hostByName] Host: jigsaw.w3.org IP: 128.30.52.21
:ref 1
BSSL:_connectSSL: start connection
Fatal exception 28(LoadProhibitedCause):
epc1=0x4020b57c, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00300030, depc=0x00000000

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (28):
epc1=0x4020b57c epc2=0x00000000 epc3=0x00000000 excvaddr=0x00300030 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffb10 end: 3fffffc0 offset: 0190
3ffffca0: 3ffffdc0 3ffee7b0 3ffef994 40204f05

rkit
Offline
Зарегистрирован: 23.11.2016

Очевидно что баг в библиотеке или пример устарел.

fsdb
Offline
Зарегистрирован: 24.10.2015

rkit спасибо. а я как то не думал что обновив только до самой последней версии - все заработает.