Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Commit 701baa1

Browse files
authored
Major Releases v1.3.0
### Major Releases v1.3.0 1. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header. 2. Add support to **ESP32-S2 (ESP32-S2 Saola and AI-Thinker ESP-12K)**. Currently using EEPROM only. To add support to LittleFS and SPIFFS in future releases. 3. Fix Config Portal Bug. 4. Tested with [**Latest ESP32 Core 1.0.5**](https://github.com/espressif/arduino-esp32) for ESP32-based boards. 5. Update examples
1 parent 85b15eb commit 701baa1

File tree

43 files changed

+1221
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1221
-235
lines changed

examples/Async_AM2315_ESP32_SSL/Async_AM2315_ESP32_SSL.ino

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Based on and modified from Blynk library v0.6.1 (https://github.com/blynkkk/blynk-library/releases)
99
Built by Khoi Hoang (https://github.com/khoih-prog/Blynk_Async_WM)
1010
Licensed under MIT license
11-
Version: 1.2.3
11+
Version: 1.3.0
1212
1313
Version Modified By Date Comments
1414
------- ----------- ---------- -----------
@@ -19,6 +19,7 @@
1919
1.2.1 K Hoang 16/01/2021 Add functions to control Config Portal from software or Virtual Switches
2020
1.2.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs
2121
1.2.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP
22+
1.3.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2.
2223
********************************************************************************************************************************/
2324

2425
#include "defines.h"
@@ -113,6 +114,11 @@ void check_status()
113114
}
114115
}
115116

117+
#if USING_CUSTOMS_STYLE
118+
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
119+
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
120+
#endif
121+
116122
void setup()
117123
{
118124
pinMode(LED_BUILTIN, OUTPUT);
@@ -162,6 +168,22 @@ void setup()
162168
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
163169
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
164170

171+
//////////////////////////////////////////////
172+
173+
#if USING_CUSTOMS_STYLE
174+
Blynk.setCustomsStyle(NewCustomsStyle);
175+
#endif
176+
177+
#if USING_CUSTOMS_HEAD_ELEMENT
178+
Blynk.setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
179+
#endif
180+
181+
#if USING_CORS_FEATURE
182+
Blynk.setCORSHeader("Your Access-Control-Allow-Origin");
183+
#endif
184+
185+
//////////////////////////////////////////////
186+
165187
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
166188
//Blynk.begin();
167189
// Use this to personalize DHCP hostname (RFC952 conformed)
@@ -211,15 +233,9 @@ void displayCredentials()
211233
Serial.println(myMenuItems[i].pdata);
212234
}
213235
}
214-
#endif
215236

216-
void loop()
237+
void displayCredentialsInLoop()
217238
{
218-
Blynk.run();
219-
timer.run();
220-
check_status();
221-
222-
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
223239
static bool displayedCredentials = false;
224240

225241
if (!displayedCredentials)
@@ -238,5 +254,17 @@ void loop()
238254
}
239255
}
240256
}
257+
}
258+
259+
#endif
260+
261+
void loop()
262+
{
263+
Blynk.run();
264+
timer.run();
265+
check_status();
266+
267+
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
268+
displayCredentialsInLoop();
241269
#endif
242270
}

examples/Async_AM2315_ESP32_SSL/defines.h

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@
2929
// (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager
3030
// Those above #define's must be placed before #include <BlynkSimpleEsp32_Async_WM.h>
3131

32-
#define USE_LITTLEFS true
33-
#define USE_SPIFFS false
32+
#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 )
33+
// Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS
34+
#define USE_LITTLEFS false
35+
#define USE_SPIFFS false
36+
#warning ESP32-S2 only support supporting EEPROM now.
37+
#else
38+
#define USE_LITTLEFS true
39+
#define USE_SPIFFS false
40+
#endif
3441

3542
#if USE_LITTLEFS
3643
//LittleFS has higher priority
@@ -50,14 +57,6 @@
5057
#define EEPROM_START 0
5158
#endif
5259

53-
// Force some params in Blynk, only valid for library version 1.0.1 and later
54-
#define TIMEOUT_RECONNECT_WIFI 10000L
55-
#define RESET_IF_CONFIG_TIMEOUT true
56-
#define CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET 5
57-
58-
#define USE_DYNAMIC_PARAMETERS true
59-
// Those above #define's must be placed before #include <BlynkSimpleEsp8266_Async_WM.h>
60-
6160
//You have to download Blynk WiFiManager Blynk_Async_WM library at //https://github.com/khoih-prog/Blynk_Async_WM
6261
// In order to enable (USE_BLYNK_WM = true). Otherwise, use (USE_BLYNK_WM = false)
6362
#define USE_BLYNK_WM true
@@ -68,6 +67,29 @@
6867
//#define USE_SSL false
6968

