我正在使用ESP 32将参数通过POST发送到网站,我正在使用此代码:
timeA=millis();
USE_SERIAL.println(timeA - timeB);
strTotURL=strBaseUrl+strPage;
strTotURL.replace(" ", "");
//USE_SERIAL.println(strTotURL);
http.begin(strTotURL, ca); //HTTPS
http.addHeader("Content-Type", "application/x-www-form-urlencoded", false, true);
httpCode = http.POST(strParams);
if(httpCode > 0) // httpCode will be negative on error
{
if(httpCode == HTTP_CODE_OK) // file found at server
{
String payload = ">ADJ "+http.getString();
USE_SERIAL.println(payload);//+payload
timeA=millis();
/*USE_SERIAL.print("time befor : " + timeB/1000);
USE_SERIAL.print(" time after : " + timeA/1000);
USE_SERIAL.println(" elapsed : " + ((timeA-timeB)/1000));*/
USE_SERIAL.println(timeA - timeB);
}
else
{
String payload = http.getString();
USE_SERIAL.println(String(">fail")+payload);
}
}
else
{
USE_SERIAL.print(String(">")+httpCode);
USE_SERIAL.println(">Acc ER1");
}
http.end();
问题是该过程需要2秒钟的付出或付出(我测量了时间),有什么办法可以使它更快?