WiFiClientSecure is not working with AutoConnect
linaspasv opened this issue · comments
Linas Pašviestis commented
Hello, so I have this odd issue where WiFiClientSecure can't connect to anything when AutoConnect Portal(webServer);
is added into the code. Here is a small test snippet to reproduce the issue:
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <AutoConnect.h>
ESP8266WebServer webServer;
AutoConnect Portal(webServer);
void setup() {
Serial.begin(115200);
while (! Serial);
WiFi.begin("....", ".....");
Serial.println("");
Serial.println("");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
// wait 1 second for re-trying
delay(1000);
}
}
void loop() {
IPAddress remote_addr;
WiFi.hostByName("example.com", remote_addr);
Serial.println(remote_addr.toString());
WiFiClient wifiClient;
wifiClient.connect(remote_addr, 80);
Serial.println("[HTTP] " + String(wifiClient.connected() ? "connected" : "not connected"));
WiFiClientSecure wifiClientSecure;
wifiClientSecure.setInsecure();
wifiClientSecure.connect(remote_addr, 443);
Serial.println("[HTTPS] " + String(wifiClientSecure.connected() ? "connected" : "not connected"));
delay(5000);
}
Linas Pašviestis commented
It looks like the issue was lack of heap memory for ESP8266 but the following flag for platformio solved the problem.
-D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED