Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
v1.2.1 for BLE auto-reconnect
Browse files Browse the repository at this point in the history
### Releases v1.2.1

1. Add auto-reconnect feature for BLE. Check [Handle BLE disconnects #2](#2)
  • Loading branch information
khoih-prog committed Aug 13, 2021
1 parent d1b9eb8 commit 8e93906
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 38 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p

Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.13) or Platform.io version
* Arduino IDE version (e.g. 1.8.15) or Platform.io version
* `ESP32` Core Version (e.g. ESP32 core v1.0.6)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
Expand All @@ -26,10 +26,10 @@ Please ensure to specify the following:
### Example

```
Arduino IDE version: 1.8.13
Arduino IDE version: 1.8.15
ESP32 Core Version 1.0.6
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Context:
The board couldn't autoreconnect to Local Blynk Server after router power recycling.
Expand Down
31 changes: 23 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* [Currently supported Boards](#currently-supported-boards)
* [Not yet supported Boards](#not-yet-supported-boards)
* [Changelog](#changelog)
* [Releases v1.2.1](#releases-v121)
* [Major Releases v1.2.0](#major-releases-v120)
* [Releases v1.1.1](#releases-v111)
* [Major Releases v1.1.0](#major-releases-v110)
Expand Down Expand Up @@ -133,6 +134,11 @@ This [**BlynkESP32_BT_WF** library](https://github.com/khoih-prog/BlynkESP32_BT_

## Changelog

### Releases v1.2.1

1. Add auto-reconnect feature for BLE. Check [Handle BLE disconnects #2](https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF/issues/2)


### Major Releases v1.2.0

1. Enable scan of WiFi networks for selection in Configuration Portal. Check [PR for v1.3.0 - Enable scan of WiFi networks #10](https://github.com/khoih-prog/WiFiManager_NINA_Lite/pull/10). Now you can select optional **SCAN_WIFI_NETWORKS**, **MANUAL_SSID_INPUT_ALLOWED** to be able to manually input SSID, not only from a scanned SSID lists and **MAX_SSID_IN_LIST** (from 2-15)
Expand Down Expand Up @@ -169,9 +175,9 @@ This [**BlynkESP32_BT_WF** library](https://github.com/khoih-prog/BlynkESP32_BT_

## Prerequisites

1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
2. [`Blynk library 0.6.1+`](https://github.com/blynkkk/blynk-library/releases). Never use the **beta versions** or your request for support will be ignored.
3. [`ESP32 Core 1.0.6+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
1. [`Arduino IDE 1.8.15+` for Arduino](https://www.arduino.cc/en/Main/Software)
2. [`Blynk library 0.6.1`](https://github.com/blynkkk/blynk-library/releases).
3. [`ESP32 Core 1.0.6`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/). Don't use Pre-Releases such as [`ESP32 Core 2.0.0-RC1`](https://github.com/espressif/arduino-esp32/releases/tag/2.0.0-rc1) as it's not supported yet.
4. [`ESP_DoubleResetDetector library 1.1.1+`](https://github.com/khoih-prog/ESP_DoubleResetDetector) to use DRD feature. To install, check [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP_DoubleResetDetector.svg?)](https://www.ardu-badge.com/ESP_DoubleResetDetector).
5. [`ESPAsyncWebServer v1.2.3+`](https://github.com/me-no-dev/ESPAsyncWebServer)
6. [`AsyncTCP v1.1.1+`](https://github.com/me-no-dev/AsyncTCP)
Expand Down Expand Up @@ -1301,7 +1307,7 @@ The following is the sample terminal output when running example [Async_ESP32_BL

```
Starting Async_ESP32_BLE_WF using SPIFFS without SSL on ESP32_DEV
Blynk_Async_ESP32_BT_WF v1.2.0
Blynk_Async_ESP32_BT_WF v1.2.1
ESP_DoubleResetDetector v1.1.1
GPIO14 HIGH, Use WiFi
USE_BLYNK_WM: Blynk_WF begin
Expand Down Expand Up @@ -1359,7 +1365,7 @@ FF[9799112] id: = HueNet1

```
Starting Async_ESP32_BLE_WF using SPIFFS without SSL on ESP32_DEV
Blynk_Async_ESP32_BT_WF v1.2.0
Blynk_Async_ESP32_BT_WF v1.2.1
ESP_DoubleResetDetector v1.1.1
GPIO14 HIGH, Use WiFi
USE_BLYNK_WM: Blynk_WF begin
Expand Down Expand Up @@ -1437,7 +1443,7 @@ FFFFF

```
Starting Async_ESP32_BLE_WF using SPIFFS without SSL on ESP32_DEV
Blynk_Async_ESP32_BT_WF v1.2.0
Blynk_Async_ESP32_BT_WF v1.2.1
ESP_DoubleResetDetector v1.1.1
GPIO14 HIGH, Use WiFi
USE_BLYNK_WM: Blynk_WF begin
Expand Down Expand Up @@ -1524,7 +1530,7 @@ ets Jun 8 2016 00:22:57
Starting Async_ESP32_BLE_WF using LITTLEFS without SSL on ESP32_DEV
Blynk_Async_ESP32_BT_WF v1.2.0
Blynk_Async_ESP32_BT_WF v1.2.1
ESP_DoubleResetDetector v1.1.1
GPIO14 HIGH, Use WiFi
USE_BLYNK_WM: Blynk_WF begin
Expand Down Expand Up @@ -1606,7 +1612,7 @@ ets Jun 8 2016 00:22:57
Starting Async_ESP32_BLE_WF using LITTLEFS without SSL on ESP32_DEV
Blynk_Async_ESP32_BT_WF v1.2.0
Blynk_Async_ESP32_BT_WF v1.2.1
ESP_DoubleResetDetector v1.1.1
GPIO14 HIGH, Use WiFi
USE_BLYNK_WM: Blynk_WF begin
Expand Down Expand Up @@ -1697,6 +1703,10 @@ Sometimes, the library will only work if you update the board core to the latest

## Releases

### Releases v1.2.1

1. Add auto-reconnect feature for BLE. Check [Handle BLE disconnects #2](https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF/issues/2)

### Major Releases v1.2.0

1. Enable scan of WiFi networks for selection in Configuration Portal. Check [PR for v1.3.0 - Enable scan of WiFi networks #10](https://github.com/khoih-prog/WiFiManager_NINA_Lite/pull/10). Now you can select optional **SCAN_WIFI_NETWORKS**, **MANUAL_SSID_INPUT_ALLOWED** to be able to manually input SSID, not only from a scanned SSID lists and **MAX_SSID_IN_LIST** (from 2-15)
Expand Down Expand Up @@ -1735,6 +1745,8 @@ Sometimes, the library will only work if you update the board core to the latest

1. Same features for other boards with WiFi / BT
2. Optimize library so that smaller code size. Currently 2 instances of Blynk coexist and don't share code.
3. Add support to ESP32_S2 and ESP32_C3
4. Add support to ESP32 core 2.0.0+

---

Expand Down Expand Up @@ -1772,6 +1784,7 @@ Sometimes, the library will only work if you update the board core to the latest
30. Permit optionally inputting one set of WiFi SSID/PWD by using `REQUIRE_ONE_SET_SSID_PW == true`
31. Enforce WiFi PWD minimum length of 8 chars
32. Enable **scan of WiFi networks** for selection in Configuration Portal
33. Add auto-reconnect feature for BLE.

---
---
Expand All @@ -1787,6 +1800,7 @@ Check these new features thanks to his direct contribution and/or enhancement re
* [Good new feature: Blynk.resetAndEnterConfigPortal() Thanks & question #27](https://github.com/khoih-prog/Blynk_WM/issues/27)
5. Thanks to [Michael H. "bizprof"](https://github.com/bizprof). With the impressive new feature :
- `Enable scan of WiFi networks for selection in Configuration Portal`. Check [PR for v1.3.0 - Enable scan of WiFi networks #10](https://github.com/khoih-prog/WiFiManager_NINA_Lite/pull/10) leading to v1.2.0
6. Thanks to [Valeria](https://github.com/Valeria) to provide the amazing fix to permit BLE auto-reconnect. Check [Handle BLE disconnects #2](https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF/issues/2)

<table>
<tr>
Expand All @@ -1795,6 +1809,7 @@ Check these new features thanks to his direct contribution and/or enhancement re
<td align="center"><a href="https://github.com/tcpipchip"><img src="https://github.com/tcpipchip.png" width="100px;" alt="tcpipchip"/><br /><sub><b>⭐️ tcpipchip</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/thorathome"><img src="https://github.com/thorathome.png" width="100px;" alt="thorathome"/><br /><sub><b>⭐️⭐️ Thor Johnson</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/bizprof"><img src="https://github.com/bizprof.png" width="100px;" alt="bizprof"/><br /><sub><b>⭐️⭐️ Michael H. "bizprof"</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/Valeria"><img src="https://github.com/Valeria.png" width="100px;" alt="Valeria"/><br /><sub><b>Valeria"</b></sub></a><br /></td>
</tr>
</table>

Expand Down
3 changes: 2 additions & 1 deletion examples/Async_ESP32_BLE_WF/Async_ESP32_BLE_WF.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF
Licensed under MIT license
Version: 1.2.0
Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,6 +19,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/
/****************************************************************************************************************************
Important Notes:
Expand Down
3 changes: 2 additions & 1 deletion examples/Async_ESP32_BT_WF/Async_ESP32_BT_WF.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF
Licensed under MIT license
Version: 1.2.0
Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,6 +19,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/
/****************************************************************************************************************************
Important Notes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF
Licensed under MIT license
Version: 1.2.0
Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,6 +19,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/
/****************************************************************************************************************************
Important Notes:
Expand Down
3 changes: 2 additions & 1 deletion examples/Async_Geiger_Counter_BT/Async_Geiger_Counter_BT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF
Licensed under MIT license
Version: 1.2.0
Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,6 +19,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/
/****************************************************************************************************************************
Important Notes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF
Licensed under MIT license
Version: 1.2.0
Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,6 +19,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/
/****************************************************************************************************************************
Important Notes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF
Licensed under MIT license
Version: 1.2.0
Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,6 +19,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/
/****************************************************************************************************************************
Important Notes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF
Licensed under MIT license
Version: 1.2.0
Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,6 +19,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/
/****************************************************************************************************************************
Important Notes:
Expand Down
5 changes: 5 additions & 0 deletions examples/Async_PET_Check/Async_PET_Check.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
Version: 1.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.6 K Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.6 K Hoang 25/08/2020 Initial coding to use (ESP)AsyncWebServer instead of (ESP8266)WebServer.
Expand All @@ -19,6 +23,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/
/****************************************************************************************************************************
Example Created by Miguel Alexandre Wisintainer
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Blynk_Async_ESP32_BT_WF",
"version": "1.2.0",
"version": "1.2.1",
"description": "By design, Blynk user can run ESP32 boards with either WiFi or BT/BLE by using different sketches, and have to upload / update firmware to change. This library enables user to include both Blynk BT / BLE and WiFi libraries in one sketch, run both WiFi and BT/BLE simultaneously, or select one to use at runtime after reboot. This library also supports (auto)connection to MultiWiFi and MultiBlynk, dynamic custom as well as static parameters in Config Portal. Eliminate hardcoding your Wifi and Blynk credentials and configuration data saved in either LittleFS, SPIFFS or EEPROM. Optional default Credentials to be autoloaded into Config Portal to use or change instead of manually input. Static STA IP and DHCP Hostname as well as Config Portal AP channel, IP, SSID, Password can be configured. DoubleDetectDetector feature permits entering Config Portal as requested. Using AsyncWebServer instead of WebServer. Now with scanning of WiFi networks for selection in Configuration Portal.",
"keywords": "async, control, device, communication, wifi, ble, bt-ble, bluetooth, drd, mrd, double-reset, multi-reset, multi-wifi, multi-blynk, littlefs, spiffs, eeprom, webserver, config-portal, credentials, protocol, iot, sensors, m2m, smartphone, mobile, app, web, cloud, ethernet, usb, serial, gsm, gprs, 3g, data, esp8266, http, portal",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Blynk_Async_ESP32_BT_WF
version=1.2.0
version=1.2.1
author=Khoi Hoang
license=MIT
maintainer=Khoi Hoang <khoih.prog@gmail.com>
Expand Down
16 changes: 11 additions & 5 deletions src/BlynkSimpleEsp32_Async_BLE_WF.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@date Oct 2016
@brief
Version: 1.2.0
Version: 1.2.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.1.1 K Hoang 31/01/2021 Add functions to control Config Portal (CP) from software or Virtual Switches
Fix CP and Dynamic Params bugs. To permit autoreset after timeout if DRD/MRD or forced CP
1.2.0 K Hoang 24/04/2021 Enable scan of WiFi networks for selection in Configuration Portal and many new features.
1.2.1 K Hoang 13/08/2021 Add auto-reconnect feature for BLE
*****************************************************************************************************************************/

#pragma once
Expand All @@ -40,18 +41,20 @@
ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \
ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM )
#define BOARD_TYPE "ESP32-S2"
#error ESP32-S2 is not supporteed yet. Please check later.
#error ESP32-S2 is not supported yet. Please check later.
#elif ( ARDUINO_ESP32C3_DEV )
#define BOARD_TYPE "ESP32-C3"
#error ESP32-C3 is not supporteed yet. Please check later.
#error ESP32-C3 is not supported yet. Please check later.
#else
#define BOARD_TYPE "ESP32"
#endif

#define BLYNK_ASYNC_ESP32_BT_WF_VERSION "Blynk_Async_ESP32_BT_WF v1.2.0"
#if !defined(BLYNK_ASYNC_ESP32_BT_WF_VERSION)
#define BLYNK_ASYNC_ESP32_BT_WF_VERSION "Blynk_Async_ESP32_BT_WF v1.2.1"
#endif

#ifndef BLYNK_INFO_CONNECTION
#define BLYNK_INFO_CONNECTION "Esp32_BLE"
#define BLYNK_INFO_CONNECTION "Esp32_BLE"
#endif

#define BLYNK_SEND_ATOMIC
Expand Down Expand Up @@ -235,6 +238,9 @@ void BlynkTransportEsp32_BLE::onDisconnect(BLEServer* pServer) {
BLYNK_LOG1(BLYNK_F("BLEDisCon"));
Blynk_BLE.disconnect();
disconnect();

// Start advertising
pServer->getAdvertising()->start();
}
//

Expand Down
Loading

0 comments on commit 8e93906

Please sign in to comment.