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

[SSL] timeout on second connection #6165

Closed
1 task done
vlastahajek opened this issue Jan 20, 2022 · 2 comments · Fixed by #6166
Closed
1 task done

[SSL] timeout on second connection #6165

vlastahajek opened this issue Jan 20, 2022 · 2 comments · Fixed by #6166
Labels
Area: BT&Wifi BT & Wifi related issues

Comments

@vlastahajek
Copy link
Contributor

vlastahajek commented Jan 20, 2022

Board

DOIT ESP32 DevKit V1

Device Description

DOIT ESP32 DevKit V1

Hardware Configuration

Not related

Version

v2.0.2

IDE Name

Arduino IDE

Operating System

Windows 10

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600

Description

When set HTTPClient::setReuse(false), 2nd https connection fails.

This is a regression from 2.0.1, most probably caused by #5945 in ssl_client.cpp:339, where all fields of sslclient_context are cleared, including handshake_timeout. Second call of start_ssl_client then fails on handshake_timeout.

Sketch

/**
   BasicHTTPSClient.ino

    Created on: 14.10.2018

*/

#include <Arduino.h>

#include <WiFi.h>

#include <HTTPClient.h>

#include <WiFiClientSecure.h>

// This is GandiStandardSSLCA2.pem, the root Certificate Authority that signed 
// the server certifcate for the demo server https://jigsaw.w3.org in this
// example. This certificate is valid until Sep 11 23:59:59 2024 GMT
const char* rootCACertificate = \
"-----BEGIN CERTIFICATE-----\n" \
"MIIF6TCCA9GgAwIBAgIQBeTcO5Q4qzuFl8umoZhQ4zANBgkqhkiG9w0BAQwFADCB\n" \
"iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl\n" \
"cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV\n" \
"BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQw\n" \
"OTEyMDAwMDAwWhcNMjQwOTExMjM1OTU5WjBfMQswCQYDVQQGEwJGUjEOMAwGA1UE\n" \
"CBMFUGFyaXMxDjAMBgNVBAcTBVBhcmlzMQ4wDAYDVQQKEwVHYW5kaTEgMB4GA1UE\n" \
"AxMXR2FuZGkgU3RhbmRhcmQgU1NMIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IB\n" \
"DwAwggEKAoIBAQCUBC2meZV0/9UAPPWu2JSxKXzAjwsLibmCg5duNyj1ohrP0pIL\n" \
"m6jTh5RzhBCf3DXLwi2SrCG5yzv8QMHBgyHwv/j2nPqcghDA0I5O5Q1MsJFckLSk\n" \
"QFEW2uSEEi0FXKEfFxkkUap66uEHG4aNAXLy59SDIzme4OFMH2sio7QQZrDtgpbX\n" \
"bmq08j+1QvzdirWrui0dOnWbMdw+naxb00ENbLAb9Tr1eeohovj0M1JLJC0epJmx\n" \
"bUi8uBL+cnB89/sCdfSN3tbawKAyGlLfOGsuRTg/PwSWAP2h9KK71RfWJ3wbWFmV\n" \
"XooS/ZyrgT5SKEhRhWvzkbKGPym1bgNi7tYFAgMBAAGjggF1MIIBcTAfBgNVHSME\n" \
"GDAWgBRTeb9aqitKz1SA4dibwJ3ysgNmyzAdBgNVHQ4EFgQUs5Cn2MmvTs1hPJ98\n" \
"rV1/Qf1pMOowDgYDVR0PAQH/BAQDAgGGMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYD\n" \
"VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMCIGA1UdIAQbMBkwDQYLKwYBBAGy\n" \
"MQECAhowCAYGZ4EMAQIBMFAGA1UdHwRJMEcwRaBDoEGGP2h0dHA6Ly9jcmwudXNl\n" \
"cnRydXN0LmNvbS9VU0VSVHJ1c3RSU0FDZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNy\n" \
"bDB2BggrBgEFBQcBAQRqMGgwPwYIKwYBBQUHMAKGM2h0dHA6Ly9jcnQudXNlcnRy\n" \
"dXN0LmNvbS9VU0VSVHJ1c3RSU0FBZGRUcnVzdENBLmNydDAlBggrBgEFBQcwAYYZ\n" \
"aHR0cDovL29jc3AudXNlcnRydXN0LmNvbTANBgkqhkiG9w0BAQwFAAOCAgEAWGf9\n" \
"crJq13xhlhl+2UNG0SZ9yFP6ZrBrLafTqlb3OojQO3LJUP33WbKqaPWMcwO7lWUX\n" \
"zi8c3ZgTopHJ7qFAbjyY1lzzsiI8Le4bpOHeICQW8owRc5E69vrOJAKHypPstLbI\n" \
"FhfFcvwnQPYT/pOmnVHvPCvYd1ebjGU6NSU2t7WKY28HJ5OxYI2A25bUeo8tqxyI\n" \
"yW5+1mUfr13KFj8oRtygNeX56eXVlogMT8a3d2dIhCe2H7Bo26y/d7CQuKLJHDJd\n" \
"ArolQ4FCR7vY4Y8MDEZf7kYzawMUgtN+zY+vkNaOJH1AQrRqahfGlZfh8jjNp+20\n" \
"J0CT33KpuMZmYzc4ZCIwojvxuch7yPspOqsactIGEk72gtQjbz7Dk+XYtsDe3CMW\n" \
"1hMwt6CaDixVBgBwAc/qOR2A24j3pSC4W/0xJmmPLQphgzpHphNULB7j7UTKvGof\n" \
"KA5R2d4On3XNDgOVyvnFqSot/kGkoUeuDcL5OWYzSlvhhChZbH2UF3bkRYKtcCD9\n" \
"0m9jqNf6oDP6N8v3smWe2lBvP+Sn845dWDKXcCMu5/3EFZucJ48y7RetWIExKREa\n" \
"m9T8bJUox04FB6b9HbwZ4ui3uRGKLXASUoWNjDNKD/yZkuBjcNqllEdjB+dYxzFf\n" \
"BT02Vf6Dsuimrdfp5gJ0iHRc2jTbkNJtUQoj1iM=\n" \
"-----END CERTIFICATE-----\n";

