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

Commit

Permalink
Major Releases v1.2.0
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_STM32 v1.0.1**](https://github.com/khoih-prog/FlashStorage_STM32)
4. Fix Config Portal Bug. 
5. Update examples
6. Bump up to version v1.2.0 to sync with [**Ethernet_Manager**](https://github.com/khoih-prog/Ethernet_Manager)
  • Loading branch information
khoih-prog authored Feb 23, 2021
1 parent ea96a10 commit 4d6eb66
Show file tree
Hide file tree
Showing 16 changed files with 174 additions and 102 deletions.
28 changes: 25 additions & 3 deletions examples/AM2315_Ethernet_STM32/AM2315_Ethernet_STM32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version: 1.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
1.2.0 K Hoang 23/02/2021 Optimize code and use better FlashStorage_STM32. Add customs HTML header feature. Fix bug.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -124,6 +125,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 @@ -225,8 +231,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 Expand Up @@ -257,7 +279,7 @@ void displayCredentials()
{
Serial.println(F("\nYour stored Credentials :"));

for (int i = 0; i < NUM_MENU_ITEMS; i++)
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
Serial.print(myMenuItems[i].displayName);
Serial.print(" = ");
Expand All @@ -271,7 +293,7 @@ void displayCredentialsOnce()

if (!displayedCredentials)
{
for (int i = 0; i < NUM_MENU_ITEMS; i++)
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
if (!strlen(myMenuItems[i].pdata))
{
Expand Down
8 changes: 1 addition & 7 deletions examples/AM2315_Ethernet_STM32/Credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
*****************************************************************************************************************************/

#ifndef Credentials_h
Expand All @@ -36,7 +30,7 @@ typedef struct Configuration

#if TO_LOAD_DEFAULT_CONFIG_DATA

bool LOAD_DEFAULT_CONFIG_DATA = true;
bool LOAD_DEFAULT_CONFIG_DATA = false;

Ethernet_Configuration defaultConfig =
{
Expand Down
20 changes: 14 additions & 6 deletions examples/AM2315_Ethernet_STM32/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down Expand Up @@ -113,6 +107,20 @@

#define EEPROM_START 0

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

// 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_STM32.h>
Expand Down
10 changes: 2 additions & 8 deletions examples/AM2315_Ethernet_STM32/dynamicParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,18 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
*****************************************************************************************************************************/

#ifndef dynamicParams_h
#define dynamicParams_h

#include "defines.h"

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

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

//Defined in BlynkEthernet_WM.h, <BlynkEthernet_ESP8266_WM.h>, <BlynkEthernet_ESP32 or_WM.h>
//Defined in <Ethernet_Manager_STM32_Impl.h>
/**************************************
#define MAX_ID_LEN 5
#define MAX_DISPLAY_NAME_LEN 16
Expand Down
8 changes: 1 addition & 7 deletions examples/DHT11_Ethernet_STM32/Credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
*****************************************************************************************************************************/

#ifndef Credentials_h
Expand All @@ -36,7 +30,7 @@ typedef struct Configuration

#if TO_LOAD_DEFAULT_CONFIG_DATA

bool LOAD_DEFAULT_CONFIG_DATA = true;
bool LOAD_DEFAULT_CONFIG_DATA = false;

Ethernet_Configuration defaultConfig =
{
Expand Down
28 changes: 25 additions & 3 deletions examples/DHT11_Ethernet_STM32/DHT11_Ethernet_STM32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version: 1.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
1.2.0 K Hoang 23/02/2021 Optimize code and use better FlashStorage_STM32. Add customs HTML header feature. Fix bug.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -122,6 +123,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 @@ -223,8 +229,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 Expand Up @@ -255,7 +277,7 @@ void displayCredentials()
{
Serial.println(F("\nYour stored Credentials :"));

for (int i = 0; i < NUM_MENU_ITEMS; i++)
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
Serial.print(myMenuItems[i].displayName);
Serial.print(" = ");
Expand All @@ -269,7 +291,7 @@ void displayCredentialsOnce()

if (!displayedCredentials)
{
for (int i = 0; i < NUM_MENU_ITEMS; i++)
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
if (!strlen(myMenuItems[i].pdata))
{
Expand Down
20 changes: 14 additions & 6 deletions examples/DHT11_Ethernet_STM32/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down Expand Up @@ -113,6 +107,20 @@

#define EEPROM_START 0

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

// 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_STM32.h>
Expand Down
10 changes: 2 additions & 8 deletions examples/DHT11_Ethernet_STM32/dynamicParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,18 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
*****************************************************************************************************************************/

#ifndef dynamicParams_h
#define dynamicParams_h

#include "defines.h"

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

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

//Defined in BlynkEthernet_WM.h, <BlynkEthernet_ESP8266_WM.h>, <BlynkEthernet_ESP32 or_WM.h>
//Defined in <Ethernet_Manager_STM32_Impl.h>
/**************************************
#define MAX_ID_LEN 5
#define MAX_DISPLAY_NAME_LEN 16
Expand Down
8 changes: 1 addition & 7 deletions examples/Ethernet_STM32/Credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
*****************************************************************************************************************************/

#ifndef Credentials_h
Expand All @@ -36,7 +30,7 @@ typedef struct Configuration

#if TO_LOAD_DEFAULT_CONFIG_DATA

bool LOAD_DEFAULT_CONFIG_DATA = true;
bool LOAD_DEFAULT_CONFIG_DATA = false;

Ethernet_Configuration defaultConfig =
{
Expand Down
28 changes: 25 additions & 3 deletions examples/Ethernet_STM32/Ethernet_STM32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Manager_STM32
Licensed under MIT license
Version: 1.0.1
Version: 1.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 16/12/2020 Initial coding.
1.0.1 K Hoang 29/12/2020 Suppress all possible compiler warnings
1.2.0 K Hoang 23/02/2021 Optimize code and use better FlashStorage_STM32. Add customs HTML header feature. Fix bug.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -80,6 +81,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 @@ -181,8 +187,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 Expand Up @@ -213,7 +235,7 @@ void displayCredentials()
{
Serial.println(F("\nYour stored Credentials :"));

for (int i = 0; i < NUM_MENU_ITEMS; i++)
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
Serial.print(myMenuItems[i].displayName);
Serial.print(" = ");
Expand All @@ -227,7 +249,7 @@ void displayCredentialsOnce()

if (!displayedCredentials)
{
for (int i = 0; i < NUM_MENU_ITEMS; i++)
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
if (!strlen(myMenuItems[i].pdata))
{
Expand Down
Loading

0 comments on commit 4d6eb66

Please sign in to comment.