Closed StaelensJarne closed 9 months ago
The number 138228 is the amount of free heap in bytes. You can check it here https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFiClientSecure/src/ssl_client.cpp#L61.
Is it possible for you to provide a simplified sketch that causes this behavior ? Also please double check you are using the informed version (v2.0.14) as we had breaking changes in version 3.0.0 (master branch)
Since 1.0.6, insecure connections are denied by default. You need to call WFCS::setInsecure() or provide appropriate certificates.
This simplified sketch is:
#include <WiFiClientSecure.h>
WiFiClientSecure wificlientsecure;
/* This is a toggle on the configuration oprtal
The default value is false, so this if should not be executed */
if (rest_cert_enabled) wificlientsecure.setCACert(rest_cert.c_str());
while(wificlientsecure.available()){
String line = wificlientsecure.readStringUntil('\r');
Serial.print(line);
}
if (wificlientsecure.connected() || wificlientsecure.connect(&rest_domain[0], rest_port)) {
post_rest_message(message, wificlientsecure);
}
And the full code is on this github page.
But I am not sure if this is a bug, or the sensor that does not have enough memory available.
And here is my platformio.ini
[platformio]
src_dir = operame
data_dir = operame
[env:testREST]
platform = espressif32
board = esp32thing
framework = arduino
lib_deps =
juerd/ESP-WiFiSettings@3.8.0
wifwaf/MH-Z19@1.5.4
bodmer/TFT_eSPI@2.5.31
256dpi/MQTT@2.5.1
bblanchon/ArduinoJson@6.21.3
adafruit/DHT sensor library@1.4.4
targets=upload
upload_port = COM5
build_flags =
-DCORE_DEBUG_LEVEL=5
-DUSER_SETUP_LOADED=1
-DST7789_DRIVER=1
-DCGRAM_OFFSET=1
-DTFT_WIDTH=135
-DTFT_HEIGHT=240
-DTFT_MOSI=19
-DTFT_SCLK=18
-DTFT_CS=5
-DTFT_DC=16
-DTFT_RST=-23
-DTFT_BL=4
-DTFT_BACKLIGHT_ON=HIGH
-DLOAD_GLCD=1
-DLOAD_FONT2=1
-DLOAD_FONT4=1
-DLOAD_FONT6=1
-DLOAD_FONT7=1
-DLOAD_FONT8=1
-DLOAD_GFXFF=1
-DSPI_FREQUENCY=40000000
How can I know wificlientsecure is connected sucessfully started?
Is this: wificlientsecure.connected() that evaluates to true?
And can I force a sucessfull start with wificlient.setInsecure().
https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFiClientSecure/examples/WiFiClientInsecure/WiFiClientInsecure.ino You can't force anything. You are having a conversation with the server on the other end of the connection. If the conversation goes poorly, it fails.
Ok, with WiFiClientSecure.setInsecure()
worked.
But I substituted the WiFiClientSecure with a normal WiFiClient since my REST API support also http URL's, instead of https.
This issue can now be closed.
Board
SparkFun ESP32 Thing
Device Description
I use a usb cable to flash the Platformio project to my IoT sensor. There is nothing else attached.
Hardware Configuration
This is an IoT sensor. The product page is here.
And the original code from the project is here. But the original code has not been modified since April 2022. Additional hardware info: ESP32 240MHz, 320KB RAM, 4MB Flash.
Version
v2.0.14
IDE Name
PlatformIO
Operating System
Windows 11
Flash frequency
240MHz
PSRAM enabled
no
Upload speed
11520
Description
These IoT sensor can send values with MQTT and REST. The MQTT works fine, but the REST not, due to the ssl_client not working.
Sketch
Debug Message
Other Steps to Reproduce
Download the code from the original repo. And frash the project to the sensor. Then configure REST via the WiFi portal which is at 192.168.4,1
I have checked existing issues, online documentation and the Troubleshooting Guide