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

Commit

Permalink
v1.3.1 to add waitingForMRD() function
Browse files Browse the repository at this point in the history
### Releases v1.3.1

1. Add waitingForMRD() function to signal in MRD wating period. Check [DRD is waiting for a double reset? #14](khoih-prog/ESP_DoubleResetDetector#14)
2. Add example [checkWaitingMRD](https://github.com/khoih-prog/ESP_MultiResetDetector/tree/main/examples/checkWaitingMRD) to demo how to use the new feature.
  • Loading branch information
khoih-prog authored Mar 5, 2022
1 parent 390a11e commit 6322094
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 37 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Please ensure to specify the following:
Arduino IDE version: 1.8.19
ESP8266 Core Version 3.0.2
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-99-generic #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux kh-Inspiron-3593 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered a non-response while trying to press the reset button twice.
Expand Down
57 changes: 36 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/ESP_MultiResetDetector.svg)](http://github.com/khoih-prog/ESP_MultiResetDetector/issues)


<a href="https://www.buymeacoffee.com/khoihprog6" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 50px !important;width: 181px !important;" ></a>
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>

---
---
Expand All @@ -29,6 +30,7 @@
* [ 2. ConfigOnMRD_ESP32_minimal](examples/ConfigOnMRD_ESP32_minimal)
* [ 3. ConfigOnMRD_ESP8266_minimal](examples/ConfigOnMRD_ESP8266_minimal)
* [ 4. minimal](examples/minimal)
* [ 5. checkWaitingMRD](examples/checkWaitingMRD) **New**
* [Examples from other libraries](#examples-from-other-libraries)
* [ 1. ESP_WiFiManager Library](https://github.com/khoih-prog/ESP_WiFiManager)
* [ 1. ConfigOnDoubleReset](https://github.com/khoih-prog/ESP_WiFiManager/tree/master/examples/ConfigOnDoubleReset)
Expand Down Expand Up @@ -57,6 +59,7 @@
* [ 6. Blynk_Async_ESP32_BT_WF](https://github.com/khoih-prog/Blynk_Async_ESP32_BT_WF)
* [ 7. Blynk_Async_GSM_Manager](https://github.com/khoih-prog/Blynk_Async_GSM_Manager)
* [ 8. Ethernet_Manager](https://github.com/khoih-prog/Ethernet_Manager)
* [Example checkWaitingMRD](#Example-checkWaitingMRD)
* [Debug Terminal Output Samples](#debug-terminal-output-samples)
* [1. ESP32_FSWebServer_DRD on ESP32_DEV](#1-esp32_fswebserver_drd-on-esp32_dev)
* [2. minimal on ESP32_DEV](#2-minimal-on-esp32_dev)
Expand Down Expand Up @@ -302,6 +305,15 @@ and there are many more.
* [ 7. Blynk_Async_GSM_Manager](https://github.com/khoih-prog/Blynk_Async_GSM_Manager)
* [ 8. Ethernet_Manager](https://github.com/khoih-prog/Ethernet_Manager)


---
---

### Example [checkWaitingMRD](examples/checkWaitingMRD)

https://github.com/khoih-prog/ESP_MultiResetDetector/blob/390a11e842b689ab3277dc42c617344416aaa559/examples/checkWaitingMRD/checkWaitingMRD.ino#L22-L148


---
---

Expand All @@ -313,8 +325,8 @@ This is terminal debug output when running [ESP32_FSWebServer_DRD](https://githu

```cpp
Starting ESP32_FSWebServer_DRD with DoubleResetDetect using SPIFFS on ESP32_DEV
ESP_WiFiManager v1.9.0
ESP_MultiResetDetector v1.3.0
ESP_WiFiManager v1.10.1
ESP_MultiResetDetector v1.3.1
FS File: /ConfigSW.json, size: 150B
FS File: /CanadaFlag_1.png, size: 40.25KB
FS File: /CanadaFlag_2.png, size: 8.12KB
Expand Down Expand Up @@ -381,7 +393,7 @@ This is terminal debug output when running [minimal](examples/minimal) on ***ESP

```
Starting ESP_MultiResetDetector minimal on ESP32_DEV using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
/home/kh/Arduino/libraries/LITTLEFS-master/src/lfs.c:1003:error: Corrupted dir pair at {0x0, 0x1}
E (241) esp_littlefs: mount failed, (-84)
E (245) esp_littlefs: Failed to initialize LittleFS
Expand All @@ -402,7 +414,7 @@ Saving config file OK
```
Starting ESP_MultiResetDetector minimal on ESP32_DEV using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
lowerBytes = 0x0001, upperBytes = 0x0001
Expand All @@ -417,7 +429,7 @@ No Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP32_DEV using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFD0002
multiResetDetectorFlag = 0xFFFD0002
lowerBytes = 0x0002, upperBytes = 0x0002
Expand All @@ -432,7 +444,7 @@ No Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP32_DEV using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFC0003
multiResetDetectorFlag = 0xFFFC0003
lowerBytes = 0x0003, upperBytes = 0x0003
Expand All @@ -447,7 +459,7 @@ No Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP32_DEV using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFB0004
multiResetDetectorFlag = 0xFFFB0004
lowerBytes = 0x0004, upperBytes = 0x0004
Expand All @@ -462,7 +474,7 @@ No Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP32_DEV using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFA0005
multiResetDetectorFlag = 0xFFFA0005
lowerBytes = 0x0005, upperBytes = 0x0005
Expand All @@ -476,7 +488,7 @@ Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP32_DEV using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFB0004
multiResetDetectorFlag = 0xFFFB0004
lowerBytes = 0x0004, upperBytes = 0x0004
Expand All @@ -495,7 +507,7 @@ Saving config file OK
```

Starting ESP_MultiResetDetector minimal on ESP32_DEV using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
lowerBytes = 0x0001, upperBytes = 0x0001
Expand All @@ -518,7 +530,7 @@ This is terminal debug output when running [minimal](examples/minimal) on ***ESP
```
Starting ESP_MultiResetDetector minimal on ESP8266_NODEMCU using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
multiResetDetectorFlag = 0x00000000
lowerBytes = 0x0000, upperBytes = 0xFFFF
lowerBytes = 0x0000, upperBytes = 0xFFFF
Expand All @@ -533,7 +545,7 @@ No Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP8266_NODEMCU using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
lowerBytes = 0x0001, upperBytes = 0x0001
Expand All @@ -548,7 +560,7 @@ No Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP8266_NODEMCU using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFD0002
multiResetDetectorFlag = 0xFFFD0002
lowerBytes = 0x0002, upperBytes = 0x0002
Expand All @@ -563,7 +575,7 @@ No Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP8266_NODEMCU using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFC0003
multiResetDetectorFlag = 0xFFFC0003
lowerBytes = 0x0003, upperBytes = 0x0003
Expand All @@ -578,7 +590,7 @@ No Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP8266_NODEMCU using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFB0004
multiResetDetectorFlag = 0xFFFB0004
lowerBytes = 0x0004, upperBytes = 0x0004
Expand All @@ -592,7 +604,7 @@ Saving config file OK
```
Starting ESP_MultiResetDetector minimal on ESP8266_NODEMCU using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFA0005
multiResetDetectorFlag = 0xFFFA0005
lowerBytes = 0x0005, upperBytes = 0x0005
Expand All @@ -606,7 +618,7 @@ Multi Reset Detected
```
Starting ESP_MultiResetDetector minimal on ESP8266_NODEMCU using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFB0004
multiResetDetectorFlag = 0xFFFB0004
lowerBytes = 0x0004, upperBytes = 0x0004
Expand All @@ -624,7 +636,7 @@ Saving config file OK
```
Starting ESP_MultiResetDetector minimal on ESP8266_NODEMCU using LittleFS
ESP_MultiResetDetector v1.3.0
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
lowerBytes = 0x0001, upperBytes = 0x0001
Expand All @@ -644,8 +656,8 @@ This is terminal debug output when running [ESPAsync_WiFi](https://github.com/kh
```
Starting ESPAsync_WiFi using LittleFS on ESP32S3_DEV
ESPAsync_WiFiManager_Lite v1.7.0
ESP_MultiResetDetector v1.3.0
ESPAsync_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.1
LittleFS Flag read = 0xFFFC0003
multiResetDetectorFlag = 0xFFFC0003
lowerBytes = 0x0003, upperBytes = 0x0003
Expand Down Expand Up @@ -762,17 +774,20 @@ Submit issues to: [ESP_MultiResetDetector issues](https://github.com/khoih-prog/
1. Multi Reset Detector for ESP32 (EEPROM, SPIFFS and LittleFS) and ESP8266 (RTC, EEPROM, SPIFFS and LittleFS).
2. Add support to `ESP32_C3`, `ESP32_S2`
3. Add support to `ESP32_S3` using ESP32 core v2.0.2+
4. Add waitingForMRD() function to signal in MRD wating period.

---
---

### Contributions and thanks

1. Thanks to [kbssa](https://github.com/kbssa) for request enhancement in [Issue 9: Not an issue, but a question](https://github.com/khoih-prog/ESP_DoubleResetDetector/issues/9), leading to this new [ESP_MultiResetDetector Library](https://github.com/khoih-prog/ESP_MultiResetDetector)
2. Thanks to [Tochi Moreno](https://github.com/tochimoreno) for enhancement request in [DRD is waiting for a double reset? #14](https://github.com/khoih-prog/ESP_DoubleResetDetector/discussions/14) leading to v1.3.1 to add `waitingForMRD()` function to signal in MRD wating period

<table>
<tr>
<td align="center"><a href="https://github.com/kbssa"><img src="https://github.com/kbssa.png" width="100px;" alt="kbssa"/><br /><sub><b>kbssa</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/tochimoreno"><img src="https://github.com/tochimoreno.png" width="100px;" alt="tochimoreno"/><br /><sub><b>Tochi Moreno</b></sub></a><br /></td>
</tr>
</table>

Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@


* [Changelog](#changelog)
* [Releases v1.3.1](#releases-v131)
* [Releases v1.3.0](#releases-v130)
* [Releases v1.2.1](#releases-v121)
* [Releases v1.2.0](#releases-v120)
Expand All @@ -24,6 +25,11 @@

## Changelog

### Releases v1.3.1

1. Add waitingForMRD() function to signal in MRD wating period. Check [DRD is waiting for a double reset? #14](https://github.com/khoih-prog/ESP_DoubleResetDetector/discussions/14)
2. Add example [checkWaitingMRD](https://github.com/khoih-prog/ESP_MultiResetDetector/tree/main/examples/checkWaitingMRD) to demo how to use the new feature.

### Releases v1.3.0

1. Add support to `ESP32_S3` using [ESP32 core, esp32-s3-support branch, v2.0.2+](https://github.com/espressif/arduino-esp32/tree/esp32-s3-support)
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ MultiResetDetector
#######################################

detectMultiReset KEYWORD2
waitingForMRD KEYWORD2
loop KEYWORD2
stop KEYWORD2

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": "ESP_MultiResetDetector",
"version": "1.3.0",
"version": "1.3.1",
"keywords": "rtc, eeprom, littlefs, spiffs, reset, data, esp32, esp32-c3, esp32-s2, esp32-s3, esp8266, double-reset, multi-reset, detector, double-reset-detector, multi-reset-detector",
"description": "Library to detect a multi reset within a predetermined time, using RTC Memory, EEPROM, LittleFS or SPIFFS for ESP8266 and ESP32",
"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=ESP_MultiResetDetector
version=1.3.0
version=1.3.1
author=Khoi Hoang
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=MIT
Expand Down
44 changes: 31 additions & 13 deletions src/ESP_MultiResetDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,41 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESP_MultiResetDetector
Licensed under MIT license
Version: 1.3.0
Version: 1.3.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.1.1 K Hoang 30/12/2020 Initial coding to support Multiple Reset Detection. Sync with ESP_DoubleResetDetector v1.1.1
1.1.2 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.2.0 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
1.2.1 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
1.3.0 K Hoang 10/02/2022 Add support to new ESP32-S3
1.3.0 K Hoang 10/02/2022 Add support to new ESP32-S3
1.3.1 K Hoang 04/03/2022 Add waitingForMRD() function to signal in MRD wating period
*****************************************************************************************************************************/

#pragma once

#ifndef ESP_MultiResetDetector_H
#define ESP_MultiResetDetector_H

#ifndef MULTIRESETDETECTOR_DEBUG
#define MULTIRESETDETECTOR_DEBUG false
#endif

#if defined(ARDUINO) && (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif

#ifndef ESP_MULTI_RESET_DETECTOR_VERSION
#define ESP_MULTI_RESET_DETECTOR_VERSION "ESP_MultiResetDetector v1.3.0"
#define ESP_MULTI_RESET_DETECTOR_VERSION "ESP_MultiResetDetector v1.3.1"

#define ESP_MULTI_RESET_DETECTOR_VERSION_MAJOR 1
#define ESP_MULTI_RESET_DETECTOR_VERSION_MINOR 3
#define ESP_MULTI_RESET_DETECTOR_VERSION_PATCH 0
#define ESP_MULTI_RESET_DETECTOR_VERSION_PATCH 1

#define ESP_MULTI_RESET_DETECTOR_VERSION_INT 1003000
#define ESP_MULTI_RESET_DETECTOR_VERSION_INT 1003001
#endif

#define ESP_MULTIRESETDETECTOR_VERSION ESP_MULTI_RESET_DETECTOR_VERSION
Expand All @@ -52,7 +57,10 @@

#ifdef ESP32
#if (!ESP_MRD_USE_EEPROM && !ESP_MRD_USE_SPIFFS && !ESP_MRD_USE_LITTLEFS)
#warning Neither EEPROM, SPIFFS nor LittleFS selected. Default to EEPROM
#if (MULTIRESETDETECTOR_DEBUG)
#warning Neither EEPROM, SPIFFS nor LittleFS selected. Default to EEPROM
#endif

#ifdef ESP_MRD_USE_EEPROM
#undef ESP_MRD_USE_EEPROM
#define ESP_MRD_USE_EEPROM true
Expand All @@ -62,7 +70,10 @@

#ifdef ESP8266
#if (!ESP8266_MRD_USE_RTC && !ESP_MRD_USE_EEPROM && !ESP_MRD_USE_SPIFFS && !ESP_MRD_USE_LITTLEFS)
#warning Neither RTC, EEPROM, LITTLEFS nor SPIFFS selected. Default to EEPROM
#if (MULTIRESETDETECTOR_DEBUG)
#warning Neither RTC, EEPROM, LITTLEFS nor SPIFFS selected. Default to EEPROM
#endif

#ifdef ESP_MRD_USE_EEPROM
#undef ESP_MRD_USE_EEPROM
#define ESP_MRD_USE_EEPROM true
Expand Down Expand Up @@ -94,14 +105,20 @@
// Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h
//#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) ) //(ESP_ARDUINO_VERSION_MAJOR >= 2)
#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) )
#warning Using ESP32 Core 1.0.6 or 2.0.0+
#if (MULTIRESETDETECTOR_DEBUG)
#warning Using ESP32 Core 1.0.6 or 2.0.0+
#endif

// The library has been merged into esp32 core from release 1.0.6
#include <LittleFS.h>

#define FileFS LittleFS
#define FS_Name "LittleFS"
#else
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
#if (MULTIRESETDETECTOR_DEBUG)
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
#endif

// The library has been merged into esp32 core from release 1.0.6
#include <LITTLEFS.h> // https://github.com/lorol/LITTLEFS

Expand Down Expand Up @@ -130,10 +147,6 @@

#endif //#if ESP_MRD_USE_EEPROM

#ifndef MULTIRESETDETECTOR_DEBUG
#define MULTIRESETDETECTOR_DEBUG false
#endif

///////////////////
// Default values if not specified in sketch

Expand Down Expand Up @@ -234,6 +247,11 @@ class MultiResetDetector
return multiResetDetected;

};

bool waitingForMRD()
{
return waitingForMultiReset;
}

void loop()
{
Expand Down

0 comments on commit 6322094

Please sign in to comment.