forked from khoih-prog/AsyncHTTPRequest_Generic
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:
@@ -24,8 +24,8 @@
|
||||
//char GET_ServerAddress[] = "192.168.2.110/";
|
||||
char GET_ServerAddress[] = "http://worldtimeapi.org/api/timezone/America/Toronto.txt";
|
||||
|
||||
#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
|
||||
@@ -68,26 +68,35 @@ void sendRequest(void)
|
||||
}
|
||||
}
|
||||
|
||||
void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState)
|
||||
void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState)
|
||||
{
|
||||
(void) optParm;
|
||||
|
||||
|
||||
if (readyState == readyStateDone)
|
||||
{
|
||||
Serial.println("\n**************************************");
|
||||
Serial.println(request->responseText());
|
||||
Serial.println("**************************************");
|
||||
Serial.println();
|
||||
AHTTP_LOGDEBUG(F("**************************************"));
|
||||
AHTTP_LOGDEBUG1(F("Response Code = "), request->responseHTTPString());
|
||||
|
||||
request->setDebug(false);
|
||||
if (request->responseHTTPcode() == 200)
|
||||
{
|
||||
Serial.println(F("**************************************"));
|
||||
Serial.println(request->responseText());
|
||||
Serial.println(F("**************************************"));
|
||||
}
|
||||
else
|
||||
{
|
||||
AHTTP_LOGERROR(F("Response error"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.println("\nStart AsyncCustomHeader_STM32 on " + String(BOARD_NAME));
|
||||
Serial.print("\nStart AsyncCustomHeader_STM32 on "); Serial.println(BOARD_NAME);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
Reference in New Issue
Block a user