mirror of
https://github.com/khoih-prog/AsyncHTTPRequest_Generic.git
synced 2025-06-25 01:31:32 +02:00
v1.10.2 default to reconnect to the same host:port
### Releases v1.10.2 1. Default to reconnect to the same `host:port` after connected for new HTTP sites. Check [Host/Headers not always sent with 1.10.1 #44](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues44) 2. Update `Packages' Patches`
This commit is contained in:
@ -29,11 +29,10 @@ Please ensure to specify the following:
|
||||
Arduino IDE version: 1.8.19
|
||||
ESP32 Core Version 2.0.5
|
||||
OS: Ubuntu 20.04 LTS
|
||||
Linux xy-Inspiron-3593 5.15.0-50-generic #56~20.04.1-Ubuntu SMP Tue Sep 27 15:51:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
|
||||
Linux xy-Inspiron-3593 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
|
||||
|
||||
Context:
|
||||
I encountered a crash when using this library
|
||||
|
||||
I encountered a crash while using this library
|
||||
Steps to reproduce:
|
||||
1. ...
|
||||
2. ...
|
||||
@ -41,13 +40,38 @@ Steps to reproduce:
|
||||
4. ...
|
||||
```
|
||||
|
||||
### Additional context
|
||||
|
||||
Add any other context about the problem here.
|
||||
|
||||
---
|
||||
|
||||
### Sending Feature Requests
|
||||
|
||||
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
|
||||
|
||||
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
|
||||
|
||||
---
|
||||
|
||||
### Sending Pull Requests
|
||||
|
||||
Pull Requests with changes and fixes are also welcome!
|
||||
|
||||
Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
|
||||
|
||||
1. Change directory to the library GitHub
|
||||
|
||||
```
|
||||
xy@xy-Inspiron-3593:~$ cd Arduino/xy/AsyncHTTPRequest_Generic_GitHub/
|
||||
xy@xy-Inspiron-3593:~/Arduino/xy/AsyncHTTPRequest_Generic_GitHub$
|
||||
```
|
||||
|
||||
2. Issue astyle command
|
||||
|
||||
```
|
||||
xy@xy-Inspiron-3593:~/Arduino/xy/AsyncHTTPRequest_Generic_GitHub$ bash utils/restyle.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
## Table of Contents
|
||||
|
||||
* [Changelog](#changelog)
|
||||
* [Releases v1.10.2](#releases-v1102)
|
||||
* [Releases v1.10.1](#releases-v1101)
|
||||
* [Releases v1.10.0](#releases-v1100)
|
||||
* [Releases v1.9.2](#releases-v192)
|
||||
@ -44,6 +45,11 @@
|
||||
|
||||
## Changelog
|
||||
|
||||
### Releases v1.10.2
|
||||
|
||||
1. Default to reconnect to the same `host:port` after connected for new HTTP sites. Check [Host/Headers not always sent with 1.10.1 #44](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues44)
|
||||
2. Update `Packages' Patches`
|
||||
|
||||
### Releases v1.10.1
|
||||
|
||||
1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/39) and [Callback behaviour is buggy (ESP8266) #43](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/43)
|
||||
|
@ -24,12 +24,15 @@
|
||||
//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.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// 600s = 10 minutes to not flooding, 60s in testing
|
||||
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
@ -51,6 +54,7 @@ void sendRequest(void)
|
||||
Serial.println("\nSending GET Request to " + String(GET_ServerAddress));
|
||||
|
||||
requestOpenResult = request.open("GET", GET_ServerAddress);
|
||||
|
||||
//request.setReqHeader("X-CUSTOM-HEADER", "custom_value");
|
||||
if (requestOpenResult)
|
||||
{
|
||||
@ -94,17 +98,21 @@ void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState)
|
||||
void setup(void)
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.print("\nStart AsyncCustomHeader_STM32 on "); Serial.println(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)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// start the ethernet connection and the server
|
||||
|
@ -36,7 +36,7 @@
|
||||
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
|
||||
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
|
||||
defined(STM32WB) || defined(STM32MP1) )
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#endif
|
||||
|
||||
#define ASYNC_HTTP_DEBUG_PORT Serial
|
||||
|
@ -35,12 +35,16 @@ const char GET_ServerAddress[] = "dweet.io";
|
||||
// use your own thing name here
|
||||
String dweetName = "/dweet/for/currentSecond?second=";
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// 600s = 10 minutes to not flooding, 60s in testing
|
||||
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
@ -61,7 +65,7 @@ void sendRequest(void)
|
||||
|
||||
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
|
||||
{
|
||||
requestOpenResult = request.open("GET", (GET_ServerAddress + dweetName + String(millis()/1000)).c_str() );
|
||||
requestOpenResult = request.open("GET", (GET_ServerAddress + dweetName + String(millis() / 1000)).c_str() );
|
||||
|
||||
if (requestOpenResult)
|
||||
{
|
||||
@ -146,17 +150,21 @@ void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState)
|
||||
void setup(void)
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.print("\nStart AsyncDweetGET_STM32 on "); Serial.println(BOARD_NAME);
|
||||
Serial.print("\nStart AsyncDweetGET_STM32 on ");
|
||||
Serial.println(BOARD_NAME);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// start the ethernet connection and the server
|
||||
|
@ -36,7 +36,7 @@
|
||||
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
|
||||
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
|
||||
defined(STM32WB) || defined(STM32MP1) )
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#endif
|
||||
|
||||
#define ASYNC_HTTP_DEBUG_PORT Serial
|
||||
|
@ -18,8 +18,8 @@
|
||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*****************************************************************************************************************************/
|
||||
|
||||
// Dweet.io POST client. Connects to dweet.io once every ten seconds, sends a POST request and a request body.
|
||||
// Shows how to use Strings to assemble path and body
|
||||
// Dweet.io POST client. Connects to dweet.io once every ten seconds, sends a POST request and a request body.
|
||||
// Shows how to use Strings to assemble path and body
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
@ -29,12 +29,15 @@ 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.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// 600s = 10 minutes to not flooding, 60s in testing
|
||||
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
@ -143,17 +146,21 @@ void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState)
|
||||
void setup(void)
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.print("\nStart AsyncDweetPOST_STM32 on "); Serial.println(BOARD_NAME);
|
||||
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)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// start the ethernet connection and the server
|
||||
|
@ -36,7 +36,7 @@
|
||||
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
|
||||
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
|
||||
defined(STM32WB) || defined(STM32MP1) )
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#endif
|
||||
|
||||
#define ASYNC_HTTP_DEBUG_PORT Serial
|
||||
|
@ -44,8 +44,8 @@
|
||||
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
|
||||
#endif
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// Level from 0-4
|
||||
#define ASYNC_HTTP_DEBUG_PORT Serial
|
||||
@ -71,6 +71,9 @@ const char* password = "your_pass";
|
||||
// Seconds for timeout, default is 3s
|
||||
#define DEFAULT_RX_TIMEOUT 10
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
@ -156,17 +159,21 @@ void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState)
|
||||
|
||||
if (request->responseHTTPcode() == 200)
|
||||
{
|
||||
Serial.print(F("\n***************")); Serial.print(requestName[ requestIndex ]); Serial.println(F("***************"));
|
||||
Serial.print(F("\n***************"));
|
||||
Serial.print(requestName[ requestIndex ]);
|
||||
Serial.println(F("***************"));
|
||||
Serial.println(request->responseText());
|
||||
Serial.println(F("**************************************"));
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
||||
// Bypass hourly
|
||||
if (requestIndex == 1)
|
||||
requestIndex = 3;
|
||||
else
|
||||
requestIndex = (requestIndex + 1) % NUM_REQUESTS;
|
||||
|
||||
#else
|
||||
// hourly too long, not display anyway. Not enough heap.
|
||||
requestIndex = (requestIndex + 1) % NUM_REQUESTS;
|
||||
@ -180,26 +187,31 @@ void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
delay(200);
|
||||
|
||||
Serial.print(F("\nStarting AsyncHTTPMultiRequests using ")); Serial.println(ARDUINO_BOARD);
|
||||
Serial.print(F("\nStarting AsyncHTTPMultiRequests using "));
|
||||
Serial.println(ARDUINO_BOARD);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print(F("Warning. Must use this example on Version equal or later than : "));
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
WiFi.begin(ssid, password);
|
||||
|
||||
Serial.print(F("Connecting to WiFi SSID: ")); Serial.println(ssid);
|
||||
Serial.print(F("Connecting to WiFi SSID: "));
|
||||
Serial.println(ssid);
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
|
@ -65,12 +65,15 @@ const char* password = "your_pass";
|
||||
#include <WiFi.h>
|
||||
#endif
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// Seconds for timeout, default is 3s
|
||||
#define DEFAULT_RX_TIMEOUT 10
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
@ -147,16 +150,19 @@ void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.print(F("\nStarting AsyncHTTPRequest_ESP using ")); Serial.println(ARDUINO_BOARD);
|
||||
Serial.print(F("\nStarting AsyncHTTPRequest_ESP using "));
|
||||
Serial.println(ARDUINO_BOARD);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
WiFi.begin(ssid, password);
|
||||
|
||||
Serial.print(F("Connecting to WiFi SSID: ")); Serial.println(ssid);
|
||||
Serial.print(F("Connecting to WiFi SSID: "));
|
||||
Serial.println(ssid);
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
|
@ -95,12 +95,15 @@ using TCPClient = WiFiClient;
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// Seconds for timeout, default is 3s
|
||||
#define DEFAULT_RX_TIMEOUT 10
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
@ -210,12 +213,15 @@ void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
delay(200);
|
||||
|
||||
Serial.print("\nStart AsyncHTTPRequest_ESP8266_Ethernet on "); Serial.print(ARDUINO_BOARD);
|
||||
Serial.print(" using "); Serial.println(SHIELD_TYPE);
|
||||
Serial.print("\nStart AsyncHTTPRequest_ESP8266_Ethernet on ");
|
||||
Serial.print(ARDUINO_BOARD);
|
||||
Serial.print(" using ");
|
||||
Serial.println(SHIELD_TYPE);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
initEthernet();
|
||||
|
@ -47,8 +47,11 @@ const char* password = "your_pass";
|
||||
// Seconds for timeout, default is 3s
|
||||
#define DEFAULT_RX_TIMEOUT 10
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // http://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
#include <Ticker.h>
|
||||
|
||||
@ -196,9 +199,11 @@ void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.print("\nStart AsyncHTTPRequest_ESP_Multi on "); Serial.println(ARDUINO_BOARD);
|
||||
Serial.print("\nStart AsyncHTTPRequest_ESP_Multi on ");
|
||||
Serial.println(ARDUINO_BOARD);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
@ -49,8 +49,11 @@
|
||||
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
|
||||
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// Level from 0-4
|
||||
#define ASYNC_HTTP_DEBUG_PORT Serial
|
||||
@ -215,7 +218,7 @@ bool initialConfig = false;
|
||||
|
||||
// Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network
|
||||
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
|
||||
// Force DHCP to be true
|
||||
// Force DHCP to be true
|
||||
#if defined(USE_DHCP_IP)
|
||||
#undef USE_DHCP_IP
|
||||
#endif
|
||||
@ -280,25 +283,25 @@ Ticker ticker;
|
||||
///////////////////////////////////////////
|
||||
// New in v1.4.0
|
||||
/******************************************
|
||||
* // Defined in ESPAsync_WiFiManager.h
|
||||
typedef struct
|
||||
{
|
||||
// Defined in ESPAsync_WiFiManager.h
|
||||
typedef struct
|
||||
{
|
||||
IPAddress _ap_static_ip;
|
||||
IPAddress _ap_static_gw;
|
||||
IPAddress _ap_static_sn;
|
||||
|
||||
} WiFi_AP_IPConfig;
|
||||
} WiFi_AP_IPConfig;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
IPAddress _sta_static_ip;
|
||||
IPAddress _sta_static_gw;
|
||||
IPAddress _sta_static_sn;
|
||||
#if USE_CONFIGURABLE_DNS
|
||||
#if USE_CONFIGURABLE_DNS
|
||||
IPAddress _sta_static_dns1;
|
||||
IPAddress _sta_static_dns2;
|
||||
#endif
|
||||
} WiFi_STA_IPConfig;
|
||||
#endif
|
||||
} WiFi_STA_IPConfig;
|
||||
******************************************/
|
||||
|
||||
WiFi_AP_IPConfig WM_AP_IPconfig;
|
||||
@ -333,13 +336,13 @@ void displayIPConfigStruct(WiFi_STA_IPConfig in_WM_STA_IPconfig)
|
||||
|
||||
void configWiFi(WiFi_STA_IPConfig in_WM_STA_IPconfig)
|
||||
{
|
||||
#if USE_CONFIGURABLE_DNS
|
||||
#if USE_CONFIGURABLE_DNS
|
||||
// Set static IP, Gateway, Subnetmask, DNS1 and DNS2. New in v1.0.5
|
||||
WiFi.config(in_WM_STA_IPconfig._sta_static_ip, in_WM_STA_IPconfig._sta_static_gw, in_WM_STA_IPconfig._sta_static_sn, in_WM_STA_IPconfig._sta_static_dns1, in_WM_STA_IPconfig._sta_static_dns2);
|
||||
#else
|
||||
#else
|
||||
// Set static IP, Gateway, Subnetmask, Use auto DNS1 and DNS2.
|
||||
WiFi.config(in_WM_STA_IPconfig._sta_static_ip, in_WM_STA_IPconfig._sta_static_gw, in_WM_STA_IPconfig._sta_static_sn);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
@ -349,15 +352,15 @@ uint8_t connectMultiWiFi()
|
||||
#if ESP32
|
||||
// For ESP32, this better be 0 to shorten the connect time.
|
||||
// For ESP32-S2, must be > 500
|
||||
#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 )
|
||||
#define WIFI_MULTI_1ST_CONNECT_WAITING_MS 500L
|
||||
#else
|
||||
#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 )
|
||||
#define WIFI_MULTI_1ST_CONNECT_WAITING_MS 500L
|
||||
#else
|
||||
// For ESP32 core v1.0.6, must be >= 500
|
||||
#define WIFI_MULTI_1ST_CONNECT_WAITING_MS 800L
|
||||
#endif
|
||||
#define WIFI_MULTI_1ST_CONNECT_WAITING_MS 800L
|
||||
#endif
|
||||
#else
|
||||
// For ESP8266, this better be 2200 to enable connect the 1st time
|
||||
#define WIFI_MULTI_1ST_CONNECT_WAITING_MS 2200L
|
||||
#define WIFI_MULTI_1ST_CONNECT_WAITING_MS 2200L
|
||||
#endif
|
||||
|
||||
#define WIFI_MULTI_CONNECT_WAITING_MS 100L
|
||||
@ -576,29 +579,36 @@ void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
delay(200);
|
||||
|
||||
Serial.print(F("\nStarting AsyncHTTPRequest_ESP_WiFiManager using ")); Serial.print(FS_Name);
|
||||
Serial.print(F(" on ")); Serial.println(ARDUINO_BOARD);
|
||||
Serial.print(F("\nStarting AsyncHTTPRequest_ESP_WiFiManager using "));
|
||||
Serial.print(FS_Name);
|
||||
Serial.print(F(" on "));
|
||||
Serial.println(ARDUINO_BOARD);
|
||||
Serial.println(ESP_ASYNC_WIFIMANAGER_VERSION);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
#if defined(ESP_ASYNC_WIFIMANAGER_VERSION_INT)
|
||||
|
||||
if (ESP_ASYNC_WIFIMANAGER_VERSION_INT < ESP_ASYNC_WIFIMANAGER_VERSION_MIN)
|
||||
{
|
||||
Serial.print(F("Warning. Must use this example on Version later than : "));
|
||||
Serial.println(ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print(F("Warning. Must use this example on Version equal or later than : "));
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (FORMAT_FILESYSTEM)
|
||||
@ -606,6 +616,7 @@ void setup()
|
||||
|
||||
// Format FileFS if not yet
|
||||
#ifdef ESP32
|
||||
|
||||
if (!FileFS.begin(true))
|
||||
#else
|
||||
if (!FileFS.begin())
|
||||
@ -679,8 +690,10 @@ void setup()
|
||||
Router_Pass = ESPAsync_wifiManager.WiFi_Pass();
|
||||
|
||||
//Remove this line if you do not want to see WiFi password printed
|
||||
Serial.print(F("Stored: SSID = ")); Serial.print(Router_SSID);
|
||||
Serial.print(F(", Pass = ")); Serial.println(Router_Pass);
|
||||
Serial.print(F("Stored: SSID = "));
|
||||
Serial.print(Router_SSID);
|
||||
Serial.print(F(", Pass = "));
|
||||
Serial.println(Router_Pass);
|
||||
|
||||
if (Router_SSID != "")
|
||||
{
|
||||
|
@ -42,12 +42,15 @@
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// 600s = 10 minutes to not flooding, 60s in testing
|
||||
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
@ -106,17 +109,21 @@ void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState)
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.print("\nStart AsyncHTTPRequest_STM32 on "); Serial.println(BOARD_NAME);
|
||||
Serial.print("\nStart AsyncHTTPRequest_STM32 on ");
|
||||
Serial.println(BOARD_NAME);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// start the ethernet connection and the server
|
||||
|
@ -36,7 +36,7 @@
|
||||
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
|
||||
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
|
||||
defined(STM32WB) || defined(STM32MP1) )
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#endif
|
||||
|
||||
#define ASYNC_HTTP_DEBUG_PORT Serial
|
||||
|
@ -24,12 +24,15 @@
|
||||
//char GET_ServerAddress[] = "ipv4bot.whatismyipaddress.com/";
|
||||
char GET_ServerAddress[] = "http://worldtimeapi.org/api/timezone/America/Toronto.txt";
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// 600s = 10 minutes to not flooding, 60s in testing
|
||||
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
@ -87,17 +90,21 @@ void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState)
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.print("\nStart AsyncSimpleGET_STM32 on "); Serial.println(BOARD_NAME);
|
||||
Serial.print("\nStart AsyncSimpleGET_STM32 on ");
|
||||
Serial.println(BOARD_NAME);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// start the ethernet connection and the server
|
||||
@ -109,7 +116,8 @@ void setup()
|
||||
// Use DHCP dynamic IP and random mac
|
||||
Ethernet.begin(mac[index]);
|
||||
|
||||
Serial.print(F("AsyncHTTPRequest @ IP : ")); Serial.println(Ethernet.localIP());
|
||||
Serial.print(F("AsyncHTTPRequest @ IP : "));
|
||||
Serial.println(Ethernet.localIP());
|
||||
Serial.println();
|
||||
|
||||
request.setDebug(false);
|
||||
|
@ -46,54 +46,54 @@
|
||||
|
||||
|
||||
#if defined(STM32F0)
|
||||
#warning STM32F0 board selected
|
||||
#define BOARD_TYPE "STM32F0"
|
||||
#warning STM32F0 board selected
|
||||
#define BOARD_TYPE "STM32F0"
|
||||
#elif defined(STM32F1)
|
||||
#warning STM32F1 board selected
|
||||
#define BOARD_TYPE "STM32F1"
|
||||
#warning STM32F1 board selected
|
||||
#define BOARD_TYPE "STM32F1"
|
||||
#elif defined(STM32F2)
|
||||
#warning STM32F2 board selected
|
||||
#define BOARD_TYPE "STM32F2"
|
||||
#warning STM32F2 board selected
|
||||
#define BOARD_TYPE "STM32F2"
|
||||
#elif defined(STM32F3)
|
||||
#warning STM32F3 board selected
|
||||
#define BOARD_TYPE "STM32F3"
|
||||
#warning STM32F3 board selected
|
||||
#define BOARD_TYPE "STM32F3"
|
||||
#elif defined(STM32F4)
|
||||
#warning STM32F4 board selected
|
||||
#define BOARD_TYPE "STM32F4"
|
||||
#warning STM32F4 board selected
|
||||
#define BOARD_TYPE "STM32F4"
|
||||
#elif defined(STM32F7)
|
||||
#warning STM32F7 board selected
|
||||
#define BOARD_TYPE "STM32F7"
|
||||
#warning STM32F7 board selected
|
||||
#define BOARD_TYPE "STM32F7"
|
||||
#elif defined(STM32L0)
|
||||
#warning STM32L0 board selected
|
||||
#define BOARD_TYPE "STM32L0"
|
||||
#warning STM32L0 board selected
|
||||
#define BOARD_TYPE "STM32L0"
|
||||
#elif defined(STM32L1)
|
||||
#warning STM32L1 board selected
|
||||
#define BOARD_TYPE "STM32L1"
|
||||
#warning STM32L1 board selected
|
||||
#define BOARD_TYPE "STM32L1"
|
||||
#elif defined(STM32L4)
|
||||
#warning STM32L4 board selected
|
||||
#define BOARD_TYPE "STM32L4"
|
||||
#warning STM32L4 board selected
|
||||
#define BOARD_TYPE "STM32L4"
|
||||
#elif defined(STM32H7)
|
||||
#warning STM32H7 board selected
|
||||
#define BOARD_TYPE "STM32H7"
|
||||
#warning STM32H7 board selected
|
||||
#define BOARD_TYPE "STM32H7"
|
||||
#elif defined(STM32G0)
|
||||
#warning STM32G0 board selected
|
||||
#define BOARD_TYPE "STM32G0"
|
||||
#warning STM32G0 board selected
|
||||
#define BOARD_TYPE "STM32G0"
|
||||
#elif defined(STM32G4)
|
||||
#warning STM32G4 board selected
|
||||
#define BOARD_TYPE "STM32G4"
|
||||
#warning STM32G4 board selected
|
||||
#define BOARD_TYPE "STM32G4"
|
||||
#elif defined(STM32WB)
|
||||
#warning STM32WB board selected
|
||||
#define BOARD_TYPE "STM32WB"
|
||||
#warning STM32WB board selected
|
||||
#define BOARD_TYPE "STM32WB"
|
||||
#elif defined(STM32MP1)
|
||||
#warning STM32MP1 board selected
|
||||
#define BOARD_TYPE "STM32MP1"
|
||||
#warning STM32MP1 board selected
|
||||
#define BOARD_TYPE "STM32MP1"
|
||||
#else
|
||||
#warning STM32 unknown board selected
|
||||
#define BOARD_TYPE "STM32 Unknown"
|
||||
#warning STM32 unknown board selected
|
||||
#define BOARD_TYPE "STM32 Unknown"
|
||||
#endif
|
||||
|
||||
#ifndef BOARD_NAME
|
||||
#define BOARD_NAME BOARD_TYPE
|
||||
#define BOARD_NAME BOARD_TYPE
|
||||
#endif
|
||||
|
||||
#include <LwIP.h>
|
||||
|
@ -26,12 +26,15 @@ const char GET_ServerAddress[] = "arduino.tips";
|
||||
// GET location
|
||||
String GET_Location = "/asciilogo.txt";
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// 600s = 10 minutes to not flooding, 60s in testing
|
||||
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
|
||||
@ -89,17 +92,21 @@ void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState)
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
Serial.print("\nStart AsyncWebClientRepeating_STM32 on "); Serial.println(BOARD_NAME);
|
||||
Serial.print("\nStart AsyncWebClientRepeating_STM32 on ");
|
||||
Serial.println(BOARD_NAME);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
// start the ethernet connection and the server
|
||||
// Use random mac
|
||||
|
@ -36,7 +36,7 @@
|
||||
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
|
||||
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
|
||||
defined(STM32WB) || defined(STM32MP1) )
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
|
||||
#endif
|
||||
|
||||
#define ASYNC_HTTP_DEBUG_PORT Serial
|
||||
|
@ -57,8 +57,11 @@
|
||||
|
||||
#include <WebServer_WT32_ETH01.h> // https://github.com/khoih-prog/WebServer_WT32_ETH01
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
@ -157,17 +160,21 @@ void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState)
|
||||
|
||||
if (request->responseHTTPcode() == 200)
|
||||
{
|
||||
Serial.print(F("\n***************")); Serial.print(requestName[ requestIndex ]); Serial.println(F("***************"));
|
||||
Serial.print(F("\n***************"));
|
||||
Serial.print(requestName[ requestIndex ]);
|
||||
Serial.println(F("***************"));
|
||||
Serial.println(request->responseText());
|
||||
Serial.println(F("**************************************"));
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
||||
// Bypass hourly
|
||||
if (requestIndex == 1)
|
||||
requestIndex = 3;
|
||||
else
|
||||
requestIndex = (requestIndex + 1) % NUM_REQUESTS;
|
||||
|
||||
#else
|
||||
// hourly too long, not display anyway. Not enough heap.
|
||||
requestIndex = (requestIndex + 1) % NUM_REQUESTS;
|
||||
@ -182,23 +189,28 @@ void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
delay(200);
|
||||
|
||||
Serial.print("\nStart AsyncHTTPMultiRequests_WT32_ETH01 on "); Serial.print(ARDUINO_BOARD);
|
||||
Serial.print(" with "); Serial.println(SHIELD_TYPE);
|
||||
Serial.print("\nStart AsyncHTTPMultiRequests_WT32_ETH01 on ");
|
||||
Serial.print(ARDUINO_BOARD);
|
||||
Serial.print(" with ");
|
||||
Serial.println(SHIELD_TYPE);
|
||||
Serial.println(WEBSERVER_WT32_ETH01_VERSION);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
Serial.setDebugOutput(true);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// To be called before ETH.begin()
|
||||
|
@ -57,8 +57,11 @@
|
||||
|
||||
#include <WebServer_WT32_ETH01.h> // https://github.com/khoih-prog/WebServer_WT32_ETH01
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
// Uncomment for certain HTTP site to optimize
|
||||
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
|
||||
|
||||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
|
||||
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
|
||||
@ -148,23 +151,28 @@ void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial && millis() < 5000);
|
||||
|
||||
delay(200);
|
||||
|
||||
Serial.print("\nStart AsyncHTTPRequest_WT32_ETH01 on "); Serial.print(ARDUINO_BOARD);
|
||||
Serial.print(" with "); Serial.println(SHIELD_TYPE);
|
||||
Serial.print("\nStart AsyncHTTPRequest_WT32_ETH01 on ");
|
||||
Serial.print(ARDUINO_BOARD);
|
||||
Serial.print(" with ");
|
||||
Serial.println(SHIELD_TYPE);
|
||||
Serial.println(WEBSERVER_WT32_ETH01_VERSION);
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
Serial.setDebugOutput(true);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// To be called before ETH.begin()
|
||||
|
@ -16,11 +16,11 @@
|
||||
( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
|
||||
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
|
||||
defined(STM32WB) || defined(STM32MP1) ) )
|
||||
#error This code is intended to run on the ESP8266, ESP32 or STM32 platform! Please check your Tools->Board setting.
|
||||
#error This code is intended to run on the ESP8266, ESP32 or STM32 platform! Please check your Tools->Board setting.
|
||||
#endif
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.2"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010002
|
||||
|
||||
#include "multiFileProject.h"
|
||||
|
||||
@ -30,17 +30,20 @@
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
while (!Serial);
|
||||
|
||||
Serial.println("\nStart multiFileProject");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
|
||||
|
||||
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
|
||||
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
|
||||
{
|
||||
Serial.print("Warning. Must use this example on Version equal or later than : ");
|
||||
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name":"AsyncHTTPRequest_Generic",
|
||||
"version": "1.10.1",
|
||||
"version": "1.10.2",
|
||||
"description":"Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP libraries, such as AsyncTCP, ESPAsyncTCP, AsyncTCP_STM32, etc.. for ESP32 (including ESP32_S2, ESP32_S3 and ESP32_C3), WT32_ETH01 (ESP32 + LAN8720), ESP8266 (WiFi, W5x00 or ENC28J60) and currently STM32 with built-in LAN8742A Ethernet.",
|
||||
"keywords":"communication, async, tcp, http, ESP8266, ESP32, ESP32-S2, ESP32-S3, ESP32-C3, wt32-eth01, stm32, ethernet, wifi, lan8742a, nucleo-144, stm32f7, W5x00, ENC28J60",
|
||||
"authors": [
|
||||
@ -45,7 +45,7 @@
|
||||
{
|
||||
"owner": "khoih-prog",
|
||||
"name": "ESPAsync_WiFiManager",
|
||||
"version": ">=1.15.0",
|
||||
"version": ">=1.15.1",
|
||||
"platforms": ["espressif8266", "espressif32"]
|
||||
},
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=AsyncHTTPRequest_Generic
|
||||
version=1.10.1
|
||||
version=1.10.2
|
||||
author=Bob Lemaire,Khoi Hoang <khoih.prog@gmail.com>
|
||||
maintainer=Khoi Hoang <khoih.prog@gmail.com>
|
||||
license=GPLv3
|
||||
|
@ -45,7 +45,7 @@ lib_deps =
|
||||
; https://github.com/khoih-prog/STM32AsyncTCP.git
|
||||
; STM32duino LwIP@>=2.1.2
|
||||
; STM32duino STM32Ethernet@>=1.3.0
|
||||
; ESPAsync_WiFiManager@>=1.15.0
|
||||
; ESPAsync_WiFiManager@>=1.15.1
|
||||
; LittleFS_esp32@>=1.0.6
|
||||
; WebServer_WT32_ETH01@>=1.5.1
|
||||
;
|
||||
@ -56,7 +56,7 @@ lib_deps =
|
||||
; https://github.com/khoih-prog/STM32AsyncTCP.git
|
||||
; stm32duino/STM32duino LwIP@>=2.1.2
|
||||
; stm32duino/STM32duino STM32Ethernet@>=1.3.0
|
||||
; khoih-prog/ESPAsync_WiFiManager@>=1.15.0
|
||||
; khoih-prog/ESPAsync_WiFiManager@>=1.15.1
|
||||
; lorol/LittleFS_esp32@>=1.0.6
|
||||
; khoih-prog/WebServer_WT32_ETH01@>=1.5.1
|
||||
|
||||
@ -73,11 +73,11 @@ framework = arduino
|
||||
lib_deps =
|
||||
; PlatformIO 4.x
|
||||
; ESPAsyncTCP@>=1.2.2
|
||||
; ESPAsync_WiFiManager@>=1.15.0
|
||||
; ESPAsync_WiFiManager@>=1.15.1
|
||||
;
|
||||
; PlatformIO 5.x
|
||||
me-no-dev/ESPAsyncTCP@>=1.2.2
|
||||
khoih-prog/ESPAsync_WiFiManager@>=1.15.0
|
||||
khoih-prog/ESPAsync_WiFiManager@>=1.15.1
|
||||
|
||||
; ============================================================
|
||||
; Board configuration
|
||||
@ -128,13 +128,13 @@ framework = arduino
|
||||
lib_deps =
|
||||
; PlatformIO 4.x
|
||||
; AsyncTCP@>=1.1.1
|
||||
; ESPAsync_WiFiManager@>=1.15.0
|
||||
; ESPAsync_WiFiManager@>=1.15.1
|
||||
; LittleFS_esp32@>=1.0.6
|
||||
; WebServer_WT32_ETH01@>=1.5.1
|
||||
;
|
||||
; PlatformIO 5.x
|
||||
me-no-dev/AsyncTCP@>=1.1.1
|
||||
khoih-prog/ESPAsync_WiFiManager@>=1.15.0
|
||||
khoih-prog/ESPAsync_WiFiManager@>=1.15.1
|
||||
; lorol/LittleFS_esp32@>=1.0.6
|
||||
khoih-prog/WebServer_WT32_ETH01@>=1.5.1
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
You should have received a copy of the GNU General Public License along with this program.
|
||||
If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
|
||||
Version Modified By Date Comments
|
||||
------- ----------- ---------- -----------
|
||||
@ -34,6 +34,7 @@
|
||||
1.9.2 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
|
||||
1.10.0 K Hoang 20/10/2022 Fix bug. Clean up
|
||||
1.10.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
|
||||
1.10.2 K Hoang 09/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
|
||||
*****************************************************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
@ -18,7 +18,7 @@
|
||||
You should have received a copy of the GNU General Public License along with this program.
|
||||
If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
|
||||
Version Modified By Date Comments
|
||||
------- ----------- ---------- -----------
|
||||
@ -34,6 +34,7 @@
|
||||
1.9.2 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
|
||||
1.10.0 K Hoang 20/10/2022 Fix bug. Clean up
|
||||
1.10.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
|
||||
1.10.2 K Hoang 09/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
|
||||
*****************************************************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
@ -18,7 +18,7 @@
|
||||
You should have received a copy of the GNU General Public License along with this program.
|
||||
If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
|
||||
Version Modified By Date Comments
|
||||
------- ----------- ---------- -----------
|
||||
@ -34,6 +34,7 @@
|
||||
1.9.2 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
|
||||
1.10.0 K Hoang 20/10/2022 Fix bug. Clean up
|
||||
1.10.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
|
||||
1.10.2 K Hoang 09/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
|
||||
*****************************************************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
@ -43,13 +44,13 @@
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.10.1"
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.10.2"
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MAJOR 1
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MINOR 10
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_PATCH 1
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_PATCH 2
|
||||
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT 1010001
|
||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT 1010002
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
@ -57,6 +58,14 @@
|
||||
|
||||
#include "AsyncHTTPRequest_Debug_Generic.h"
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
#if !defined(NOT_SEND_HEADER_AFTER_CONNECTED)
|
||||
// Default is false
|
||||
#define NOT_SEND_HEADER_AFTER_CONNECTED false
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
#ifndef DEBUG_IOTA_PORT
|
||||
|
@ -18,7 +18,7 @@
|
||||
You should have received a copy of the GNU General Public License along with this program.
|
||||
If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
|
||||
Version Modified By Date Comments
|
||||
------- ----------- ---------- -----------
|
||||
@ -34,6 +34,7 @@
|
||||
1.9.2 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
|
||||
1.10.0 K Hoang 20/10/2022 Fix bug. Clean up
|
||||
1.10.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
|
||||
1.10.2 K Hoang 09/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
|
||||
*****************************************************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
@ -447,7 +448,8 @@ void xbuf::remSeg()
|
||||
////////////////////////////////////////
|
||||
|
||||
//**************************************************************************************************************
|
||||
AsyncHTTPRequest::AsyncHTTPRequest(): _readyState(readyStateUnsent), _HTTPcode(0), _chunked(false), _debug(DEBUG_IOTA_HTTP_SET)
|
||||
AsyncHTTPRequest::AsyncHTTPRequest(): _readyState(readyStateUnsent), _HTTPcode(0), _chunked(false),
|
||||
_debug(DEBUG_IOTA_HTTP_SET)
|
||||
, _timeout(DEFAULT_RX_TIMEOUT), _lastActivity(0), _requestStartTime(0), _requestEndTime(0), _URL(nullptr)
|
||||
, _connectedHost(nullptr), _connectedPort(-1), _client(nullptr), _contentLength(0), _contentRead(0)
|
||||
, _readyStateChangeCB(nullptr), _readyStateChangeCBarg(nullptr), _onDataCB(nullptr), _onDataCBarg(nullptr)
|
||||
@ -474,11 +476,13 @@ AsyncHTTPRequest::~AsyncHTTPRequest()
|
||||
SAFE_DELETE_ARRAY(_connectedHost)
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
// KH add
|
||||
if (threadLock)
|
||||
{
|
||||
vSemaphoreDelete(threadLock);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -571,6 +575,8 @@ bool AsyncHTTPRequest::open(const char* method, const char* URL)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if NOT_SEND_HEADER_AFTER_CONNECTED
|
||||
|
||||
if ( _client && _client->connected() )
|
||||
{
|
||||
if ( (strcmp(_URL->host, _connectedHost) == 0) && (_URL->port == _connectedPort) )
|
||||
@ -591,6 +597,17 @@ bool AsyncHTTPRequest::open(const char* method, const char* URL)
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if ( _client && _client->connected() && (strcmp(_URL->host, _connectedHost) != 0 || _URL->port != _connectedPort))
|
||||
{
|
||||
AHTTP_LOGERROR(F("open: not connected"));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
char* hostName = new char[strlen(_URL->host) + 10];
|
||||
|
||||
if (hostName)
|
||||
@ -810,75 +827,167 @@ int AsyncHTTPRequest::responseHTTPcode()
|
||||
|
||||
String AsyncHTTPRequest::responseHTTPString()
|
||||
{
|
||||
switch(_HTTPcode)
|
||||
switch (_HTTPcode)
|
||||
{
|
||||
case 0:
|
||||
return F("OK");
|
||||
|
||||
case HTTPCODE_CONNECTION_REFUSED:
|
||||
return F("CONNECTION_REFUSED");
|
||||
|
||||
case HTTPCODE_SEND_HEADER_FAILED:
|
||||
return F("SEND_HEADER_FAILED");
|
||||
|
||||
case HTTPCODE_SEND_PAYLOAD_FAILED:
|
||||
return F("SEND_PAYLOAD_FAILED");
|
||||
|
||||
case HTTPCODE_NOT_CONNECTED:
|
||||
return F("NOT_CONNECTED");
|
||||
|
||||
case HTTPCODE_CONNECTION_LOST:
|
||||
return F("CONNECTION_LOST");
|
||||
|
||||
case HTTPCODE_NO_STREAM:
|
||||
return F("NO_STREAM");
|
||||
|
||||
case HTTPCODE_NO_HTTP_SERVER:
|
||||
return F("NO_HTTP_SERVER");
|
||||
|
||||
case HTTPCODE_TOO_LESS_RAM:
|
||||
return F("TOO_LESS_RAM");
|
||||
|
||||
case HTTPCODE_ENCODING:
|
||||
return F("ENCODING");
|
||||
|
||||
case HTTPCODE_STREAM_WRITE:
|
||||
return F("STREAM_WRITE");
|
||||
|
||||
case HTTPCODE_TIMEOUT:
|
||||
return F("TIMEOUT");
|
||||
|
||||
// HTTP positive code
|
||||
case 100: return F("Continue");
|
||||
case 101: return F("Switching Protocols");
|
||||
case 200: return F("HTTP OK");
|
||||
case 201: return F("Created");
|
||||
case 202: return F("Accepted");
|
||||
case 203: return F("Non-Authoritative Information");
|
||||
case 204: return F("No Content");
|
||||
case 205: return F("Reset Content");
|
||||
case 206: return F("Partial Content");
|
||||
case 300: return F("Multiple Choices");
|
||||
case 301: return F("Moved Permanently");
|
||||
case 302: return F("Found");
|
||||
case 303: return F("See Other");
|
||||
case 304: return F("Not Modified");
|
||||
case 305: return F("Use Proxy");
|
||||
case 307: return F("Temporary Redirect");
|
||||
case 400: return F("Bad Request");
|
||||
case 401: return F("Unauthorized");
|
||||
case 402: return F("Payment Required");
|
||||
case 403: return F("Forbidden");
|
||||
case 404: return F("Not Found");
|
||||
case 405: return F("Method Not Allowed");
|
||||
case 406: return F("Not Acceptable");
|
||||
case 407: return F("Proxy Authentication Required");
|
||||
case 408: return F("Request Time-out");
|
||||
case 409: return F("Conflict");
|
||||
case 410: return F("Gone");
|
||||
case 411: return F("Length Required");
|
||||
case 412: return F("Precondition Failed");
|
||||
case 413: return F("Request Entity Too Large");
|
||||
case 414: return F("Request-URI Too Large");
|
||||
case 415: return F("Unsupported Media Type");
|
||||
case 416: return F("Requested range not satisfiable");
|
||||
case 417: return F("Expectation Failed");
|
||||
case 500: return F("Internal Server Error");
|
||||
case 501: return F("Not Implemented");
|
||||
case 502: return F("Bad Gateway");
|
||||
case 503: return F("Service Unavailable");
|
||||
case 504: return F("Gateway Time-out");
|
||||
case 505: return F("HTTP Version not supported");
|
||||
default: return "UNKNOWN";
|
||||
case 100:
|
||||
return F("Continue");
|
||||
|
||||
case 101:
|
||||
return F("Switching Protocols");
|
||||
|
||||
case 200:
|
||||
return F("HTTP OK");
|
||||
|
||||
case 201:
|
||||
return F("Created");
|
||||
|
||||
case 202:
|
||||
return F("Accepted");
|
||||
|
||||
case 203:
|
||||
return F("Non-Authoritative Information");
|
||||
|
||||
case 204:
|
||||
return F("No Content");
|
||||
|
||||
case 205:
|
||||
return F("Reset Content");
|
||||
|
||||
case 206:
|
||||
return F("Partial Content");
|
||||
|
||||
case 300:
|
||||
return F("Multiple Choices");
|
||||
|
||||
case 301:
|
||||
return F("Moved Permanently");
|
||||
|
||||
case 302:
|
||||
return F("Found");
|
||||
|
||||
case 303:
|
||||
return F("See Other");
|
||||
|
||||
case 304:
|
||||
return F("Not Modified");
|
||||
|
||||
case 305:
|
||||
return F("Use Proxy");
|
||||
|
||||
case 307:
|
||||
return F("Temporary Redirect");
|
||||
|
||||
case 400:
|
||||
return F("Bad Request");
|
||||
|
||||
case 401:
|
||||
return F("Unauthorized");
|
||||
|
||||
case 402:
|
||||
return F("Payment Required");
|
||||
|
||||
case 403:
|
||||
return F("Forbidden");
|
||||
|
||||
case 404:
|
||||
return F("Not Found");
|
||||
|
||||
case 405:
|
||||
return F("Method Not Allowed");
|
||||
|
||||
case 406:
|
||||
return F("Not Acceptable");
|
||||
|
||||
case 407:
|
||||
return F("Proxy Authentication Required");
|
||||
|
||||
case 408:
|
||||
return F("Request Time-out");
|
||||
|
||||
case 409:
|
||||
return F("Conflict");
|
||||
|
||||
case 410:
|
||||
return F("Gone");
|
||||
|
||||
case 411:
|
||||
return F("Length Required");
|
||||
|
||||
case 412:
|
||||
return F("Precondition Failed");
|
||||
|
||||
case 413:
|
||||
return F("Request Entity Too Large");
|
||||
|
||||
case 414:
|
||||
return F("Request-URI Too Large");
|
||||
|
||||
case 415:
|
||||
return F("Unsupported Media Type");
|
||||
|
||||
case 416:
|
||||
return F("Requested range not satisfiable");
|
||||
|
||||
case 417:
|
||||
return F("Expectation Failed");
|
||||
|
||||
case 500:
|
||||
return F("Internal Server Error");
|
||||
|
||||
case 501:
|
||||
return F("Not Implemented");
|
||||
|
||||
case 502:
|
||||
return F("Bad Gateway");
|
||||
|
||||
case 503:
|
||||
return F("Service Unavailable");
|
||||
|
||||
case 504:
|
||||
return F("Gateway Time-out");
|
||||
|
||||
case 505:
|
||||
return F("HTTP Version not supported");
|
||||
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1268,7 +1377,7 @@ size_t AsyncHTTPRequest::_send()
|
||||
|
||||
size_t sent = 0;
|
||||
|
||||
#define TEMP_SIZE 255
|
||||
#define TEMP_SIZE 255
|
||||
|
||||
uint8_t* temp = new uint8_t[TEMP_SIZE + 1];
|
||||
|
||||
|
70
utils/astyle_library.conf
Normal file
70
utils/astyle_library.conf
Normal file
@ -0,0 +1,70 @@
|
||||
# Code formatting rules for Arduino libraries, modified from for KH libraries:
|
||||
#
|
||||
# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
|
||||
#
|
||||
|
||||
# astyle --style=allman -s2 -t2 -C -S -xW -Y -M120 -f -p -xg -H -xb -c --xC120 -xL *.h *.cpp *.ino
|
||||
|
||||
--mode=c
|
||||
--lineend=linux
|
||||
--style=allman
|
||||
|
||||
# -r or -R
|
||||
#--recursive
|
||||
|
||||
# -c => Converts tabs into spaces
|
||||
convert-tabs
|
||||
|
||||
# -s2 => 2 spaces indentation
|
||||
--indent=spaces=2
|
||||
|
||||
# -t2 => tab =2 spaces
|
||||
#--indent=tab=2
|
||||
|
||||
# -C
|
||||
--indent-classes
|
||||
|
||||
# -S
|
||||
--indent-switches
|
||||
|
||||
# -xW
|
||||
--indent-preproc-block
|
||||
|
||||
# -Y => indent classes, switches (and cases), comments starting at column 1
|
||||
--indent-col1-comments
|
||||
|
||||
# -M120 => maximum of 120 spaces to indent a continuation line
|
||||
--max-continuation-indent=120
|
||||
|
||||
# -xC120 => max‑code‑length will break a line if the code exceeds # characters
|
||||
--max-code-length=120
|
||||
|
||||
# -f =>
|
||||
--break-blocks
|
||||
|
||||
# -p => put a space around operators
|
||||
--pad-oper
|
||||
|
||||
# -xg => Insert space padding after commas
|
||||
--pad-comma
|
||||
|
||||
# -H => put a space after if/for/while
|
||||
pad-header
|
||||
|
||||
# -xb => Break one line headers (e.g. if/for/while)
|
||||
--break-one-line-headers
|
||||
|
||||
# -c => Converts tabs into spaces
|
||||
#--convert-tabs
|
||||
|
||||
# if you like one-liners, keep them
|
||||
#keep-one-line-statements
|
||||
|
||||
# -xV
|
||||
--attach-closing-while
|
||||
|
||||
#unpad-paren
|
||||
|
||||
# -xp
|
||||
remove-comment-prefix
|
||||
|
6
utils/restyle.sh
Normal file
6
utils/restyle.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
for dir in . ; do
|
||||
find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.ino" \) -exec astyle --suffix=none --options=./utils/astyle_library.conf \{\} \;
|
||||
done
|
||||
|
Reference in New Issue
Block a user