Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
### Major Releases v1.2.0

1. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header.
2. Add functions to control Config Portal from software or Virtual Switches. Check [How to trigger a Config Portal from code #25](khoih-prog/Blynk_WM#25)
3. Use more efficient [FlashStorage_SAMD v1.1.0](https://github.com/khoih-prog/FlashStorage_SAMD) and [FlashStorage_STM32 v1.0.0](https://github.com/khoih-prog/FlashStorage_STM32)
4. Add support to **ESP32-S2 (ESP32-S2 Saola and AI-Thinker ESP-12K)**
5. Add [**Instructions to install ESP32-S2 core**](https://github.com/khoih-prog/Ethernet_Manager#howto-install-esp32-s2-core-for-esp32-s2-saola-ai-thinker-esp-12k-boards-into-arduino-ide)
6. Fix Config Portal Bug. 
7. Update examples
  • Loading branch information
khoih-prog authored Feb 23, 2021
1 parent d56235f commit c0571a2
Show file tree
Hide file tree
Showing 37 changed files with 588 additions and 90 deletions.
31 changes: 31 additions & 0 deletions examples/AM2315_Ethernet/AM2315_Ethernet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager
Licensed under MIT license
Version: 1.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 14/12/2020 Initial coding.
1.1.0 K Hoang 17/12/2020 Add support to ESP32/ESP8266. Add MQTT related examples to demo dynamic parameter usage
1.1.1 K Hoang 28/12/2020 Suppress all possible compiler warnings
1.2.0 K Hoang 22/02/2021 Optimize code and use better FlashStorage_SAMD and FlashStorage_STM32.
Add customs HTML header feature. Fix bug.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -119,6 +129,11 @@ void check_status()
}
}

#if USING_CUSTOMS_STYLE
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
#endif

void setup()
{
Serial.begin(115200);
Expand Down Expand Up @@ -338,9 +353,25 @@ void setup()
Serial.println(SPI_CS);
#endif
Serial.println(F("========================="));

//////////////////////////////////////////////

#if USING_CUSTOMS_STYLE
ethernet_manager.setCustomsStyle(NewCustomsStyle);
#endif

#if USING_CUSTOMS_HEAD_ELEMENT
ethernet_manager.setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
#endif

#if USING_CORS_FEATURE
ethernet_manager.setCORSHeader("Your Access-Control-Allow-Origin");
#endif

ethernet_manager.begin();

//////////////////////////////////////////////

localEthernetIP = Ethernet.localIP();

#if (USE_ETHERNET2 || USE_ETHERNET3)
Expand Down
2 changes: 1 addition & 1 deletion examples/AM2315_Ethernet/Credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef struct Configuration
} Ethernet_Configuration;
*/

#define TO_LOAD_DEFAULT_CONFIG_DATA true
#define TO_LOAD_DEFAULT_CONFIG_DATA false

#if TO_LOAD_DEFAULT_CONFIG_DATA

Expand Down
67 changes: 14 additions & 53 deletions examples/AM2315_Ethernet/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,59 +361,6 @@
// Otherwise, standard Ethernet library will be used for W5x00

#endif // USE_ETHERNET_WRAPPER
#if !USE_ETHERNET_WRAPPER

#if ( USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE || USE_ETHERNET_ESP8266 || USE_ETHERNET_ENC || USE_NATIVE_ETHERNET )
#ifdef USE_CUSTOM_ETHERNET
#undef USE_CUSTOM_ETHERNET
#endif
#define USE_CUSTOM_ETHERNET false
#endif

#if USE_NATIVE_ETHERNET
#include "NativeEthernet.h"
#warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
#define SHIELD_TYPE "Custom Ethernet using Teensy 4.1 NativeEthernet Library"
#elif USE_ETHERNET3
#include "Ethernet3.h"
#warning Using Ethernet3 lib
#define SHIELD_TYPE "W5x00 using Ethernet3 Library"
#elif USE_ETHERNET2
#include "Ethernet2.h"
#warning Using Ethernet2 lib
#define SHIELD_TYPE "W5x00 using Ethernet2 Library"
#elif USE_ETHERNET_LARGE
#include "EthernetLarge.h"
#warning Using EthernetLarge lib
#define SHIELD_TYPE "W5x00 using EthernetLarge Library"
#elif USE_ETHERNET_ESP8266
#include "Ethernet_ESP8266.h"
#warning Using Ethernet_ESP8266 lib
#define SHIELD_TYPE "W5x00 using Ethernet_ESP8266 Library"
#elif USE_ETHERNET_ENC
#include "EthernetENC.h"
#warning Using EthernetENC lib
#define SHIELD_TYPE "ENC28J60 using EthernetENC Library"
#elif USE_CUSTOM_ETHERNET
//#include "Ethernet_XYZ.h"
#include "EthernetENC.h"
#warning Using Custom Ethernet library. You must include a library and initialize.
#define SHIELD_TYPE "Custom Ethernet using Ethernet_XYZ Library"
#else
#ifdef USE_ETHERNET
#undef USE_ETHERNET
#endif
#define USE_ETHERNET true
#include "Ethernet.h"
#warning Using Ethernet lib
#define SHIELD_TYPE "W5x00 using Ethernet Library"
#endif

// Ethernet_Shield_W5200, EtherCard, EtherSia not supported
// Select just 1 of the following #include if uncomment #define USE_CUSTOM_ETHERNET
// Otherwise, standard Ethernet library will be used for W5x00

#endif // USE_ETHERNET_WRAPPER

#elif USE_UIP_ETHERNET
#include "UIPEthernet.h"
Expand Down Expand Up @@ -496,6 +443,20 @@
#define EEPROM_START 0
#endif

/////////////////////////////////////////////

// Add customs headers from v1.2.0
#define USING_CUSTOMS_STYLE true
#define USING_CUSTOMS_HEAD_ELEMENT true
#define USING_CORS_FEATURE true

/////////////////////////////////////////////

// Config Timeout 120s (default 60s)
#define CONFIG_TIMEOUT 120000L

#define USE_DYNAMIC_PARAMETERS true

//////////////////////////////////////////

#include <Ethernet_Manager.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/AM2315_Ethernet/dynamicParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "defines.h"

#define USE_DYNAMIC_PARAMETERS true
// USE_DYNAMIC_PARAMETERS defined in defined.h

/////////////// Start dynamic Credentials ///////////////

Expand Down
31 changes: 31 additions & 0 deletions examples/DHT11_Ethernet/DHT11_Ethernet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager
Licensed under MIT license
Version: 1.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 14/12/2020 Initial coding.
1.1.0 K Hoang 17/12/2020 Add support to ESP32/ESP8266. Add MQTT related examples to demo dynamic parameter usage
1.1.1 K Hoang 28/12/2020 Suppress all possible compiler warnings
1.2.0 K Hoang 22/02/2021 Optimize code and use better FlashStorage_SAMD and FlashStorage_STM32.
Add customs HTML header feature. Fix bug.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -117,6 +127,11 @@ void check_status()
}
}

