diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2708f93..1f031ed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,13 +10,15 @@ However, before reporting a bug please check through the following: If you don't find anything, please [open a new issue](https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet/issues/new). +--- + ### How to submit a bug report Please ensure to specify the following: * Arduino IDE version (e.g. 1.8.19) or Platform.io version -* Board Type (e.g. ESP32S3_DEV, ESP32S2_DEV, ESP32C3_DEV) -* Board Core Version (e.g. ESP32 core v2.0.5) +* Board Type (e.g. ESP32_DEV, ESP32S3_DEV, ESP32S2_DEV, ESP32C3_DEV) +* Board Core Version (e.g. ESP32 core v2.0.6) * Contextual information (e.g. what you were trying to achieve) * Simplest possible steps to reproduce * Anything that might be relevant in your opinion, such as: @@ -24,17 +26,18 @@ Please ensure to specify the following: * Network configuration -Please be educated, civilized and constructive. Disrespective posts against [GitHub Code of Conduct](https://docs.github.com/en/site-policy/github-terms/github-event-code-of-conduct) will be ignored and deleted. +Please be educated, civilized and constructive as you've always been. Disrespective posts against [GitHub Code of Conduct](https://docs.github.com/en/site-policy/github-terms/github-event-code-of-conduct) will be ignored and deleted. +--- ### Example ``` Arduino IDE version: 1.8.19 ESP32S3_DEV board -ESP32 core v2.0.5 +ESP32 core v2.0.6 OS: Ubuntu 20.04 LTS -Linux xy-Inspiron-3593 5.15.0-56-generic #62~20.04.1-Ubuntu SMP Tue Nov 22 21:24:20 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux +Linux xy-Inspiron-3593 5.15.0-57-generic #63~20.04.1-Ubuntu SMP Wed Nov 30 13:40:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Context: I encountered a crash while using this library diff --git a/changelog.md b/changelog.md index 94205c4..d751a4c 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,7 @@ ## Table of Contents * [Changelog](#changelog) + * [Releases v1.14.0](#releases-v1140) * [Releases v1.13.0](#releases-v1130) * [Releases v1.12.0](#releases-v1120) @@ -25,6 +26,10 @@ ## Changelog +### Releases v1.14.0 + +1. Add support to `ESP32` and `ESP32S2/S3/C3` boards using `LwIP W6100 Ethernet` + ### Releases v1.13.0 1. Add support to `ESP32S2/C3` boards using `LwIP W5500 or ENC28J60 Ethernet` diff --git a/examples/ESP32_ENC/AsyncHTTPMultiRequests_ESP32_ENC/AsyncHTTPMultiRequests_ESP32_ENC.ino b/examples/ESP32_ENC/AsyncHTTPMultiRequests_ESP32_ENC/AsyncHTTPMultiRequests_ESP32_ENC.ino index 3edc534..f9f7116 100644 --- a/examples/ESP32_ENC/AsyncHTTPMultiRequests_ESP32_ENC/AsyncHTTPMultiRequests_ESP32_ENC.ino +++ b/examples/ESP32_ENC/AsyncHTTPMultiRequests_ESP32_ENC/AsyncHTTPMultiRequests_ESP32_ENC.ino @@ -73,8 +73,8 @@ #include // https://github.com/khoih-prog/WebServer_ESP32_ENC -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.12.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1012000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/ESP32_ENC/AsyncHTTPRequest_ESP32_ENC/AsyncHTTPRequest_ESP32_ENC.ino b/examples/ESP32_ENC/AsyncHTTPRequest_ESP32_ENC/AsyncHTTPRequest_ESP32_ENC.ino index 81190b2..0d674c3 100644 --- a/examples/ESP32_ENC/AsyncHTTPRequest_ESP32_ENC/AsyncHTTPRequest_ESP32_ENC.ino +++ b/examples/ESP32_ENC/AsyncHTTPRequest_ESP32_ENC/AsyncHTTPRequest_ESP32_ENC.ino @@ -73,8 +73,8 @@ #include // https://github.com/khoih-prog/WebServer_ESP32_ENC -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.12.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1012000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/ESP32_SC_ENC/AsyncHTTPMultiRequests_ESP32_SC_ENC/AsyncHTTPMultiRequests_ESP32_SC_ENC.ino b/examples/ESP32_SC_ENC/AsyncHTTPMultiRequests_ESP32_SC_ENC/AsyncHTTPMultiRequests_ESP32_SC_ENC.ino index e0743f0..cff8015 100644 --- a/examples/ESP32_SC_ENC/AsyncHTTPMultiRequests_ESP32_SC_ENC/AsyncHTTPMultiRequests_ESP32_SC_ENC.ino +++ b/examples/ESP32_SC_ENC/AsyncHTTPMultiRequests_ESP32_SC_ENC/AsyncHTTPMultiRequests_ESP32_SC_ENC.ino @@ -88,8 +88,8 @@ #include // https://github.com/khoih-prog/WebServer_ESP32_SC_ENC -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.13.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1013000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/ESP32_SC_ENC/AsyncHTTPRequest_ESP32_SC_ENC/AsyncHTTPRequest_ESP32_SC_ENC.ino b/examples/ESP32_SC_ENC/AsyncHTTPRequest_ESP32_SC_ENC/AsyncHTTPRequest_ESP32_SC_ENC.ino index 965e04b..b3a495a 100644 --- a/examples/ESP32_SC_ENC/AsyncHTTPRequest_ESP32_SC_ENC/AsyncHTTPRequest_ESP32_SC_ENC.ino +++ b/examples/ESP32_SC_ENC/AsyncHTTPRequest_ESP32_SC_ENC/AsyncHTTPRequest_ESP32_SC_ENC.ino @@ -88,8 +88,8 @@ #include // https://github.com/khoih-prog/WebServer_ESP32_SC_ENC -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.13.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1013000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/ESP32_SC_W5500/AsyncHTTPMultiRequests_ESP32_SC_W5500/AsyncHTTPMultiRequests_ESP32_SC_W5500.ino b/examples/ESP32_SC_W5500/AsyncHTTPMultiRequests_ESP32_SC_W5500/AsyncHTTPMultiRequests_ESP32_SC_W5500.ino index c8b83fb..f0de373 100644 --- a/examples/ESP32_SC_W5500/AsyncHTTPMultiRequests_ESP32_SC_W5500/AsyncHTTPMultiRequests_ESP32_SC_W5500.ino +++ b/examples/ESP32_SC_W5500/AsyncHTTPMultiRequests_ESP32_SC_W5500/AsyncHTTPMultiRequests_ESP32_SC_W5500.ino @@ -88,8 +88,8 @@ #include // https://github.com/khoih-prog/WebServer_ESP32_SC_W5500 -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.13.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1013000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/ESP32_SC_W5500/AsyncHTTPRequest_ESP32_SC_W5500/AsyncHTTPRequest_ESP32_SC_W5500.ino b/examples/ESP32_SC_W5500/AsyncHTTPRequest_ESP32_SC_W5500/AsyncHTTPRequest_ESP32_SC_W5500.ino index 0e70804..1496ef2 100644 --- a/examples/ESP32_SC_W5500/AsyncHTTPRequest_ESP32_SC_W5500/AsyncHTTPRequest_ESP32_SC_W5500.ino +++ b/examples/ESP32_SC_W5500/AsyncHTTPRequest_ESP32_SC_W5500/AsyncHTTPRequest_ESP32_SC_W5500.ino @@ -88,8 +88,8 @@ #include // https://github.com/khoih-prog/WebServer_ESP32_SC_W5500 -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.13.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1013000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/ESP32_SC_W6100/AsyncHTTPMultiRequests_ESP32_SC_W6100/AsyncHTTPMultiRequests_ESP32_SC_W6100.ino b/examples/ESP32_SC_W6100/AsyncHTTPMultiRequests_ESP32_SC_W6100/AsyncHTTPMultiRequests_ESP32_SC_W6100.ino new file mode 100644 index 0000000..5a78e20 --- /dev/null +++ b/examples/ESP32_SC_W6100/AsyncHTTPMultiRequests_ESP32_SC_W6100/AsyncHTTPMultiRequests_ESP32_SC_W6100.ino @@ -0,0 +1,320 @@ +/**************************************************************************************************************************** + AsyncHTTPMultiRequests_ESP32_SC_W6100.ino + + For ESP32 using LwIP W5500 / W6100 / ENC28J60 / LAN8720 Ethernet + + AsyncHTTPRequest_ESP32_Ethernet is a library for ESP32 using LwIP W5500 / W6100 / ENC28J60 / LAN8720 Ethernet + + Based on and modified from asyncHTTPrequest Library (https://github.com/boblemaire/asyncHTTPrequest) + + Built by Khoi Hoang https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet + Licensed under GPLv3 license + + Copyright (C) <2018> + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License + as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program. If not, see . + *****************************************************************************************************************************/ +//************************************************************************************************************ +// +// There are scores of ways to use AsyncHTTPRequest. The important thing to keep in mind is that +// it is asynchronous and just like in JavaScript, everything is event driven. You will have some +// reason to initiate an asynchronous HTTP request in your program, but then sending the request +// headers and payload, gathering the response headers and any payload, and processing +// of that response, can (and probably should) all be done asynchronously. +// +// In this example, a Ticker function is setup to fire every 300 seconds to initiate a request. +// Everything is handled in AsyncHTTPRequest without blocking. +// The callback onReadyStateChange is made progressively and like most JS scripts, we look for +// readyState == 4 (complete) here. At that time the response is retrieved and printed. +// +// Note that there is no code in loop(). A code entered into loop would run oblivious to +// the ongoing HTTP requests. The Ticker could be removed and periodic calls to sendRequest() +// could be made in loop(), resulting in the same asynchronous handling. +// +// For demo purposes, debug is turned on for handling of the first request. These are the +// events that are being handled in AsyncHTTPRequest. They all begin with Debug(nnn) where +// nnn is the elapsed time in milliseconds since the transaction was started. +// +//************************************************************************************************************* + +#if !( defined(ESP32) ) + #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#endif + +// Level from 0-4 +#define ASYNC_HTTP_DEBUG_PORT Serial +#define _ASYNC_HTTP_LOGLEVEL_ 4 +#define _ETHERNET_WEBSERVER_LOGLEVEL_ 4 + +// 300s = 5 minutes to not flooding +#define HTTP_REQUEST_INTERVAL 60 //300 + +// 10s +#define HEARTBEAT_INTERVAL 10 + +////////////////////////////////////////////////////////// + +// For ESP32-S3 +// Optional values to override default settings +//#define ETH_SPI_HOST SPI2_HOST +//#define SPI_CLOCK_MHZ 8 + +// Must connect INT to GPIOxx or not working +//#define INT_GPIO 4 + +//#define MISO_GPIO 13 +//#define MOSI_GPIO 11 +//#define SCK_GPIO 12 +//#define CS_GPIO 10 + +// For ESP32_C3 +// Optional values to override default settings +// Don't change unless you know what you're doing +//#define ETH_SPI_HOST SPI2_HOST +//#define SPI_CLOCK_MHZ 8 + +// Must connect INT to GPIOxx or not working +//#define INT_GPIO 10 + +//#define MISO_GPIO 5 +//#define MOSI_GPIO 6 +//#define SCK_GPIO 4 +//#define CS_GPIO 7 + +////////////////////////////////////////////////////////// + +#include // https://github.com/khoih-prog/WebServer_ESP32_SC_W6100 + +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 + +// 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 // https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet + +#include + +AsyncHTTPRequest request; +Ticker ticker; +Ticker ticker1; + +///////////////////////////////////////////// + +// Enter a MAC address and IP address for your controller below. +#define NUMBER_OF_MAC 20 + +byte mac[][NUMBER_OF_MAC] = +{ + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 }, +}; + +// Select the IP address according to your local network +IPAddress myIP(192, 168, 2, 232); +IPAddress myGW(192, 168, 2, 1); +IPAddress mySN(255, 255, 255, 0); + +// Google DNS Server IP +IPAddress myDNS(8, 8, 8, 8); + +///////////////////////////////////////////// + +void heartBeatPrint(void) +{ + static int num = 1; + + if (ESP32_W6100_isConnected()) + Serial.print(F("H")); // H means connected to WiFi + else + Serial.print(F("F")); // F means not connected to WiFi + + if (num == 80) + { + Serial.println(); + num = 1; + } + else if (num++ % 10 == 0) + { + Serial.print(F(" ")); + } +} + +// To replace with your real APP_API +#define APP_API "SECRECT_APP_API" + +String requestPart1 = "http://api.openweathermap.org/data/2.5/onecall?lat=-24.32&lon=-46.9983"; +String requestAPPID = "&appid=" + String(APP_API); + +// exclude fields: current,minutely,hourly,daily,alerts +String requestCurrent = requestPart1 + "&exclude=minutely,hourly,daily,alerts" + requestAPPID; +String requestMinutely = requestPart1 + "&exclude=current,hourly,daily,alerts" + requestAPPID; +String requestHourly = requestPart1 + "&exclude=current,minutely,daily,alerts" + requestAPPID; +String requestDaily = requestPart1 + "&exclude=current,minutely,hourly,alerts" + requestAPPID; +String requestAlert = requestPart1 + "&exclude=current,minutely,hourly,daily" + requestAPPID; + +#define NUM_REQUESTS 5 + +const char* requestName[ NUM_REQUESTS ] = { "Current", "Minutely", "Hourly", "Daily", "Alert" }; + +const char* requestAll[ NUM_REQUESTS ] = { requestCurrent.c_str(), requestMinutely.c_str(), requestHourly.c_str(), requestDaily.c_str(), requestAlert.c_str() }; + +uint8_t requestIndex = 0; + +void sendRequest() +{ + static bool requestOpenResult; + + if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone) + { + requestOpenResult = request.open("GET", requestAll[requestIndex] ); + + if (requestOpenResult) + { + // Only send() if open() returns true, or crash + request.send(); + } + else + { + Serial.println("Can't send bad request"); + } + } + else + { + Serial.println("Can't send request"); + } +} + +void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState) +{ + (void) optParm; + + if (readyState == readyStateDone) + { + AHTTP_LOGDEBUG(F("\n**************************************")); + AHTTP_LOGDEBUG1(F("Response Code = "), request->responseHTTPString()); + + if (request->responseHTTPcode() == 200) + { + 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; +#endif + + request->setDebug(false); + } +} + + +void setup() +{ + // put your setup code here, to run once: + Serial.begin(115200); + + while (!Serial && millis() < 5000); + + delay(500); + + Serial.print("\nStart AsyncHTTPMultiRequests_ESP32_SC_W6100 on "); + Serial.print(ARDUINO_BOARD); + Serial.print(" with "); + Serial.println(SHIELD_TYPE); + Serial.println(WEBSERVER_ESP32_SC_W6100_VERSION); + Serial.println(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION); + + Serial.setDebugOutput(true); + +#if defined(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN) + + if (ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_INT < ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN) + { + Serial.print("Warning. Must use this example on Version equal or later than : "); + Serial.println(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET); + } + +#endif + + AHTTP_LOGWARN(F("Default SPI pinout:")); + AHTTP_LOGWARN1(F("SPI_HOST:"), ETH_SPI_HOST); + AHTTP_LOGWARN1(F("MOSI:"), MOSI_GPIO); + AHTTP_LOGWARN1(F("MISO:"), MISO_GPIO); + AHTTP_LOGWARN1(F("SCK:"), SCK_GPIO); + AHTTP_LOGWARN1(F("CS:"), CS_GPIO); + AHTTP_LOGWARN1(F("INT:"), INT_GPIO); + AHTTP_LOGWARN1(F("SPI Clock (MHz):"), SPI_CLOCK_MHZ); + AHTTP_LOGWARN(F("=========================")); + + /////////////////////////////////// + + // To be called before ETH.begin() + ESP32_W6100_onEvent(); + + // start the ethernet connection and the server: + // Use DHCP dynamic IP and random mac + //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); + + // Static IP, leave without this line to get IP via DHCP + //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); + //ETH.config(myIP, myGW, mySN, myDNS); + + ESP32_W6100_waitForConnect(); + + /////////////////////////////////// + + Serial.print(F("AsyncHTTPRequest @ IP : ")); + Serial.println(ETH.localIP()); + + request.setDebug(false); + + request.onReadyStateChange(requestCB); + ticker.attach(HTTP_REQUEST_INTERVAL, sendRequest); + + ticker1.attach(HEARTBEAT_INTERVAL, heartBeatPrint); + + // Send first request now + sendRequest(); +} + +void loop() +{ +} diff --git a/examples/ESP32_SC_W6100/AsyncHTTPRequest_ESP32_SC_W6100/AsyncHTTPRequest_ESP32_SC_W6100.ino b/examples/ESP32_SC_W6100/AsyncHTTPRequest_ESP32_SC_W6100/AsyncHTTPRequest_ESP32_SC_W6100.ino new file mode 100644 index 0000000..13211e0 --- /dev/null +++ b/examples/ESP32_SC_W6100/AsyncHTTPRequest_ESP32_SC_W6100/AsyncHTTPRequest_ESP32_SC_W6100.ino @@ -0,0 +1,282 @@ +/**************************************************************************************************************************** + AsyncHTTPRequest_ESP32_SC_W6100.ino + + For ESP32 using LwIP W5500 / W6100 / ENC28J60 / LAN8720 Ethernet + + AsyncHTTPRequest_ESP32_Ethernet is a library for ESP32 using LwIP W5500 / W6100 / ENC28J60 / LAN8720 Ethernet + + Based on and modified from asyncHTTPrequest Library (https://github.com/boblemaire/asyncHTTPrequest) + + Built by Khoi Hoang https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet + Licensed under GPLv3 license + + Copyright (C) <2018> + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License + as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program. If not, see . + *****************************************************************************************************************************/ +//************************************************************************************************************ +// +// There are scores of ways to use AsyncHTTPRequest. The important thing to keep in mind is that +// it is asynchronous and just like in JavaScript, everything is event driven. You will have some +// reason to initiate an asynchronous HTTP request in your program, but then sending the request +// headers and payload, gathering the response headers and any payload, and processing +// of that response, can (and probably should) all be done asynchronously. +// +// In this example, a Ticker function is setup to fire every 300 seconds to initiate a request. +// Everything is handled in AsyncHTTPRequest without blocking. +// The callback onReadyStateChange is made progressively and like most JS scripts, we look for +// readyState == 4 (complete) here. At that time the response is retrieved and printed. +// +// Note that there is no code in loop(). A code entered into loop would run oblivious to +// the ongoing HTTP requests. The Ticker could be removed and periodic calls to sendRequest() +// could be made in loop(), resulting in the same asynchronous handling. +// +// For demo purposes, debug is turned on for handling of the first request. These are the +// events that are being handled in AsyncHTTPRequest. They all begin with Debug(nnn) where +// nnn is the elapsed time in milliseconds since the transaction was started. +// +//************************************************************************************************************* + +#if !( defined(ESP32) ) + #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#endif + +// Level from 0-4 +#define ASYNC_HTTP_DEBUG_PORT Serial +#define _ASYNC_HTTP_LOGLEVEL_ 1 +#define _ETHERNET_WEBSERVER_LOGLEVEL_ 1 + +// 300s = 5 minutes to not flooding +#define HTTP_REQUEST_INTERVAL 60 //300 + +// 10s +#define HEARTBEAT_INTERVAL 10 + +////////////////////////////////////////////////////////// + +// For ESP32-S3 +// Optional values to override default settings +//#define ETH_SPI_HOST SPI2_HOST +//#define SPI_CLOCK_MHZ 8 + +// Must connect INT to GPIOxx or not working +//#define INT_GPIO 4 + +//#define MISO_GPIO 13 +//#define MOSI_GPIO 11 +//#define SCK_GPIO 12 +//#define CS_GPIO 10 + +// For ESP32_C3 +// Optional values to override default settings +// Don't change unless you know what you're doing +//#define ETH_SPI_HOST SPI2_HOST +//#define SPI_CLOCK_MHZ 8 + +// Must connect INT to GPIOxx or not working +//#define INT_GPIO 10 + +//#define MISO_GPIO 5 +//#define MOSI_GPIO 6 +//#define SCK_GPIO 4 +//#define CS_GPIO 7 + +////////////////////////////////////////////////////////// + +#include // https://github.com/khoih-prog/WebServer_ESP32_SC_W6100 + +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 + +// 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 // https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet + +#include + +AsyncHTTPRequest request; +Ticker ticker; +Ticker ticker1; + +///////////////////////////////////////////// + +// Enter a MAC address and IP address for your controller below. +#define NUMBER_OF_MAC 20 + +byte mac[][NUMBER_OF_MAC] = +{ + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 }, +}; + +// Select the IP address according to your local network +IPAddress myIP(192, 168, 2, 232); +IPAddress myGW(192, 168, 2, 1); +IPAddress mySN(255, 255, 255, 0); + +// Google DNS Server IP +IPAddress myDNS(8, 8, 8, 8); + +///////////////////////////////////////////// + +void heartBeatPrint(void) +{ + static int num = 1; + + if (ESP32_W6100_isConnected()) + Serial.print(F("H")); // H means connected + else + Serial.print(F("F")); // F means not connected + + if (num == 80) + { + Serial.println(); + num = 1; + } + else if (num++ % 10 == 0) + { + Serial.print(F(" ")); + } +} + +void sendRequest() +{ + static bool requestOpenResult; + + if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone) + { + //requestOpenResult = request.open("GET", "http://worldtimeapi.org/api/timezone/Europe/London.txt"); + requestOpenResult = request.open("GET", "http://worldtimeapi.org/api/timezone/America/Toronto.txt"); + + if (requestOpenResult) + { + // Only send() if open() returns true, or crash + request.send(); + } + else + { + Serial.println("Can't send bad request"); + } + } + else + { + Serial.println("Can't send request"); + } +} + +void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState) +{ + (void) optParm; + + if (readyState == readyStateDone) + { + AHTTP_LOGDEBUG(F("\n**************************************")); + AHTTP_LOGDEBUG1(F("Response Code = "), request->responseHTTPString()); + + if (request->responseHTTPcode() == 200) + { + Serial.println(F("\n**************************************")); + Serial.println(request->responseText()); + Serial.println(F("**************************************")); + } + } +} + +void setup() +{ + // put your setup code here, to run once: + Serial.begin(115200); + + while (!Serial && millis() < 5000); + + delay(500); + + Serial.print("\nStart AsyncHTTPRequest_ESP32_SC_W6100 on "); + Serial.print(ARDUINO_BOARD); + Serial.print(" with "); + Serial.println(SHIELD_TYPE); + Serial.println(WEBSERVER_ESP32_SC_W6100_VERSION); + Serial.println(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION); + + Serial.setDebugOutput(true); + +#if defined(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN) + + if (ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_INT < ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN) + { + Serial.print("Warning. Must use this example on Version equal or later than : "); + Serial.println(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET); + } + +#endif + + AHTTP_LOGWARN(F("Default SPI pinout:")); + AHTTP_LOGWARN1(F("SPI_HOST:"), ETH_SPI_HOST); + AHTTP_LOGWARN1(F("MOSI:"), MOSI_GPIO); + AHTTP_LOGWARN1(F("MISO:"), MISO_GPIO); + AHTTP_LOGWARN1(F("SCK:"), SCK_GPIO); + AHTTP_LOGWARN1(F("CS:"), CS_GPIO); + AHTTP_LOGWARN1(F("INT:"), INT_GPIO); + AHTTP_LOGWARN1(F("SPI Clock (MHz):"), SPI_CLOCK_MHZ); + AHTTP_LOGWARN(F("=========================")); + + /////////////////////////////////// + + // To be called before ETH.begin() + ESP32_W6100_onEvent(); + + // start the ethernet connection and the server: + // Use DHCP dynamic IP and random mac + //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); + + // Static IP, leave without this line to get IP via DHCP + //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); + //ETH.config(myIP, myGW, mySN, myDNS); + + ESP32_W6100_waitForConnect(); + + /////////////////////////////////// + + Serial.print(F("\nHTTP WebClient is @ IP : ")); + Serial.println(ETH.localIP()); + + request.setDebug(false); + + request.onReadyStateChange(requestCB); + ticker.attach(HTTP_REQUEST_INTERVAL, sendRequest); + + ticker1.attach(HEARTBEAT_INTERVAL, heartBeatPrint); + + // Send first request now + sendRequest(); +} + +void loop() +{ +} diff --git a/examples/ESP32_W5500/AsyncHTTPMultiRequests_ESP32_W5500/AsyncHTTPMultiRequests_ESP32_W5500.ino b/examples/ESP32_W5500/AsyncHTTPMultiRequests_ESP32_W5500/AsyncHTTPMultiRequests_ESP32_W5500.ino index 5970e15..115357d 100644 --- a/examples/ESP32_W5500/AsyncHTTPMultiRequests_ESP32_W5500/AsyncHTTPMultiRequests_ESP32_W5500.ino +++ b/examples/ESP32_W5500/AsyncHTTPMultiRequests_ESP32_W5500/AsyncHTTPMultiRequests_ESP32_W5500.ino @@ -74,8 +74,8 @@ #include // https://github.com/khoih-prog/WebServer_ESP32_W5500 -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.12.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1012000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/ESP32_W5500/AsyncHTTPRequest_ESP32_W5500/AsyncHTTPRequest_ESP32_W5500.ino b/examples/ESP32_W5500/AsyncHTTPRequest_ESP32_W5500/AsyncHTTPRequest_ESP32_W5500.ino index 0dc47b5..1dd109a 100644 --- a/examples/ESP32_W5500/AsyncHTTPRequest_ESP32_W5500/AsyncHTTPRequest_ESP32_W5500.ino +++ b/examples/ESP32_W5500/AsyncHTTPRequest_ESP32_W5500/AsyncHTTPRequest_ESP32_W5500.ino @@ -74,8 +74,8 @@ #include // https://github.com/khoih-prog/WebServer_ESP32_W5500 -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.12.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1012000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/ESP32_W6100/AsyncHTTPMultiRequests_ESP32_W6100/AsyncHTTPMultiRequests_ESP32_W6100.ino b/examples/ESP32_W6100/AsyncHTTPMultiRequests_ESP32_W6100/AsyncHTTPMultiRequests_ESP32_W6100.ino new file mode 100644 index 0000000..efbbc82 --- /dev/null +++ b/examples/ESP32_W6100/AsyncHTTPMultiRequests_ESP32_W6100/AsyncHTTPMultiRequests_ESP32_W6100.ino @@ -0,0 +1,306 @@ +/**************************************************************************************************************************** + AsyncHTTPMultiRequests_ESP32_W6100.ino + + For ESP32 using LwIP W5500 / W6100 / ENC28J60 / LAN8720 Ethernet + + AsyncHTTPRequest_ESP32_Ethernet is a library for ESP32 using LwIP W5500 / W6100 / ENC28J60 / LAN8720 Ethernet + + Based on and modified from asyncHTTPrequest Library (https://github.com/boblemaire/asyncHTTPrequest) + + Built by Khoi Hoang https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet + Licensed under GPLv3 license + + Copyright (C) <2018> + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License + as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program. If not, see . + *****************************************************************************************************************************/ +//************************************************************************************************************ +// +// There are scores of ways to use AsyncHTTPRequest. The important thing to keep in mind is that +// it is asynchronous and just like in JavaScript, everything is event driven. You will have some +// reason to initiate an asynchronous HTTP request in your program, but then sending the request +// headers and payload, gathering the response headers and any payload, and processing +// of that response, can (and probably should) all be done asynchronously. +// +// In this example, a Ticker function is setup to fire every 300 seconds to initiate a request. +// Everything is handled in AsyncHTTPRequest without blocking. +// The callback onReadyStateChange is made progressively and like most JS scripts, we look for +// readyState == 4 (complete) here. At that time the response is retrieved and printed. +// +// Note that there is no code in loop(). A code entered into loop would run oblivious to +// the ongoing HTTP requests. The Ticker could be removed and periodic calls to sendRequest() +// could be made in loop(), resulting in the same asynchronous handling. +// +// For demo purposes, debug is turned on for handling of the first request. These are the +// events that are being handled in AsyncHTTPRequest. They all begin with Debug(nnn) where +// nnn is the elapsed time in milliseconds since the transaction was started. +// +//************************************************************************************************************* + +#if !( defined(ESP32) ) + #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#endif + +// Level from 0-4 +#define ASYNC_HTTP_DEBUG_PORT Serial +#define _ASYNC_HTTP_LOGLEVEL_ 1 +#define _ETHERNET_WEBSERVER_LOGLEVEL_ 1 + +// 300s = 5 minutes to not flooding +#define HTTP_REQUEST_INTERVAL 60 //300 + +// 10s +#define HEARTBEAT_INTERVAL 10 + +////////////////////////////////////////////////////////// + +// Optional values to override default settings +// Don't change unless you know what you're doing +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 25 + +// Must connect INT to GPIOxx or not working +//#define INT_GPIO 4 + +//#define MISO_GPIO 19 +//#define MOSI_GPIO 23 +//#define SCK_GPIO 18 +//#define CS_GPIO 5 + +////////////////////////////////////////////////////////// + +#include // https://github.com/khoih-prog/WebServer_ESP32_W6100 + +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 + +// 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 // https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet + +#include + +AsyncHTTPRequest request; +Ticker ticker; +Ticker ticker1; + +///////////////////////////////////////////// + +// Enter a MAC address and IP address for your controller below. +#define NUMBER_OF_MAC 20 + +byte mac[][NUMBER_OF_MAC] = +{ + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 }, +}; + +// Select the IP address according to your local network +IPAddress myIP(192, 168, 2, 232); +IPAddress myGW(192, 168, 2, 1); +IPAddress mySN(255, 255, 255, 0); + +// Google DNS Server IP +IPAddress myDNS(8, 8, 8, 8); + +///////////////////////////////////////////// + +void heartBeatPrint(void) +{ + static int num = 1; + + if (ESP32_W6100_isConnected()) + Serial.print(F("H")); // H means connected to WiFi + else + Serial.print(F("F")); // F means not connected to WiFi + + if (num == 80) + { + Serial.println(); + num = 1; + } + else if (num++ % 10 == 0) + { + Serial.print(F(" ")); + } +} + +// To replace with your real APP_API +#define APP_API "SECRECT_APP_API" + +String requestPart1 = "http://api.openweathermap.org/data/2.5/onecall?lat=-24.32&lon=-46.9983"; +String requestAPPID = "&appid=" + String(APP_API); + +// exclude fields: current,minutely,hourly,daily,alerts +String requestCurrent = requestPart1 + "&exclude=minutely,hourly,daily,alerts" + requestAPPID; +String requestMinutely = requestPart1 + "&exclude=current,hourly,daily,alerts" + requestAPPID; +String requestHourly = requestPart1 + "&exclude=current,minutely,daily,alerts" + requestAPPID; +String requestDaily = requestPart1 + "&exclude=current,minutely,hourly,alerts" + requestAPPID; +String requestAlert = requestPart1 + "&exclude=current,minutely,hourly,daily" + requestAPPID; + +#define NUM_REQUESTS 5 + +const char* requestName[ NUM_REQUESTS ] = { "Current", "Minutely", "Hourly", "Daily", "Alert" }; + +const char* requestAll[ NUM_REQUESTS ] = { requestCurrent.c_str(), requestMinutely.c_str(), requestHourly.c_str(), requestDaily.c_str(), requestAlert.c_str() }; + +uint8_t requestIndex = 0; + +void sendRequest() +{ + static bool requestOpenResult; + + if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone) + { + requestOpenResult = request.open("GET", requestAll[requestIndex] ); + + if (requestOpenResult) + { + // Only send() if open() returns true, or crash + request.send(); + } + else + { + Serial.println("Can't send bad request"); + } + } + else + { + Serial.println("Can't send request"); + } +} + +void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState) +{ + (void) optParm; + + if (readyState == readyStateDone) + { + AHTTP_LOGDEBUG(F("\n**************************************")); + AHTTP_LOGDEBUG1(F("Response Code = "), request->responseHTTPString()); + + if (request->responseHTTPcode() == 200) + { + 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; +#endif + + request->setDebug(false); + } +} + + +void setup() +{ + // put your setup code here, to run once: + Serial.begin(115200); + + while (!Serial && millis() < 5000); + + delay(500); + + Serial.print("\nStart AsyncHTTPMultiRequests_ESP32_W6100 on "); + Serial.print(ARDUINO_BOARD); + Serial.print(" with "); + Serial.println(SHIELD_TYPE); + Serial.println(WEBSERVER_ESP32_W6100_VERSION); + Serial.println(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION); + + Serial.setDebugOutput(true); + +#if defined(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN) + + if (ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_INT < ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN) + { + Serial.print("Warning. Must use this example on Version equal or later than : "); + Serial.println(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET); + } + +#endif + + AHTTP_LOGWARN(F("Default SPI pinout:")); + AHTTP_LOGWARN1(F("SPI_HOST:"), ETH_SPI_HOST); + AHTTP_LOGWARN1(F("MOSI:"), MOSI_GPIO); + AHTTP_LOGWARN1(F("MISO:"), MISO_GPIO); + AHTTP_LOGWARN1(F("SCK:"), SCK_GPIO); + AHTTP_LOGWARN1(F("CS:"), CS_GPIO); + AHTTP_LOGWARN1(F("INT:"), INT_GPIO); + AHTTP_LOGWARN1(F("SPI Clock (MHz):"), SPI_CLOCK_MHZ); + AHTTP_LOGWARN(F("=========================")); + + /////////////////////////////////// + + // To be called before ETH.begin() + ESP32_W6100_onEvent(); + + // start the ethernet connection and the server: + // Use DHCP dynamic IP and random mac + //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); + + // Static IP, leave without this line to get IP via DHCP + //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); + //ETH.config(myIP, myGW, mySN, myDNS); + + ESP32_W6100_waitForConnect(); + + /////////////////////////////////// + + Serial.print(F("AsyncHTTPRequest @ IP : ")); + Serial.println(ETH.localIP()); + + request.setDebug(false); + + request.onReadyStateChange(requestCB); + ticker.attach(HTTP_REQUEST_INTERVAL, sendRequest); + + ticker1.attach(HEARTBEAT_INTERVAL, heartBeatPrint); + + // Send first request now + sendRequest(); +} + +void loop() +{ +} diff --git a/examples/ESP32_W6100/AsyncHTTPRequest_ESP32_W6100/AsyncHTTPRequest_ESP32_W6100.ino b/examples/ESP32_W6100/AsyncHTTPRequest_ESP32_W6100/AsyncHTTPRequest_ESP32_W6100.ino new file mode 100644 index 0000000..cf36a45 --- /dev/null +++ b/examples/ESP32_W6100/AsyncHTTPRequest_ESP32_W6100/AsyncHTTPRequest_ESP32_W6100.ino @@ -0,0 +1,268 @@ +/**************************************************************************************************************************** + AsyncHTTPRequest_ESP32_W6100.ino + + For ESP32 using LwIP W5500 / W6100 / ENC28J60 / LAN8720 Ethernet + + AsyncHTTPRequest_ESP32_Ethernet is a library for ESP32 using LwIP W5500 / W6100 / ENC28J60 / LAN8720 Ethernet + + Based on and modified from asyncHTTPrequest Library (https://github.com/boblemaire/asyncHTTPrequest) + + Built by Khoi Hoang https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet + Licensed under GPLv3 license + + Copyright (C) <2018> + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License + as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program. If not, see . + *****************************************************************************************************************************/ +//************************************************************************************************************ +// +// There are scores of ways to use AsyncHTTPRequest. The important thing to keep in mind is that +// it is asynchronous and just like in JavaScript, everything is event driven. You will have some +// reason to initiate an asynchronous HTTP request in your program, but then sending the request +// headers and payload, gathering the response headers and any payload, and processing +// of that response, can (and probably should) all be done asynchronously. +// +// In this example, a Ticker function is setup to fire every 300 seconds to initiate a request. +// Everything is handled in AsyncHTTPRequest without blocking. +// The callback onReadyStateChange is made progressively and like most JS scripts, we look for +// readyState == 4 (complete) here. At that time the response is retrieved and printed. +// +// Note that there is no code in loop(). A code entered into loop would run oblivious to +// the ongoing HTTP requests. The Ticker could be removed and periodic calls to sendRequest() +// could be made in loop(), resulting in the same asynchronous handling. +// +// For demo purposes, debug is turned on for handling of the first request. These are the +// events that are being handled in AsyncHTTPRequest. They all begin with Debug(nnn) where +// nnn is the elapsed time in milliseconds since the transaction was started. +// +//************************************************************************************************************* + +#if !( defined(ESP32) ) + #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#endif + +// Level from 0-4 +#define ASYNC_HTTP_DEBUG_PORT Serial +#define _ASYNC_HTTP_LOGLEVEL_ 1 +#define _ETHERNET_WEBSERVER_LOGLEVEL_ 1 + +// 300s = 5 minutes to not flooding +#define HTTP_REQUEST_INTERVAL 60 //300 + +// 10s +#define HEARTBEAT_INTERVAL 10 + +////////////////////////////////////////////////////////// + +// Optional values to override default settings +// Don't change unless you know what you're doing +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 25 + +// Must connect INT to GPIOxx or not working +//#define INT_GPIO 4 + +//#define MISO_GPIO 19 +//#define MOSI_GPIO 23 +//#define SCK_GPIO 18 +//#define CS_GPIO 5 + +////////////////////////////////////////////////////////// + +#include // https://github.com/khoih-prog/WebServer_ESP32_W6100 + +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 + +// 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 // https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet + +#include + +AsyncHTTPRequest request; +Ticker ticker; +Ticker ticker1; + +///////////////////////////////////////////// + +// Enter a MAC address and IP address for your controller below. +#define NUMBER_OF_MAC 20 + +byte mac[][NUMBER_OF_MAC] = +{ + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 }, + { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 }, +}; + +// Select the IP address according to your local network +IPAddress myIP(192, 168, 2, 232); +IPAddress myGW(192, 168, 2, 1); +IPAddress mySN(255, 255, 255, 0); + +// Google DNS Server IP +IPAddress myDNS(8, 8, 8, 8); + +///////////////////////////////////////////// + +void heartBeatPrint(void) +{ + static int num = 1; + + if (ESP32_W6100_isConnected()) + Serial.print(F("H")); // H means connected + else + Serial.print(F("F")); // F means not connected + + if (num == 80) + { + Serial.println(); + num = 1; + } + else if (num++ % 10 == 0) + { + Serial.print(F(" ")); + } +} + +void sendRequest() +{ + static bool requestOpenResult; + + if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone) + { + //requestOpenResult = request.open("GET", "http://worldtimeapi.org/api/timezone/Europe/London.txt"); + requestOpenResult = request.open("GET", "http://worldtimeapi.org/api/timezone/America/Toronto.txt"); + + if (requestOpenResult) + { + // Only send() if open() returns true, or crash + request.send(); + } + else + { + Serial.println("Can't send bad request"); + } + } + else + { + Serial.println("Can't send request"); + } +} + +void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState) +{ + (void) optParm; + + if (readyState == readyStateDone) + { + AHTTP_LOGDEBUG(F("\n**************************************")); + AHTTP_LOGDEBUG1(F("Response Code = "), request->responseHTTPString()); + + if (request->responseHTTPcode() == 200) + { + Serial.println(F("\n**************************************")); + Serial.println(request->responseText()); + Serial.println(F("**************************************")); + } + } +} + +void setup() +{ + // put your setup code here, to run once: + Serial.begin(115200); + + while (!Serial && millis() < 5000); + + delay(500); + + Serial.print("\nStart AsyncHTTPRequest_ESP32_W6100 on "); + Serial.print(ARDUINO_BOARD); + Serial.print(" with "); + Serial.println(SHIELD_TYPE); + Serial.println(WEBSERVER_ESP32_W6100_VERSION); + Serial.println(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION); + + Serial.setDebugOutput(true); + +#if defined(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN) + + if (ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_INT < ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN) + { + Serial.print("Warning. Must use this example on Version equal or later than : "); + Serial.println(ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET); + } + +#endif + + AHTTP_LOGWARN(F("Default SPI pinout:")); + AHTTP_LOGWARN1(F("SPI_HOST:"), ETH_SPI_HOST); + AHTTP_LOGWARN1(F("MOSI:"), MOSI_GPIO); + AHTTP_LOGWARN1(F("MISO:"), MISO_GPIO); + AHTTP_LOGWARN1(F("SCK:"), SCK_GPIO); + AHTTP_LOGWARN1(F("CS:"), CS_GPIO); + AHTTP_LOGWARN1(F("INT:"), INT_GPIO); + AHTTP_LOGWARN1(F("SPI Clock (MHz):"), SPI_CLOCK_MHZ); + AHTTP_LOGWARN(F("=========================")); + + /////////////////////////////////// + + // To be called before ETH.begin() + ESP32_W6100_onEvent(); + + // start the ethernet connection and the server: + // Use DHCP dynamic IP and random mac + //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); + + // Static IP, leave without this line to get IP via DHCP + //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); + //ETH.config(myIP, myGW, mySN, myDNS); + + ESP32_W6100_waitForConnect(); + + /////////////////////////////////// + + Serial.print(F("\nHTTP WebClient is @ IP : ")); + Serial.println(ETH.localIP()); + + request.setDebug(false); + + request.onReadyStateChange(requestCB); + ticker.attach(HTTP_REQUEST_INTERVAL, sendRequest); + + ticker1.attach(HEARTBEAT_INTERVAL, heartBeatPrint); + + // Send first request now + sendRequest(); +} + +void loop() +{ +} diff --git a/examples/WT32_ETH01/AsyncHTTPMultiRequests_WT32_ETH01/AsyncHTTPMultiRequests_WT32_ETH01.ino b/examples/WT32_ETH01/AsyncHTTPMultiRequests_WT32_ETH01/AsyncHTTPMultiRequests_WT32_ETH01.ino index 2becf47..723c5d3 100644 --- a/examples/WT32_ETH01/AsyncHTTPMultiRequests_WT32_ETH01/AsyncHTTPMultiRequests_WT32_ETH01.ino +++ b/examples/WT32_ETH01/AsyncHTTPMultiRequests_WT32_ETH01/AsyncHTTPMultiRequests_WT32_ETH01.ino @@ -57,8 +57,8 @@ #include // https://github.com/khoih-prog/WebServer_WT32_ETH01 -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.12.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1012000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/WT32_ETH01/AsyncHTTPRequest_WT32_ETH01/AsyncHTTPRequest_WT32_ETH01.ino b/examples/WT32_ETH01/AsyncHTTPRequest_WT32_ETH01/AsyncHTTPRequest_WT32_ETH01.ino index f5e99fa..706e3dd 100644 --- a/examples/WT32_ETH01/AsyncHTTPRequest_WT32_ETH01/AsyncHTTPRequest_WT32_ETH01.ino +++ b/examples/WT32_ETH01/AsyncHTTPRequest_WT32_ETH01/AsyncHTTPRequest_WT32_ETH01.ino @@ -57,8 +57,8 @@ #include // https://github.com/khoih-prog/WebServer_WT32_ETH01 -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.12.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1012000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 // Uncomment for certain HTTP site to optimize //#define NOT_SEND_HEADER_AFTER_CONNECTED true diff --git a/examples/multiFileProject/multiFileProject.ino b/examples/multiFileProject/multiFileProject.ino index 46c610e..eb9723a 100644 --- a/examples/multiFileProject/multiFileProject.ino +++ b/examples/multiFileProject/multiFileProject.ino @@ -16,8 +16,8 @@ #error This code is intended to run on the ESP32 using LwIP Ethernet W5500 or ENC28J60 ! Please check your Tools->Board setting. #endif -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.12.0" -#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1012000 +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN_TARGET "AsyncHTTPRequest_ESP32_Ethernet v1.14.0" +#define ASYNC_HTTP_REQUEST_ESP32_ETHERNET_VERSION_MIN 1014000 #include "multiFileProject.h" diff --git a/library.json b/library.json index c036173..453e15b 100644 --- a/library.json +++ b/library.json @@ -1,8 +1,8 @@ { "name":"AsyncHTTPRequest_ESP32_Ethernet", "version": "1.13.0", - "description":"Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP library for ESP32/S2/S3/C3, WT32_ETH01 (ESP32 + LAN8720), ESP32 using LwIP ENC28J60, W5500 or LAN8720", - "keywords":"communication, async, tcp, http, esp32, esp32-s2, esp32-s3, esp32-c3, wt32-eth01, ethernet, w5500, enc28j60, lan8720, lwip, lwip-ethernet, lwip-enc28j60, lwip-w5500, lwip-lan8720", + "description":"Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP library for ESP32/S2/S3/C3, WT32_ETH01 (ESP32 + LAN8720), ESP32 using LwIP ENC28J60, W5500, W6100 or LAN8720", + "keywords":"communication, async, tcp, http, esp32, esp32-s2, esp32-s3, esp32-c3, wt32-eth01, ethernet, w5500, w6100, enc28j60, lan8720, lwip, lwip-ethernet, lwip-enc28j60, lwip-w5500, lwip-lan8720", "authors": [ { "name": "Bob Lemaire", @@ -56,20 +56,32 @@ }, { "owner": "khoih-prog", - "name": "WebServer_ESP32_W5500", - "version": ">=1.5.1", + "name": "WebServer_ESP32_SC_ENC", + "version": ">=1.2.0", "platforms": ["espressif32"] }, { "owner": "khoih-prog", - "name": "WebServer_ESP32_SC_ENC", - "version": ">=1.2.0", + "name": "WebServer_ESP32_W5500", + "version": ">=1.5.2", "platforms": ["espressif32"] }, { "owner": "khoih-prog", "name": "WebServer_ESP32_SC_W5500", - "version": ">=1.2.0", + "version": ">=1.2.1", + "platforms": ["espressif32"] + }, + { + "owner": "khoih-prog", + "name": "WebServer_ESP32_W6100", + "version": ">=1.5.2", + "platforms": ["espressif32"] + }, + { + "owner": "khoih-prog", + "name": "WebServer_ESP32_SC_W6100", + "version": ">=1.2.1", "platforms": ["espressif32"] } ], diff --git a/library.properties b/library.properties index e0dea1a..5d3367f 100644 --- a/library.properties +++ b/library.properties @@ -1,12 +1,12 @@ name=AsyncHTTPRequest_ESP32_Ethernet -version=1.13.0 +version=1.14.0 author=Bob Lemaire,Khoi Hoang maintainer=Khoi Hoang license=GPLv3 -sentence=Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP library for ESP32/S2/S3/C3, WT32_ETH01 (ESP32 + LAN8720), ESP32 using LwIP ENC28J60, W5500 or LAN8720. -paragraph=This AsyncHTTPRequest_ESP32_Ethernet Library for ESP32/S2/S3/C3, WT32_ETH01 (ESP32 + LAN8720), ESP32 using LwIP ENC28J60, W5500 or LAN8720 +sentence=Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP library for ESP32/S2/S3/C3, WT32_ETH01 (ESP32 + LAN8720), ESP32 using LwIP ENC28J60, W5500, W6100 or LAN8720. +paragraph=This AsyncHTTPRequest_ESP32_Ethernet Library for ESP32/S2/S3/C3, WT32_ETH01 (ESP32 + LAN8720), ESP32 using LwIP ENC28J60, W5500, W6100 or LAN8720 category=Communication url=https://github.com/khoih-prog/AsyncHTTPRequest_ESP32_Ethernet architectures=esp32 -depends=WebServer_WT32_ETH01, WebServer_ESP32_ENC, WebServer_ESP32_W5500, WebServer_ESP32_SC_ENC, WebServer_ESP32_SC_W5500 +depends=WebServer_WT32_ETH01, WebServer_ESP32_ENC, WebServer_ESP32_SC_ENC, WebServer_ESP32_W5500, WebServer_ESP32_SC_W5500, WebServer_ESP32_W6100, WebServer_ESP32_SC_W6100 includes=AsyncHTTPRequest_ESP32_Ethernet.h, AsyncHTTPRequest_ESP32_Ethernet.hpp diff --git a/platformio/platformio.ini b/platformio/platformio.ini index b5ff4a7..ff0f475 100644 --- a/platformio/platformio.ini +++ b/platformio/platformio.ini @@ -42,18 +42,23 @@ lib_deps = ; AsyncTCP@>=1.1.1 ; ESPAsync_WiFiManager@>=1.15.1 ; WebServer_WT32_ETH01@>=1.5.1 -; WebServer_ESP32_W5500@>=1.5.1 ; WebServer_ESP32_ENC@>=1.5.1 -; WebServer_ESP32_SC_W5500@>=1.2.0 ; WebServer_ESP32_SC_ENC@>=1.2.0 +; WebServer_ESP32_W5500@>=1.5.2 +; WebServer_ESP32_SC_W5500@>=1.2.1 +; WebServer_ESP32_W6100@>=1.5.2 +; WebServer_ESP32_SC_W6100@>=1.2.1 + ; PlatformIO 5.x me-no-dev/AsyncTCP@>=1.1.1 khoih-prog/ESPAsync_WiFiManager@>=1.15.1 khoih-prog/WebServer_WT32_ETH01@>=1.5.1 - khoih-prog/WebServer_ESP32_W5500@>=1.5.1 khoih-prog/WebServer_ESP32_ENC@>=1.5.1 - khoih-prog/WebServer_ESP32_SC_W5500@>=1.2.0 khoih-prog/WebServer_ESP32_SC_ENC@>=1.2.0 + khoih-prog/WebServer_ESP32_W5500@>=1.5.2 + khoih-prog/WebServer_ESP32_SC_W5500@>=1.2.1 + khoih-prog/WebServer_ESP32_W6100@>=1.5.2 + khoih-prog/WebServer_ESP32_SC_W6100@>=1.2.1 ; ============================================================ build_flags =