v1.9.0 to fix bug and optimize code

### Releases v1.9.0

1. Fix long timeout if using `IPAddress`. Check [setTimeout() hasn't any effect #38](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/38)
2. Optimize code
3. Display only successful responseText in examples
4. Improve debug messages by adding functions to display error messages instead of `cryptic error number`
5. Remove support to STM32 using **LAN8720** due to problem with new STM32 core v2.3.0
5. Update `Packages' Patches`
This commit is contained in:
Khoi Hoang
2022-08-30 22:59:23 -04:00
committed by GitHub
parent dabf181406
commit 07e2add996
25 changed files with 524 additions and 438 deletions
@@ -29,8 +29,8 @@ const char POST_ServerAddress[] = "dweet.io";
// use your own thing name here
String dweetName = "/dweet/for/pinA0-Read?";
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.7.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1007000
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009000
// 600s = 10 minutes to not flooding, 60s in testing
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
@@ -116,25 +116,36 @@ void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState)
if (readyState == readyStateDone)
{
String responseText = request->responseText();
Serial.println("\n**************************************");
//Serial.println(request->responseText());
Serial.println(responseText);
Serial.println("**************************************");
Serial.println();
AHTTP_LOGDEBUG(F("**************************************"));
AHTTP_LOGDEBUG1(F("Response Code = "), request->responseHTTPString());
parseResponse(responseText);
if (request->responseHTTPcode() == 200)
{
String responseText = request->responseText();
request->setDebug(false);
Serial.println("\n**************************************");
//Serial.println(request->responseText());
Serial.println(responseText);
Serial.println("**************************************");
parseResponse(responseText);
request->setDebug(false);
}
else
{
AHTTP_LOGERROR(F("Response error"));
}
}
}
void setup(void)
{
Serial.begin(115200);
while (!Serial);
Serial.println("\nStart AsyncDweetPOST_STM32 on " + String(BOARD_NAME));
while (!Serial && millis() < 5000);
Serial.print("\nStart AsyncDweetPOST_STM32 on "); Serial.println(BOARD_NAME);
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)