Closed zobix closed 4 years ago
You have to start from the simplest code, such as the example. Then add more features gradually to see when it has errors. Anyway, without your actual code, I can't provide any help.
The sketch from the example does not compile. No more features have been added. Only example/minimal.ino
actual code:
// Number of seconds after reset during which a // subseqent reset will be considered a double reset.
// RTC Memory Address for the DoubleResetDetector to use
DoubleResetDetector drd(DRD_TIMEOUT, DRD_ADDRESS);
void setup() { //pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200); Serial.println(); Serial.println("DoubleResetDetector Example Program"); Serial.println("-----------------------------------");
if (drd.detectDoubleReset()) { Serial.println("Double Reset Detected"); //digitalWrite(LED_BUILTIN, LOW); } else { Serial.println("No Double Reset Detected"); //digitalWrite(LED_BUILTIN, HIGH); } }
void loop() { // Call the double reset detector loop method every so often, // so that it can recognise when the timeout expires. // You can also call drd.stop() when you wish to no longer // consider the next reset as a double reset. drd.loop(); }
HI @zobix, Thanks for using the library and reporting the bug, which causes by the left-over cpp file. Please use the new version v1.0.2 where the bug has been fixed and your contribution noted. Sorry for the inconvenience so far, Regards,
PS: Actually, I check and find out that the ESP_DoubleResetDetector.cpp is not included in v1.0.1. It's possible a left-over in the file system from previous v1.0.0 version after you install the v1.0.1. Please check and erase that ESP_DoubleResetDetector.cpp file in your library directory. The location in your system is C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp
Hi khoih-prog! Fine! Great library, thanks a lot!
Hello!
I get an Error compilation for ESP32. Arduino IDE 1.8.12, ESP32 core 1.0.4. Many redifinitions errors. How to fix it?
Log of compilator:
In file included from C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:19:0:
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.h:35:2: warning: #warning Neither EEPROM nor SPIFFS selected. Default to EEPROM [-Wcpp]
warning Neither EEPROM nor SPIFFS selected. Default to EEPROM
^
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:44:1: error: redefinition of 'DoubleResetDetector::DoubleResetDetector(int, int)'
DoubleResetDetector::DoubleResetDetector(int timeout, int address)
^
In file included from C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:19:0:
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.h:88:5: note: 'DoubleResetDetector::DoubleResetDetector(int, int)' previously defined here
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:60:6: error: redefinition of 'bool DoubleResetDetector::detectDoubleReset()'
bool DoubleResetDetector::detectDoubleReset()
In file included from C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:19:0:
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.h:116:10: note: 'bool DoubleResetDetector::detectDoubleReset()' previously defined here
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:84:6: error: redefinition of 'void DoubleResetDetector::loop()'
void DoubleResetDetector::loop()
In file included from C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:19:0:
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.h:142:10: note: 'void DoubleResetDetector::loop()' previously defined here
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:96:6: error: redefinition of 'void DoubleResetDetector::stop()'
void DoubleResetDetector::stop()
In file included from C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:19:0:
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.h:154:10: note: 'void DoubleResetDetector::stop()' previously defined here
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:102:6: error: redefinition of 'bool DoubleResetDetector::detectRecentlyResetFlag()'
bool DoubleResetDetector::detectRecentlyResetFlag()
In file included from C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:19:0:
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.h:169:10: note: 'bool DoubleResetDetector::detectRecentlyResetFlag()' previously defined here
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:121:6: error: redefinition of 'void DoubleResetDetector::setRecentlyResetFlag()'
void DoubleResetDetector::setRecentlyResetFlag() {
In file included from C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:19:0:
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.h:212:10: note: 'void DoubleResetDetector::setRecentlyResetFlag()' previously defined here
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:139:6: error: redefinition of 'void DoubleResetDetector::clearRecentlyResetFlag()'
void DoubleResetDetector::clearRecentlyResetFlag() {
In file included from C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:19:0:
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.h:257:10: note: 'void DoubleResetDetector::clearRecentlyResetFlag()' previously defined here
C:\Users\User\Documents\Arduino\libraries\ESP_DoubleResetDetector-master\src\ESP_DoubleResetDetector.cpp:23:17: warning: 'DOUBLERESETDETECTOR_FLAG' defined but not used [-Wunused-variable]
static uint32_t DOUBLERESETDETECTOR_FLAG;