but if i pass a message, the main will dely 1~2s.
this is my program
Code: Select all
WiFiClientSecure lineClient;
String Linetoken = "--------------------------------------------";
char host[] = "notify-api.line.me";
bool isConnectLine = false;
void SendLineMessage()
{
String mess = "AAAAA";
if(Linetoken.length()>30)
{
if (lineClient.connect(host, 443))
{
Serial.println("Connect Line");
isConnectLine = true;
}else
{
Serial.println("Connect Line Fault");
isConnectLine = false;
}
if(isConnectLine)
{
int LEN = mess.length();
String url = "/api/notify";
lineClient.println("POST " + url + " HTTP/1.1");
lineClient.print("Host: "); lineClient.println(host);
//client.println("Connection: close");
lineClient.print("Authorization: Bearer "); lineClient.println(Linetoken);
lineClient.println("Content-Type: application/x-www-form-urlencoded");
lineClient.print("Content-Length: "); lineClient.println( String((LEN + 8)) );
lineClient.println();
lineClient.print("message="); lineClient.println(mess);
lineClient.println();
delay(500);
String response = lineClient.readString();
Serial.println(response);
}
lineClient.stop();
lineClient.flush();
}
}
lineTimer = xTimerCreate("lineTimer", pdMS_TO_TICKS(200), pdFALSE, (void *)0, reinterpret_cast<TimerCallbackFunction_t>(SendLineMessage));
xTimerStart(lineTimer , 0);
the esp32 will crash and reboot.
I change the configMINIMAL_STACK_SIZE to bigger like 2048, it alwasy not work.
Does anyone has some idel?