Closed redphx closed 1 year ago
HI @redphx
Thanks for your interest in the library.
Sorry that I have no M5Stack device to test to know what wrong with the design / implementation (hardware, firmware , software, etc.). Start with a standard ESP32 to see if your code is OK. Transfer to M5Stack device only after everything is OK with ESP32.
You have to test, experiment to figure the culprit out. If the issue is caused by bug of this library, please inform or make PRs to fix.
Good Luck,
Hi @khoih-prog, The code above also didn't work on Lilygo T-Display-S3 (ESP32-S3). But I think I found the problem.
It works when defining request
as global variable:
AsyncHTTPSRequest request;
void setup() {
...
}
But it won't work this way (constantly crashing):
void setup() {
...
AsyncHTTPSRequest request;
...
}
Here is the full sketch for Lilygo T-Display-S3.
#define _ASYNC_HTTPS_LOGLEVEL_ 4
#include <WiFi.h>
#include "Arduino.h"
#include <AsyncHTTPSRequest_Generic.h>
// Wifi Credentials
const char* WIFI_SSID = "wifi";
const char* WIFI_PASSWORD = "password";
// It works when I define "request" here
// AsyncHTTPSRequest request;
void requestCB(void *optParm, AsyncHTTPSRequest *request, int readyState)
{
(void) optParm;
if (readyState == readyStateDone)
{
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code = "), request->responseHTTPString());
if (request->responseHTTPcode() == 200)
{
Serial.println(F("\n**************************************"));
Serial.println(request->responseText());
Serial.println(F("**************************************"));
}
request->setDebug(false);
}
}
void setup() {
Serial.begin(115200);
// WiFi Init
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("[WIFI] connecting to network " + String(WIFI_SSID) );
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("[WIFI] connected with Ip: " + WiFi.localIP().toString() );
// It crashes when I define "request" here
AsyncHTTPSRequest request;
request.setDebug(true);
request.onReadyStateChange(requestCB);
static bool requestOpenResult;
requestOpenResult = request.open("GET", "https://worldtimeapi.org/api/timezone/America/Toronto.txt");
request.send();
}
void loop() {
}
Is it a bug or something I didn't know of?
Thank you for the library.
// It crashes when I define "request" here AsyncHTTPSRequest request;
It'll certainly crash because when setup()
ends, the request
object will be destroyed along with all the necessary info / data / pointers, etc.
That makes sense. Thank you for your help.
Describe the bug
This library doesn't work on M5Stack devices (M5Atom & M5StickC Plus). Constantly crashing, throwing
xQueueTakeMutexRecursive
errors.I don't have this problem when using
AsyncTCP_SSL
directly (on another project).Steps to Reproduce
Expected behavior
A clear and concise description of what you expected to happen.
Actual behavior
The script crashed the M5Atom constantly. It kept throwing these two errors:
Information