// Not sure if WiFiClientSecure checks the validity date of the certificate. 
// Setting clock just to be sure...
void setClock() {
  configTime(0, 0, "pool.ntp.org", "time.nist.gov");

  Serial.print(F("Waiting for NTP time sync: "));
  time_t nowSecs = time(nullptr);
  while (nowSecs < 8 * 3600 * 2) {
    delay(500);
    Serial.print(F("."));
    yield();
    nowSecs = time(nullptr);
  }

  Serial.println();
  struct tm timeinfo;
  gmtime_r(&nowSecs, &timeinfo);
  Serial.print(F("Current time: "));
  Serial.print(asctime(&timeinfo));
}



void setup() {

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

  Serial.println();

  WiFi.mode(WIFI_STA);
  WiFi.begin("WIFI", "PASSWORD");

  // wait for WiFi connection
  Serial.print("Waiting for WiFi to connect...");
  int i=0;
  while (WiFi.status() != WL_CONNECTED && i<30) {
    Serial.print(".");
    delay(500);
    i++;
  }
  if(WiFi.status() != WL_CONNECTED) {
    Serial.println("WiFi failed");
    ESP.restart();  
  }


  setClock();  
}

void loop() {
  WiFiClientSecure *client = new WiFiClientSecure;
  if(client) {
    client -> setCACert(rootCACertificate);
    {
      // Add a scoping block for HTTPClient https to make sure it is destroyed before WiFiClientSecure *client is 
      HTTPClient https;
      https.setReuse(false);

      for(int i=0;i<2;i++) {
        Serial.printf("[HTTPS] begin %d...\n", i+1);
        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");
        }

      }
      // End extra scoping block
    }
  
    delete client;
  } else {
    Serial.println("Unable to create client");
  }

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

Debug Message

[HTTPS] begin 1...
[  7679][V][HTTPClient.cpp:247] beginInternal(): url: https://jigsaw.w3.org/HTTP/connection.html
[  7681][D][HTTPClient.cpp:298] beginInternal(): protocol: https, host: jigsaw.w3.org port: 443 url: /HTTP/connection.html
[HTTPS] GET...
[  7702][D][HTTPClient.cpp:595] sendRequest(): request type: 'GET' redirCount: 0

[  7702][V][ssl_client.cpp:61] start_ssl_client(): Free internal heap before TLS 264188
[  7708][V][ssl_client.cpp:67] start_ssl_client(): Starting socket
[  7874][V][ssl_client.cpp:143] start_ssl_client(): Seeding the random number generator
[  7876][V][ssl_client.cpp:152] start_ssl_client(): Setting up the SSL/TLS structure...
[  7880][V][ssl_client.cpp:175] start_ssl_client(): Loading CA cert
[  7956][V][ssl_client.cpp:244] start_ssl_client(): Setting hostname for TLS session...
[  7957][V][ssl_client.cpp:259] start_ssl_client(): Performing the SSL/TLS handshake...
[  9308][V][ssl_client.cpp:283] start_ssl_client(): Verifying peer X.509 certificate...
[  9308][V][ssl_client.cpp:291] start_ssl_client(): Certificate verified.
[  9311][V][ssl_client.cpp:306] start_ssl_client(): Free internal heap after TLS 220188
[  9319][D][HTTPClient.cpp:1141] connect():  connected to jigsaw.w3.org:443
[  9326][V][ssl_client.cpp:357] send_ssl_data(): Writing HTTP request with 158 bytes...
[  9518][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'HTTP/1.1 200'
[  9519][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'date: Thu, 20 Jan 2022 21:15:07 GMT'
[  9523][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'content-length: 550'
[  9530][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'content-type: text/html'
[  9538][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'etag: "1giilod:q0efehi8"'
[  9545][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'last-modified: Tue, 20 Jun 2000 13:33:22 GMT'
[  9555][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'server: Jigsaw/2.3.0-beta3'
[  9563][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'extensionheader: ExtensionValue'
[  9571][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'strict-transport-security: max-age=15552015; includeSubDomains; preload'
[  9584][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'public-key-pins: pin-sha256="cN0QSpPIkuwpT6iP2YjEo1bEwGpH/yiUn6yhdy+HNto="; pin-sha256="WGJkyYjx1QMdMe0UqlyOKXtydPDVrk7sl2fV+nNm1r4="; pin-sha256="LrKdTxZLRTvyHM4/atX2nquX9BeHRZMCxg3cf4rhc2I="; max-age=864000'
[  9607][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'x-frame-options: deny'
[  9614][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'x-xss-protection: 1; mode=block'
[  9622][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'x-request-id: 61e9d0dbf67544f5'
[  9631][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: 'connection: close'
[  9638][V][HTTPClient.cpp:1234] handleHeaderResponse(): RX: ''
[  9643][D][HTTPClient.cpp:1275] handleHeaderResponse(): code: 200
[  9649][D][HTTPClient.cpp:1278] handleHeaderResponse(): size: 550
[  9655][D][HTTPClient.cpp:619] sendRequest(): sendRequest code=200

[HTTPS] GET... code: 200
[  9672][D][HTTPClient.cpp:383] disconnect(): still data in buffer (550), clean up.

[  9677][V][ssl_client.cpp:314] stop_ssl_socket(): Cleaning SSL connection.
[  9678][D][HTTPClient.cpp:392] disconnect(): tcp stop
[  9682][V][ssl_client.cpp:314] stop_ssl_socket(): Cleaning SSL connection.
[HTTPS] begin 2...
[  9699][V][HTTPClient.cpp:247] beginInternal(): url: https://jigsaw.w3.org/HTTP/connection.html
[  9700][D][HTTPClient.cpp:298] beginInternal(): protocol: https, host: jigsaw.w3.org port: 443 url: /HTTP/connection.html
[HTTPS] GET...
[  9720][D][HTTPClient.cpp:595] sendRequest(): request type: 'GET' redirCount: 0

[  9720][V][ssl_client.cpp:61] start_ssl_client(): Free internal heap before TLS 263452
[  9726][V][ssl_client.cpp:67] start_ssl_client(): Starting socket
[  9845][V][ssl_client.cpp:143] start_ssl_client(): Seeding the random number generator
[  9847][V][ssl_client.cpp:152] start_ssl_client(): Setting up the SSL/TLS structure...
[  9850][V][ssl_client.cpp:175] start_ssl_client(): Loading CA cert
[  9927][V][ssl_client.cpp:244] start_ssl_client(): Setting hostname for TLS session...
[  9928][V][ssl_client.cpp:259] start_ssl_client(): Performing the SSL/TLS handshake...
[  9944][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -1
[  9951][V][ssl_client.cpp:314] stop_ssl_socket(): Cleaning SSL connection.
[  9957][D][HTTPClient.cpp:1134] connect(): failed connect to jigsaw.w3.org:443
[  9964][W][HTTPClient.cpp:1437] returnError(): error(-1): connection refused
[HTTPS] GET... failed, error: connection refused
[  9982][D][HTTPClient.cpp:405] disconnect(): tcp is closed

[  9982][V][ssl_client.cpp:314] stop_ssl_socket(): Cleaning SSL connection.
[  9987][V][ssl_client.cpp:314] stop_ssl_socket(): Cleaning SSL connection.

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@vlastahajek vlastahajek added the Status: Awaiting triage Issue is waiting for triage label Jan 20, 2022
vlastahajek added a commit to bonitoo-io/arduino-esp32 that referenced this issue Jan 20, 2022
@VojtechBartoska VojtechBartoska added Area: BT&Wifi BT & Wifi related issues and removed Status: Awaiting triage Issue is waiting for triage labels Jan 24, 2022
@VojtechBartoska
Copy link
Collaborator

@vlastahajek Thanks for the issue and PR! We will take a look on PR itself.

@hoberman
Copy link

Note that this problem can also happen even with HTTPClient::setReuse(true) which is the default setting. Repeated GETs will succeed as long as the server keeps the connection alive. If/when the server ends the connection - which could be several minutes later - subsequent GETs will fail at the same SSL/TLS handshake step.

Jason2866 added a commit to Jason2866/arduino-esp32 that referenced this issue Feb 4, 2022
* Fix wdt OTA update

* Fix ESP32-Solo WDT on HTTP OTA update

Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>

* Fix ESP32-Solo WDT on HTTP OTA update

* Fix ESP32-Solo WDT on HTTP OTA update

Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>

* IDF master c69f0ec32

* Fix WDT only for solo core

* IDF master 58022f859

* IDF master 606557b48

* IDF master 8131d6f46

* IDF master 59aa60d52

* IDF master 83956ebba

* IDF master 83956ebbae

* IDF master b1c3ee71c5

* IDF master 2c49af9e75

* IDF master eb1a66e7c9

* IDF master a20df743f1

* Fix build compilation due to changes in the HW_TIMER's structs

* Fix compilation warnings and errors with USB

* Update USBCDC.cpp

* Update CMakeLists.txt

* IDF master b63ec47238

* Update libarduino_tinyusb.a

* Update HWCDC.cpp

* IDF master 5f38b766a8

* IDF master b1f851b8f8

* IDF master 61299f879e

* Delete tools/sdk/esp32/include/coap directory

* Delete tools/sdk/esp32c3/include/coap directory

* Delete tools/sdk/esp32s2/include/coap directory

* solve conflicts

* force Dynamic Buffer instead of Static ones

* Remove debug if

* Resolve conflicts

* Revert espressif#5861

* add GPIO defines for C3

* Edit sd_diskio to check card status

* Update CMakeLists.txt

* Delete libraries/RainMaker directory

* Update README.md

* Update README.md

* Revert "RMT refactor"

* Fixes Lib Builder compiling errors

* Fixes Lib Builder compiling errors

* Revert "Revert "RMT refactor""

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-gpio.c

* Bugfix of ff_sd_status

* Fix I2C Slave Compile

I2C Slave currently doesn't compile for projects where Arduino is an IDF component.  This adds missing conditionals.

* add missing c3 define

when disable HAL lock is set

* add ESP32C3 `esp32_adc2gpio`

* Fixes UART MODBUS and Loopback issue

* Update esp32-hal-uart.c

* Revert "Fixing interrupts in LEDC (espressif#6160)"

This reverts commit a593206.

* Update esp32-hal.h

* use Tasmota github

* Use Tasmota platform for CI

* tasmota eaptool v3.2

* add missing c3 define

* enable SPI hal for S3

* revert enable spi for S3

* Update Esp.cpp

* Update Esp.cpp

* fix S3 uart gpios

* fix S3 flash image base (espressif#6208)

* Added my new Unexpected Maker ESP32-S3 boards (espressif#6211)

* Fixes UART1 and UART2 default pins for ESP32-S3 (espressif#6202)

Summary

This PR fixes an issue with UART1 default pins.
When using pins RX_1 = 18 and TX_1 = 17, UART1 will display a Break Error on those pins when they are floting (not connected).

It also defines RX_2 = 19 and TX_2 = 20 as default pins for UART2.

Impact

The deaulf pins may look different from the original pinout diagram.

* Fix - SD mount issue (espressif#6162)

* sdSelectCard longer timeout for sdWait

* GO_IDLE_STATE command ignores sdWait fail

* fix: restoring handshake timeout (espressif#6165) (espressif#6166)

* Use 8.4.0+2021r2-patch2 toolchains for CI (espressif#6184)

with platformio

* Fixes onReceive deadlock (espressif#6201)

* added explanatory comments to WebServer.h (espressif#6204)

* Add conditional include to WiFiProv.h (espressif#6192)

Resolves issue espressif#6171

* Resolve WString TODO (espressif#6190)

Resolve TODO (XXX) by logging warning message.

* Allow HTTPCLIENT_1_1_COMPATIBLE to be disabled (espressif#6200)

Allow a user to disable the HTTPCLIENT_1_1_COMPATIBLE flag from the command line, or whichever means available.

* Update RequestHandlersImpl.h (espressif#6179)

With LittleFS the `fs.exists(path)` returns true also on folders. A `isDirectory()` call is required to set _isFile to false on directories.
This enables serving all files from a folder like : `server->serveStatic("/", LittleFS, "/", cacheHeader.c_str());
        File f = fs.open(path);
        _isFile = (f && (! f.isDirectory()));

* Refactor the CI scripts (espressif#6191)

The reason behind this refactoring is that all of the sketch related functions can (and will) be used for other purposes.

Build in the sketch directory: This will make it easy to handle artifacts after the build.
Separate sketch related functions from IDE installation script. This is the main commit.
Create a separate job for the Cmake check. This check was part of one of the Linux build. I believe that it's not the best place for such a check.
Checking for the skip landmarks and validity of the the sketch directory were already done by count_sketches.

* Fixes UART_1 TX Pin setup

When passing the PR to this branch, it seems that the change to this line was forgotten.

* Fix random CaptivePortal.ino crashes (espressif#6206)

CaptivePortal.ino example did randomly crash for me ... so I start investigate ;-)

Decoding stack results
0x4016faea: WiFiUDP::write(unsigned char const*, unsigned int) at C:\Users\knoeb\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\libraries\WiFi\src\WiFiUdp.cpp line 201
0x400d4a4a: DNSServer::replyWithIP() at C:\Users\knoeb\AppData\Local\Temp\arduino_build_486825\sketch\src\DNSServer\DNSServer.cpp line 187
0x400d4d01: DNSServer::processNextRequest() at C:\Users\knoeb\AppData\Local\Temp\arduino_build_486825\sketch\src\DNSServer\DNSServer.cpp line 117
0x400d3e81: loop() at D:\Drive\Dokumente\HTL_Lehrer\2021_22\Projekte\Stromzaehler_Patrick\arduino/arduino.ino line 1078
0x400dd545: loopTask(void*) at C:\Users\knoeb\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\cores\esp32\main.cpp line 37
0x4008a0de: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

I found with wireshark a possibility to trigger the crash on demand is:
nslookup 3.1o1osr0092ons87rp375p1pq8q066o8p56or1sqsps6rs17r4384q9748qr1r52.699p1r741q737393648s29917o45p16q50rn517rnsp73pp68p1q259s92693qp.s607408539s0p06p7559os0899866344r7qq7rpns960o9576q65.r5n94r5so9784pq1.i.03.s.sophosxl.net

The problem was that QNameLength is a signed byte and therefore its not possible to count up to 255. Additionally we need 256 bytes for the QName string to accommodate for the zero termination.

* Update HardwareSerial.cpp

* Update Esp.cpp

* Update Esp.cpp

* Bootloader is at 0x0000 for S3

* Initial SPI support and S3-Box variant

* Docs cleanup and version updated to 2.0.2 (espressif#6213)

* Docs cleanup and version updated to 2.0.2

* Removed issue template information

* Removed issue template file

* Added referecnces for the issue and feature request form

* Bootloader is at 0x0000 for S3 (espressif#6215)

* Update esp32-hal-cpu.c

* Update esp32-hal-spi.c

* Unnecessary operation removed from map() in WMath.cpp (espressif#6218)

* Unneccesary Operation Removed

(A) extra operation not needed and incorrect:
      wrong by 0.5 but happens to be thrown out

     ( delta * dividend + (divisor / 2) ) / divisor

        delta * dividend     divisor
    = ---------------- + -----------
        divisor                    2 * divisor

    = delta * dividend / divisor + 1/2

(B) check first before doing other computations

(C) changed to rise/run, easier for future maintainer
      since it's closer to equation of a line

(D) before: mult, shift, add, div, add
      now: mult, div, add

(E) error message easier to trace where thrown

* Update WMath.cpp

forgot to change variable name

* framebuffer location for no-psram boards (espressif#6219)

If board has no PSRAM, we need to set the framebuffer location to DRAM:
config.fb_location = CAMERA_FB_IN_DRAM;

* Update install-platformio-esp32.sh

* small adjustments for NVS and PSRAM init

* WIP: Initial support for PSRAM (QSPI and OPI)

* Fix replace() failing

* Touch Sensor IDF Refactoring (espressif#6194)

Summary

Touch Sensor refactoring to be based on IDF 4.4.
Adds support to ESP32S2 and future ESP32S3.

Adds some new APIs:

For all chips:

void touchAttachInterruptArg(uint8_t pin, void (*userFunc)(void*), void *arg, uint32_t threshold);
This function allows the user to add and pass a void* parameter to the ISR user callback.

void touchDetachInterrupt(uint8_t pin);
This function detaches ISR call back for the touch pad pin.

Only ESP32 chip

void touchInterruptSetThresholdDirection(bool mustbeLower);
This function allows the user to set if the ISR callback will be activated when the touch sensor readings are lower or higher than the threshold defined. See example TouchButton.ino.

Only ESP32-S2 and ESP32-S3 chips

bool touchInterruptGetLastStatus(uint8_t pin);
This function reports if the touch pad pin is touched or untouched. It can be used with ISR to identify when it is touched and untouched (released). See example TouchButtonV2.ino.

Impact

None. ll original APIs and examples now run on ESP32 and ESP32-S2.

Related links

Fix espressif#6095
Fix espressif#6034
Fix espressif#5799
Fix espressif#5745
Fix espressif#5527
Fix espressif#5493
Fix espressif#4321
Fix espressif#4044
Fix espressif#2722
Fix espressif#2625

* [FEATURE] Basic implementation of Arduino's I2S library (espressif#5304)

Basic version of Arduino's I2S library. We currently support only 16bps + 16000 Hz sampling frequency. Other bitrates and sample rates will print warning and continue to operate, however the resulting audio quality may be poor.
There will be further effort to fix these issues.

* Update CMakeLists.txt

* remove Rainmaker

* [I2S] Fix lib-builder error

* Update CMakeLists.txt

* try to find lib builder fail

* Update CMakeLists.txt

* Update idf_component.yml

Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>
Co-authored-by: me-no-dev <me-no-dev@users.noreply.github.com>
Co-authored-by: me-no-dev <hristo@espressif.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Jason2866 <jason2866@github.com>
Co-authored-by: Rodrigo Garcia <Rodrigo.Garcia@espressif.com>
Co-authored-by: mrengineer7777 <44048235+mrengineer7777@users.noreply.github.com>
Co-authored-by: Unexpected Maker <seon@unexpectedmaker.com>
Co-authored-by: Vlasta Hajek <vlastimil.hajek@bonitoo.io>
Co-authored-by: Enes Şimşek <62627966+h-enes-simsek@users.noreply.github.com>
Co-authored-by: Clemens Kirchgatterer <clemens@1541.org>
Co-authored-by: Matthias Hertel <mathertel@hotmail.com>
Co-authored-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Co-authored-by: Patrick Behal <5472845+im-pro-at@users.noreply.github.com>
Co-authored-by: Pedro Minatel <pminatel@gmail.com>
Co-authored-by: IanSC <8453489+IanSC@users.noreply.github.com>
Co-authored-by: René Bohne <rene.bohne@gmail.com>
Co-authored-by: s-hadinger <49731213+s-hadinger@users.noreply.github.com>
Co-authored-by: Tomáš Pilný <34927466+PilnyTomas@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants