ESP.getResetInfoPtr not working well !
Posted: Mon Jan 11, 2021 5:24 am
Hi !
I have Wemos d1 mini, and i currently studying deep sleep solutions. I want to know what was the source of the reset. Deep sleep or internal source was that. But when i use the reset button on d1 mini, on the serial always write reset source was deep sleep. I use 2.7.4 library
Can you help me?
Here's the source code which i use:
Thank you for your help !
I have Wemos d1 mini, and i currently studying deep sleep solutions. I want to know what was the source of the reset. Deep sleep or internal source was that. But when i use the reset button on d1 mini, on the serial always write reset source was deep sleep. I use 2.7.4 library
Can you help me?
Here's the source code which i use:
Code: Select all
#include <ESP8266WiFi.h>
extern "C" {
#include <user_interface.h> // https://github.com/esp8266/Arduino actually tools/sdk/include
}
#define durationSleep 60
void tick()
{
int state = digitalRead(BUILTIN_LED); // get the current state of GPIO1 pin
digitalWrite(BUILTIN_LED, !state); // set pin to the opposite state
}
void setup() {
rst_info *xyz;
delay(1000);
xyz = ESP.getResetInfoPtr();
Serial.begin(115200);
pinMode(BUILTIN_LED, OUTPUT);
tick();
Serial.println(" ");
Serial.println("Reason_fn " + String(ESP.getResetReason()));
Serial.println("Reason_ptr " + String((*xyz).reason));
Serial.println("Wake, go to sleep");
delay(1000);
ESP.deepSleep(durationSleep * 1000000);
}
void loop() {
}
Thank you for your help !