7069
#if USE_BLYNK_WM
70+
71+
/////////////////////////////////////////////
72+
73+
// Add customs headers from v1.2.0
74+
#define USING_CUSTOMS_STYLE true
75+
#define USING_CUSTOMS_HEAD_ELEMENT true
76+
#define USING_CORS_FEATURE true
77+
78+
/////////////////////////////////////////////
79+
80+
// Force some params in Blynk, only valid for library version 1.0.1 and later
81+
#define TIMEOUT_RECONNECT_WIFI 10000L
82+
#define RESET_IF_CONFIG_TIMEOUT true
83+
84+
#define CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET 5
85+
86+
// Config Timeout 120s (default 60s)
87+
#define CONFIG_TIMEOUT 120000L
88+
89+
#define USE_DYNAMIC_PARAMETERS true
90+
//////////////////////////////////////////
91+
// Those above #define's must be placed before #include <BlynkSimpleEsp32_Async_WM.h>
92+
7193
#if USE_SSL
7294
#include <BlynkSimpleEsp32_SSL_Async_WM.h> //https://github.com/khoih-prog/Blynk_Async_WM
7395
#else

examples/Async_AM2315_ESP8266/Async_AM2315_ESP8266.ino

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Based on and modified from Blynk library v0.6.1 (https://github.com/blynkkk/blynk-library/releases)
99
Built by Khoi Hoang (https://github.com/khoih-prog/Blynk_Async_WM)
1010
Licensed under MIT license
11-
Version: 1.2.3
11+
Version: 1.3.0
1212
1313
Version Modified By Date Comments
1414
------- ----------- ---------- -----------
@@ -19,6 +19,7 @@
1919
1.2.1 K Hoang 16/01/2021 Add functions to control Config Portal from software or Virtual Switches
2020
1.2.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs
2121
1.2.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP
22+
1.3.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2.
2223
********************************************************************************************************************************/
2324

2425
#include "defines.h"
@@ -111,6 +112,11 @@ void check_status()
111112
}
112113
}
113114

115+
#if USING_CUSTOMS_STYLE
116+
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
117+
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
118+
#endif
119+
114120
void setup()
115121
{
116122
// Debug console
@@ -158,6 +164,22 @@ void setup()
158164
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
159165
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
160166

167+
//////////////////////////////////////////////
168+
169+
#if USING_CUSTOMS_STYLE
170+
Blynk.setCustomsStyle(NewCustomsStyle);
171+
#endif
172+
173+
#if USING_CUSTOMS_HEAD_ELEMENT
174+
Blynk.setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
175+
#endif
176+
177+
#if USING_CORS_FEATURE
178+
Blynk.setCORSHeader("Your Access-Control-Allow-Origin");
179+
#endif
180+
181+
//////////////////////////////////////////////
182+
161183
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
162184
//Blynk.begin();
163185
// Use this to personalize DHCP hostname (RFC952 conformed)
@@ -207,15 +229,9 @@ void displayCredentials()
207229
Serial.println(myMenuItems[i].pdata);
208230
}
209231
}
210-
#endif
211232

212-
void loop()
233+
void displayCredentialsInLoop()
213234
{
214-
Blynk.run();
215-
timer.run();
216-
check_status();
217-
218-
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
219235
static bool displayedCredentials = false;
220236

221237
if (!displayedCredentials)
@@ -234,5 +250,17 @@ void loop()
234250
}
235251
}
236252
}
253+
}
254+
255+
#endif
256+
257+
void loop()
258+
{
259+
Blynk.run();
260+
timer.run();
261+
check_status();
262+
263+
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
264+
displayCredentialsInLoop();
237265
#endif
238266
}

examples/Async_AM2315_ESP8266/defines.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,27 @@
6060

6161
#if USE_BLYNK_WM
6262

63+
/////////////////////////////////////////////
64+
65+
// Add customs headers from v1.2.0
66+
#define USING_CUSTOMS_STYLE true
67+
#define USING_CUSTOMS_HEAD_ELEMENT true
68+
#define USING_CORS_FEATURE true
69+
70+
/////////////////////////////////////////////
71+
72+
// Force some params in Blynk, only valid for library version 1.0.1 and later
73+
#define TIMEOUT_RECONNECT_WIFI 10000L
74+
#define RESET_IF_CONFIG_TIMEOUT true
75+
76+
#define CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET 5
77+
78+
// Config Timeout 120s (default 60s)
79+
#define CONFIG_TIMEOUT 120000L
80+
6381
#define USE_DYNAMIC_PARAMETERS true
82+
//////////////////////////////////////////
83+
// Those above #define's must be placed before #include <BlynkSimpleEsp8266_Async_WM.h>
6484

