Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit 591e22a

Browse files
authored
v1.0.8
### Releases v1.0.8 1. Fix [AP-staying-open bug](#2). 2. Add clearConfigData() to clear and force ConfigPortal mode when necessary.
1 parent e297598 commit 591e22a

8 files changed

+68
-168
lines changed

README.md

+16-144
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,15 @@
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/Blynk_WiFiManager.svg?)](https://www.ardu-badge.com/Blynk_WiFiManager)
44

5-
I'm inspired by [`EasyBlynk8266`](https://github.com/Barbayar/EasyBlynk8266)
5+
I'm inspired by [`EasyBlynk8266`] (https://github.com/Barbayar/EasyBlynk8266)
66

77
To help you to eliminate `hardcoding` your Wifi and Blynk credentials for ESP8266 and ESP32 (with / wwithout SSL), and updating/reflashing every time when you need to change them.
88

9-
With version `v1.0.7` or later, you now can configure:
10-
11-
1. `Multiple WiFi Credentials (SSID, Password) and system will autoconnect to the best and available WiFi SSID.`
12-
2. `Multiple Blynk Credentials (Server, Token) and system will autoconnect to the available Blynk Servers.`
13-
14-
With version `v1.0.5` or later, you now can configure:
15-
16-
1. `Config Portal Static IP address, Name and Password.`
17-
2. `Static IP address, Gateway, Subnet Mask and 2 DNS Servers IP addresses.`
18-
199
### Installation
2010

2111
The suggested way to install is to:
2212

23-
1. Navigate to [Blynk_WM](https://github.com/khoih-prog/Blynk_WM) page.
13+
1. Navigate to [Blynk_WM] (https://github.com/khoih-prog/Blynk_WM) page.
2414
2. Download the latest release `Blynk_WM-master.zip`.
2515
3. Extract the zip file to `Blynk_WM-master` directory
2616
4. Copy whole `Blynk_WM-master/src` folder to Arduino libraries' `src` directory such as `~/Arduino/libraries/Blynk/src`.
@@ -46,8 +36,8 @@ to use SPIFFS or
4636
```
4737
#define USE_SPIFFS false
4838
```
49-
to use EEPROM ( 176 bytes from address EEPROM_START ) to save your configuration data.
50-
EEPROM_SIZE can be specified from 256 to 4096 bytes. See examples [ESP32WM_Config](https://github.com/khoih-prog/Blynk_WM/tree/master/examples/ESP32WM_Config) and [ESP8266WM_Config](https://github.com/khoih-prog/Blynk_WM/tree/master/examples/ESP8266WM_Config).
39+
to use EEPROM ( 172 bytes from address EEPROM_START ) to save your configuration data.
40+
EEPROM_SIZE can be specified from 256 to 4096 bytes. See examples [ESP32WM_Config] (https://github.com/khoih-prog/Blynk_WM/tree/master/examples/ESP32WM_Config) and [ESP8266WM_Config] (https://github.com/khoih-prog/Blynk_WM/tree/master/examples/ESP8266WM_Config).
5141

5242

5343
```
@@ -86,86 +76,18 @@ Also see examples:
8676
If it cannot connect to the Blynk server in 30 seconds, it will switch to `Configuration Mode`. You will see your built-in LED turned ON. In `Configuration Mode`, it starts an access point called `ESP_xxxxxx`. Connect to it using password `MyESP_xxxxxx` .
8777

8878
<p align="center">
89-
<img src="https://github.com/khoih-prog/Blynk_WM/blob/master/pics/PortalAuth.jpg">
79+
<img src="https://github.com/khoih-prog/Blynk_WM/blob/master/pics/Selection_004.jpg">
9080
</p>
9181

9282
After you connected, please, go to http://192.168.4.1.
9383

9484
<p align="center">
95-
<img src="https://github.com/khoih-prog/Blynk_WM/blob/master/pics/ConfigPortal.png">
85+
<img src="https://github.com/khoih-prog/Blynk_WM/blob/master/pics/Selection_005.jpg">
9686
</p>
9787

9888
Enter your credentials, then click `Save`. After you restarted, you will see your built-in LED turned OFF. That means, it connected to your Blynk server successfully.
9989

100-
The following is the sample terminal output when running example [ESP8266WM_Config](examples/ESP8266WM_Config)
101-
102-
```
103-
Starting ...
104-
[65] RFC925 Hostname = ESP8266-WM-Config
105-
[66] Calc Cksum = 0x309d, Read Cksum = 0x309d
106-
[66] Header = ESP8266, Board Name = ESP8266-Multi-WM
107-
[67] SSID = ****, PW = ****
108-
[70] SSID1 = ****1, PW1 = ****1
109-
[74] Server = 192.168.2.112, Token = ****
110-
[80] Server1 = account.duckdns.org, Token1 = ****
111-
[86] Port = 8080
112-
[88] Connecting MultiWifi...
113-
[11276] WiFi connected after time: 2
114-
[11276] SSID: ****, RSSI = -45 <= Connected to SSID
115-
[11276] Channel: 2, IP address: 192.168.2.91
116-
[11277] bg: WiFi connected. Try Blynk
117-
[11279]
118-
___ __ __
119-
/ _ )/ /_ _____ / /__
120-
/ _ / / // / _ \/ '_/
121-
/____/_/\_, /_//_/_/\_\
122-
/___/ v0.6.1 on NodeMCU
123-
124-
[11292] BlynkArduinoClient.connect: Connecting to 192.168.2.112:8080 <= Try Server
125-
[11325] Ready (ping: 19ms). <= Connected to Server
126-
[11392] Connected to Blynk Server = 192.168.2.112, Token = ****
127-
[11392] bg: WiFi+Blynk connected
128-
Blynk ESP8288 using EEPROM connected. Board Name : ESP8266-Multi-WM
129-
EEPROM size = 4096 bytes, EEPROM start address = 512 / 0x200
130-
BRB
131-
[101232] run: WiFi lost. Reconnect WiFi+Blynk <= Lost SSID
132-
[101232] Connecting MultiWifi...
133-
[106316] WiFi connected after time: 1
134-
[106317] SSID: ****1, RSSI = -62 <= Connected to SSID1
135-
[106317] Channel: 4, IP address: 192.168.2.91
136-
[106317] run: WiFi reconnected. Connect to Blynk
137-
[106320] BlynkArduinoClient.connect: Connecting to 192.168.2.112:8080 <= Try Server
138-
[106352] Ready (ping: 11ms). <= Connected to Server
139-
[106419] run: WiFi+Blynk reconnected
140-
RB
141-
[165434] Heartbeat timeout <= Lost Server
142-
[165735] run: Blynk lost. Connect Blynk
143-
[165735]
144-
___ __ __
145-
/ _ )/ /_ _____ / /__
146-
/ _ / / // / _ \/ '_/
147-
/____/_/\_, /_//_/_/\_\
148-
/___/ v0.6.1 on NodeMCU
149-
150-
[165741] BlynkArduinoClient.connect: Connecting to 192.168.2.112:8080 <= Try Server not OK
151-
[170741]
152-
___ __ __
153-
/ _ )/ /_ _____ / /__
154-
/ _ / / // / _ \/ '_/
155-
/____/_/\_, /_//_/_/\_\
156-
/___/ v0.6.1 on NodeMCU
157-
158-
[170743] BlynkArduinoClient.connect: Connecting to account.duckdns.org:8080 <= Try Server1
159-
[170781] Ready (ping: 9ms).
160-
[170848] Connected to Blynk Server = account.duckdns.org, Token = **** <= Connected to Server1
161-
[170848] run: Blynk reconnected
162-
RBRBRBRBRBRBRB RBRB
163-
164-
```
165-
166-
You can see that the system automatically detect and connect to the best or avaiable WiFi APs and/or Blynk Servers, whenever interruption happens. This feature is very useful for systems requiring high degree of reliability.
167-
168-
Moreover, this `Blynk.begin()` is not a blocking call, so you can use it for critical functions requiring in loop().
90+
This `Blynk.begin()` is not a blocking call, so you can use it for critical functions requiring in loop().
16991
Anyway, this is better for projects using Blynk just for GUI (graphical user interface).
17092

17193
In operation, if WiFi or Blynk connection is lost, `Blynk.run()` will try reconnecting automatically. Therefore, `Blynk.run()` must be called in the `loop()` function. Don't use:
@@ -190,27 +112,21 @@ void loop()
190112
```
191113

192114
## Prerequisite
193-
* [`ESP8266 core 2.6.3 or later` for Arduino](https://github.com/esp8266/Arduino#installing-with-boards-manager)
194-
* [`Blynk library 0.6.1 or later`](https://www.arduino.cc/en/guide/libraries#toc3)
115+
* `ESP8266 core 2.5.2 or later` for Arduino (https://github.com/esp8266/Arduino#installing-with-boards-manager)
116+
* `Blynk library 0.6.1 or later` (https://www.arduino.cc/en/guide/libraries#toc3)
195117

196118
## TO DO
197119

198120
1. Same features for other boards with WiFi.
199121

200122
## DONE
201123

202-
1. Permit EEPROM size and location configurable to avoid conflict with others.
203-
2. More flexible to configure reconnection timeout.
204-
3. For fresh config data, don't need to wait for connecting timeout before entering config portal.
205-
4. If the config data not entered completely (SSID, password, Server and Blynk token), entering config portal
206-
5. Correct the operation of BUILTIN_LED
207-
6. Modify code to be compatible with ESP8266 core pre-2.5.2.
208-
7. Add RFC952 hostname
209-
8. Add configurable Config Portal IP, SSID and Password
210-
9. Add configurable Static IP, GW, Subnet Mask and 2 DNS Servers' IP Addresses.
211-
10. Add checksum for more reliable data
212-
11. Add MultiWiFi feature to enable reconnect to the best / available WiFi AP.
213-
12. Add MultiBlynk feature to enable reconnect to the best / available Blynk Server.
124+
1. Permit EEPROM size and location configurable to avoid conflict with others.
125+
2. More flexible to configure reconnection timeout.
126+
3. For fresh config data, don't need to wait for connecting timeout before entering config portal.
127+
4. If the config data not entered completely (SSID, password, Server and Blynk token), entering config portal
128+
5. Correct the operation of BUILTIN_LED
129+
6. Modify code to be compatible with ESP8266 core pre-2.5.2.
214130

215131
## Example
216132
Please take a look at examples, as well.
@@ -238,7 +154,7 @@ Please take a look at examples, as well.
238154
#define CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET 5
239155
// Those above #define's must be placed before #include <BlynkSimpleEsp8266_WM.h>
240156
241-
#define USE_SSL false
157+
#define USE_SSL true
242158
243159
#if USE_SSL
244160
#include <BlynkSimpleEsp8266_SSL_WM.h>
@@ -248,21 +164,6 @@ Please take a look at examples, as well.
248164
249165
void setup()
250166
{
251-
....
252-
253-
// From v1.0.5
254-
// Set config portal SSID and Password
255-
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
256-
// Set config portal IP address
257-
Blynk.setConfigPortalIP(IPAddress(192, 168, 220, 1));
258-
259-
// From v1.0.5, select either one of these to set static IP + DNS
260-
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 230), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
261-
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
262-
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
263-
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
264-
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
265-
266167
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
267168
//Blynk.begin();
268169
// Use this to personalize DHCP hostname (RFC952 conformed)
@@ -275,35 +176,6 @@ void loop()
275176
Blynk.run();
276177
}
277178
```
278-
279-
### Releases v1.0.7
280-
281-
***Why this version***
282-
283-
1. Add checksum for more reliable data
284-
2. Add MultiWiFi feature to enable reconnect to the best / available WiFi AP.
285-
3. Add MultiBlynk feature to enable reconnect to the best / available Blynk Server.
286-
287-
### Releases v1.0.6
288-
289-
***Why this version***
290-
291-
Optimize, fix ESP32 EEPROM size to 2K from 4K, shorten code size, add functions, use dynamically allocated Config Portal WebServer.
292-
293-
### Releases v1.0.5
294-
295-
***Why this version***
296-
297-
Normally, the `default Portal IP (192.168.4.1)`, SSID and PW as well as the `dynamically allocated` board's IP address are good enough.
298-
In special cases where there is conflict, if static IP is required or bad router's DNS settings, you can use the new features to force the configurable IP addresses. ***But please use with care to avoid potential issues.***
299-
300-
***New in this version***
301-
302-
Add new features to enable :
303-
304-
1. configuring Portal Static IP address, Name and Password.
305-
2. configuring Static IP address, Gateway, Subnet Mask and 2 DNS Servers IP addresses.
306-
307179
### Releases v1.0.4
308180

309181
***Why this version***

keywords.txt

+3-15
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ WidgetMap KEYWORD1
1313
WidgetTable KEYWORD1
1414
BlynkParam KEYWORD1
1515
BlynkParamAllocated KEYWORD1
16-
WiFi_Credentials KEYWORD1
17-
Blynk_Credentials KEYWORD1
18-
Blynk_WF_Configuration KEYWORD1
1916

2017
#######################################
2118
# Methods and Functions (KEYWORD2)
@@ -37,21 +34,12 @@ logEvent KEYWORD2
3734
loadConfigData KEYWORD2
3835
saveConfigData KEYWORD2
3936
getConfigData KEYWORD2
40-
connectMultiWiFi KEYWORD2
41-
connectMultiBlynk KEYWORD2
37+
connectToWifi KEYWORD2
4238
handleRequest KEYWORD2
4339
startConfigurationMode KEYWORD2
44-
setHostname KEYWORD2
45-
setConfigPortalIP KEYWORD2
46-
setConfigPortal KEYWORD2
47-
setSTAStaticIPConfig KEYWORD2
48-
getServerName KEYWORD2
49-
getToken KEYWORD2
50-
getBlynkBTToken KEYWORD2
51-
getBlynkBLEToken KEYWORD2
5240
getBoardName KEYWORD2
53-
getHWPort KEYWORD2
54-
getFullConfigData KEYWORD2
41+
setHostname KEYWORD2
42+
5543

5644
# Handler helpers
5745
BLYNK_READ KEYWORD2

library.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Blynk_WM",
3-
"version": "1.0.7",
3+
"version": "1.0.4",
44
"description": "Build a smartphone app for your project in minutes. Blynk allows creating IoT solutions easily. It supports WiFi, BLE, Bluetooth, Ethernet, GSM, USB, Serial. Works with many boards like ESP8266, ESP32, Arduino UNO, Nano, Due, Mega, Zero, MKR100, Yun, Raspberry Pi, Particle, Energia, ARM mbed, Intel Edison/Galileo/Joule, BBC micro:bit, DFRobot, RedBearLab, Microduino, LinkIt ONE ...",
55
"keywords": "sensors, control, device, smartphone, mobile, app, web, cloud, communication, protocol, iot, m2m, wifi, ble, bluetooth, ethernet, usb, serial, gsm, gprs, 3g, data, esp8266, http",
66
"authors":

library.properties

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
name=Blynk_WiFiManager
2-
version=1.0.7
2+
version=1.0.4
33
author=Khoi Hoang
44
license=MIT
55
maintainer=Khoi Hoang <[email protected]>
66
sentence=Simple WiFiManager for Blynk and ESP8266/ESP32 with or without SSL, configuration data saved in either SPIFFS or EEPROM
7-
paragraph=Library for configuring/auto(re)connecting ESP8266/ESP32 modules to MultiWiFi and MultiBlynk at runtime.
7+
paragraph=Library for configuring/auto(re)connecting ESP8266/ESP32 modules to WiFi and Blynk at runtime.
88
category=Communication
99
url=https://github.com/khoih-prog/Blynk_WM
1010
architectures=esp8266,esp32
11-
depends=Blynk

src/BlynkSimpleEsp32_SSL_WM.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
88
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
99
* Licensed under MIT license
10-
* Version: 1.0.7
10+
* Version: 1.0.8
1111
*
1212
* Original Blynk Library author:
1313
* @file BlynkSimpleEsp8266.h
@@ -27,6 +27,7 @@
2727
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2828
* 1.0.6 K Hoang 05/02/2020 Optimize, fix EEPROM size to 2K from 4K, shorten code size, add functions
2929
* 1.0.7 K Hoang 18/02/2020 Add checksum, enable AutoConnect to configurable MultiWiFi and MultiBlynk Credentials
30+
* 1.0.8 K Hoang 24/02/2020 Fix AP-staying-open bug. Add clearConfigData()
3031
*****************************************************************************************************************************/
3132

3233
#ifndef BlynkSimpleEsp32_SSL_WM_h
@@ -334,6 +335,8 @@ class BlynkWifi
334335
pinMode(LED_BUILTIN, OUTPUT);
335336
digitalWrite(LED_BUILTIN, LED_OFF);
336337

338+
WiFi.mode(WIFI_STA);
339+
337340
if (iHostname[0] == 0)
338341
{
339342
#ifdef ESP8266
@@ -607,6 +610,12 @@ class BlynkWifi
607610

608611
return (configData);
609612
}
613+
614+
void clearConfigData()
615+
{
616+
memset(&BlynkESP32_WM_config, 0, sizeof(BlynkESP32_WM_config));
617+
saveConfigData();
618+
}
610619

611620
private:
612621
WebServer *server;

src/BlynkSimpleEsp32_WM.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
88
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
99
* Licensed under MIT license
10-
* Version: 1.0.7
10+
* Version: 1.0.8
1111
*
1212
* Original Blynk Library author:
1313
* @file BlynkSimpleEsp8266.h
@@ -27,6 +27,7 @@
2727
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2828
* 1.0.6 K Hoang 05/02/2020 Optimize, fix EEPROM size to 2K from 4K, shorten code size, add functions
2929
* 1.0.7 K Hoang 18/02/2020 Add checksum, enable AutoConnect to configurable MultiWiFi and MultiBlynk Credentials
30+
* 1.0.8 K Hoang 24/02/2020 Fix AP-staying-open bug. Add clearConfigData()
3031
*****************************************************************************************************************************/
3132

3233
#ifndef BlynkSimpleEsp32_WM_h
@@ -283,6 +284,8 @@ class BlynkWifi
283284
pinMode(LED_BUILTIN, OUTPUT);
284285
digitalWrite(LED_BUILTIN, LED_OFF);
285286

287+
WiFi.mode(WIFI_STA);
288+
286289
if (iHostname[0] == 0)
287290
{
288291
#ifdef ESP8266
@@ -560,6 +563,12 @@ class BlynkWifi
560563

561564
return (configData);
562565
}
566+
567+
void clearConfigData()
568+
{
569+
memset(&BlynkESP32_WM_config, 0, sizeof(BlynkESP32_WM_config));
570+
saveConfigData();
571+
}
563572

564573
private:
565574
WebServer *server;
@@ -903,6 +912,8 @@ class BlynkWifi
903912

904913
uint8_t status;
905914
BLYNK_LOG1(BLYNK_F("Connecting MultiWifi..."));
915+
916+
//WiFi.mode(WIFI_STA);
906917

907918
int i = 0;
908919
status = wifiMulti.run();

0 commit comments

Comments
 (0)