#if USING_CUSTOMS_STYLE
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
#endif

void setup()
{
// Debug console
Expand Down Expand Up @@ -333,8 +348,24 @@ void setup()
#endif
Serial.println(F("========================="));

//////////////////////////////////////////////

#if USING_CUSTOMS_STYLE
ethernet_manager.setCustomsStyle(NewCustomsStyle);
#endif

#if USING_CUSTOMS_HEAD_ELEMENT
ethernet_manager.setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
#endif

#if USING_CORS_FEATURE
ethernet_manager.setCORSHeader("Your Access-Control-Allow-Origin");
#endif

ethernet_manager.begin();

//////////////////////////////////////////////

localEthernetIP = Ethernet.localIP();

#if (USE_ETHERNET2 || USE_ETHERNET3)
Expand Down
15 changes: 15 additions & 0 deletions examples/DHT11_Ethernet/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,23 @@
#define EEPROM_START 0
#endif

/////////////////////////////////////////////

// Add customs headers from v1.2.0
#define USING_CUSTOMS_STYLE true
#define USING_CUSTOMS_HEAD_ELEMENT true
#define USING_CORS_FEATURE true

/////////////////////////////////////////////

// Config Timeout 120s (default 60s)
#define CONFIG_TIMEOUT 120000L

#define USE_DYNAMIC_PARAMETERS true

//////////////////////////////////////////


#include <Ethernet_Manager.h>

#define W5100_CS 10
Expand Down
2 changes: 1 addition & 1 deletion examples/DHT11_Ethernet/dynamicParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "defines.h"

#define USE_DYNAMIC_PARAMETERS true
// USE_DYNAMIC_PARAMETERS defined in defined.h

/////////////// Start dynamic Credentials ///////////////

Expand Down
31 changes: 31 additions & 0 deletions examples/Ethernet_Generic/Ethernet_Generic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager
Licensed under MIT license
Version: 1.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 14/12/2020 Initial coding.
1.1.0 K Hoang 17/12/2020 Add support to ESP32/ESP8266. Add MQTT related examples to demo dynamic parameter usage
1.1.1 K Hoang 28/12/2020 Suppress all possible compiler warnings
1.2.0 K Hoang 22/02/2021 Optimize code and use better FlashStorage_SAMD and FlashStorage_STM32.
Add customs HTML header feature. Fix bug.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -75,6 +85,11 @@ void check_status()
}
}