6585
#if USE_SSL
6686
#include <BlynkSimpleEsp8266_SSL_Async_WM.h> //https://github.com/khoih-prog/Blynk_Async_WM

examples/Async_Blynk_WM_Template/Async_Blynk_WM_Template.ino

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Based on and modified from Blynk library v0.6.1 (https://github.com/blynkkk/blynk-library/releases)
1111
Built by Khoi Hoang (https://github.com/khoih-prog/Blynk_Async_WM)
1212
Licensed under MIT license
13-
Version: 1.2.3
13+
Version: 1.3.0
1414
1515
Version Modified By Date Comments
1616
------- ----------- ---------- -----------
@@ -21,6 +21,7 @@
2121
1.2.1 K Hoang 16/01/2021 Add functions to control Config Portal from software or Virtual Switches
2222
1.2.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs
2323
1.2.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP
24+
1.3.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2.
2425
********************************************************************************************************************************/
2526

2627
// Sketch uses Arduino IDE-selected ESP32 and ESP8266 to select compile choices
@@ -163,8 +164,15 @@
163164
// (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager
164165
// Those above #define's must be placed before #include <BlynkSimpleEsp32_Async_WM.h>
165166

166-
#define USE_LITTLEFS true
167-
#define USE_SPIFFS false
167+
#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 )
168+
// Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS
169+
#define USE_LITTLEFS false
170+
#define USE_SPIFFS false
171+
#warning ESP32-S2 only support supporting EEPROM now.
172+
#else
173+
#define USE_LITTLEFS true
174+
#define USE_SPIFFS false
175+
#endif
168176

169177
#if USE_LITTLEFS
170178
#warning Using LittleFS for ESP32

examples/Async_DHT11ESP32/Async_DHT11ESP32.ino

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Based on and modified from Blynk library v0.6.1 (https://github.com/blynkkk/blynk-library/releases)
99
Built by Khoi Hoang (https://github.com/khoih-prog/Blynk_Async_WM)
1010
Licensed under MIT license
11-
Version: 1.2.3
11+
Version: 1.3.0
1212
1313
Version Modified By Date Comments
1414
------- ----------- ---------- -----------
@@ -19,6 +19,7 @@
1919
1.2.1 K Hoang 16/01/2021 Add functions to control Config Portal from software or Virtual Switches
2020
1.2.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs
2121
1.2.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP
22+
1.3.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2.
2223
********************************************************************************************************************************/
2324

2425
#include "defines.h"
@@ -94,6 +95,11 @@ void check_status()
9495
}
9596
}
9697

98+
#if USING_CUSTOMS_STYLE
99+
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
100+
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
101+
#endif
102+
97103
void setup()
98104
{
99105
pinMode(LED_BUILTIN, OUTPUT);
@@ -140,6 +146,22 @@ void setup()
140146
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
141147
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
142148

149+
//////////////////////////////////////////////
150+
151+
#if USING_CUSTOMS_STYLE
152+
Blynk.setCustomsStyle(NewCustomsStyle);
153+
#endif
154+
155+
#if USING_CUSTOMS_HEAD_ELEMENT
156+
Blynk.setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
157+
#endif
158+
159+
#if USING_CORS_FEATURE
160+
Blynk.setCORSHeader("Your Access-Control-Allow-Origin");
161+
#endif
162+
163+
//////////////////////////////////////////////
164+
143165
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
144166
//Blynk.begin();
145167
// Use this to personalize DHCP hostname (RFC952 conformed)
@@ -189,15 +211,9 @@ void displayCredentials()
189211
Serial.println(myMenuItems[i].pdata);
190212
}
191213
}
192-
#endif
193214

194-
void loop()
215+
void displayCredentialsInLoop()
195216
{
196-
Blynk.run();
197-
timer.run();
198-
check_status();
199-
200-
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
201217
static bool displayedCredentials = false;
202218

203219
if (!displayedCredentials)
@@ -216,5 +232,17 @@ void loop()
216232
}
217233
}
218234
}
219-
#endif
235+
}
236+
237+
#endif
238+
239+
void loop()
240+
{
241+
Blynk.run();
242+
timer.run();
243+
check_status();
244+
245+
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
246+
displayCredentialsInLoop();
247+
#endif
220248
}

0 commit comments

Comments
 (0)