@@ -13,6 +13,12 @@ It is tested and working with
13
13
1 . The ` ESP8266 ` Arduino platform with a recent stable release [ ` ESP8266 Core 2.6.2 or newer ` ] (https://github.com/esp8266/Arduino )
14
14
2 . The ` ESP32 ` Arduino platform with a recent stable release [ ` ESP32 Core 1.0.4 or newer ` ] (https://github.com/espressif/arduino-esp32 )
15
15
16
+ ### Quick Start
17
+
18
+ #### Installing
19
+
20
+ The easiest way is to use ` Arduino Library Manager ` . Search for ` ESP_DoubleResetDetector ` , then select / install the latest version.
21
+
16
22
### Releases
17
23
#### New in v1.0.1
18
24
@@ -24,3 +30,77 @@ It is tested and working with
24
30
25
31
Detects a double reset so that an alternative start-up mode can be used. One example use is to allow re-configuration of a device's wifi credentials.
26
32
33
+ ### Usage
34
+
35
+ How to use
36
+
37
+ ``` cpp
38
+ // These defines must be put before #include <ESP_DoubleResetDetector.h>
39
+ // to select where to store DoubleResetDetector's variable.
40
+ // For ESP32, You must select one to be true (EEPROM or SPIFFS)
41
+ // For ESP8266, You must select one to be true (RTC, EEPROM or SPIFFS)
42
+ // Otherwise, library will use default EEPROM storage
43
+ #define ESP_DRD_USE_EEPROM false
44
+ #define ESP_DRD_USE_SPIFFS true //false
45
+
46
+ #ifdef ESP8266
47
+ #define ESP8266_DRD_USE_RTC false //true
48
+ #endif
49
+
50
+ #define DOUBLERESETDETECTOR_DEBUG true //false
51
+
52
+ #include < ESP_DoubleResetDetector.h> // https://github.com/khoih-prog/ESP_DoubleResetDetector
53
+
54
+ // Number of seconds after reset during which a
55
+ // subseqent reset will be considered a double reset.
56
+ #define DRD_TIMEOUT 10
57
+
58
+ // RTC Memory Address for the DoubleResetDetector to use
59
+ #define DRD_ADDRESS 0
60
+
61
+ DoubleResetDetector* drd;
62
+
63
+ void setup ()
64
+ {
65
+ pinMode (LED_BUILTIN, OUTPUT);
66
+
67
+ Serial.begin(115200);
68
+ Serial.println("\Starting");
69
+
70
+ drd = new DoubleResetDetector(DRD_TIMEOUT, DRD_ADDRESS);
71
+
72
+ if (drd->detectDoubleReset())
73
+ {
74
+ Serial.println("Double Reset Detected");
75
+ digitalWrite(LED_BUILTIN, LOW);
76
+ }
77
+ else
78
+ {
79
+ Serial.println("No Double Reset Detected");
80
+ digitalWrite(LED_BUILTIN, HIGH);
81
+ }
82
+ }
83
+
84
+ void loop ()
85
+ {
86
+ // Call the double reset detector loop method every so often,
87
+ // so that it can recognise when the timeout expires.
88
+ // You can also call drd.stop() when you wish to no longer
89
+ // consider the next reset as a double reset.
90
+ drd->loop();
91
+ }
92
+ ```
93
+ ### TO DO
94
+
95
+ 1 . Search for bug and improvement.
96
+ 2 . Similar features for Arduino (UNO, Mega, etc...)
97
+
98
+ ### Contributing
99
+ If you want to contribute to this project:
100
+ - Report bugs and errors
101
+ - Ask for enhancements
102
+ - Create issues and pull requests
103
+ - Tell other people about this library
104
+
105
+ ### Copyright
106
+ Copyright 2019- Khoi Hoang
0 commit comments