#if USING_CUSTOMS_STYLE
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
#endif

void setup()
{
// Debug console
Expand Down Expand Up @@ -292,8 +307,24 @@ void setup()
#endif
Serial.println(F("========================="));

//////////////////////////////////////////////

#if USING_CUSTOMS_STYLE
ethernet_manager.setCustomsStyle(NewCustomsStyle);
#endif

#if USING_CUSTOMS_HEAD_ELEMENT
ethernet_manager.setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
#endif

#if USING_CORS_FEATURE
ethernet_manager.setCORSHeader("Your Access-Control-Allow-Origin");
#endif

ethernet_manager.begin();

//////////////////////////////////////////////

localEthernetIP = Ethernet.localIP();

#if (USE_ETHERNET2 || USE_ETHERNET3)
Expand Down
15 changes: 15 additions & 0 deletions examples/Ethernet_Generic/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,23 @@
#define EEPROM_START 0
#endif

/////////////////////////////////////////////

// Add customs headers from v1.2.0
#define USING_CUSTOMS_STYLE true
#define USING_CUSTOMS_HEAD_ELEMENT true
#define USING_CORS_FEATURE true

/////////////////////////////////////////////

// Config Timeout 120s (default 60s)
#define CONFIG_TIMEOUT 120000L

#define USE_DYNAMIC_PARAMETERS true

//////////////////////////////////////////


#include <Ethernet_Manager.h>

#define W5100_CS 10
Expand Down
2 changes: 1 addition & 1 deletion examples/Ethernet_Generic/dynamicParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "defines.h"

#define USE_DYNAMIC_PARAMETERS true
// USE_DYNAMIC_PARAMETERS defined in defined.h

/////////////// Start dynamic Credentials ///////////////

Expand Down
31 changes: 31 additions & 0 deletions examples/Ethernet_SAMD/Ethernet_SAMD.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager
Licensed under MIT license
Version: 1.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 14/12/2020 Initial coding.
1.1.0 K Hoang 17/12/2020 Add support to ESP32/ESP8266. Add MQTT related examples to demo dynamic parameter usage
1.1.1 K Hoang 28/12/2020 Suppress all possible compiler warnings
1.2.0 K Hoang 22/02/2021 Optimize code and use better FlashStorage_SAMD and FlashStorage_STM32.
Add customs HTML header feature. Fix bug.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -75,6 +85,11 @@ void check_status()
}
}

#if USING_CUSTOMS_STYLE
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
#endif

void setup()
{
// Debug console
Expand Down Expand Up @@ -173,8 +188,24 @@ void setup()
#endif
ET_LOGWARN(F("========================="));

//////////////////////////////////////////////

#if USING_CUSTOMS_STYLE
ethernet_manager.setCustomsStyle(NewCustomsStyle);
#endif

#if USING_CUSTOMS_HEAD_ELEMENT
ethernet_manager.setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
#endif

#if USING_CORS_FEATURE
ethernet_manager.setCORSHeader("Your Access-Control-Allow-Origin");
#endif

ethernet_manager.begin();

//////////////////////////////////////////////

localEthernetIP = Ethernet.localIP();

#if (USE_ETHERNET2 || USE_ETHERNET3)
Expand Down
Loading

0 comments on commit c0571a2

Please sign in to comment.