using this trivial program to read the reset reason:
#ifdef ESP8266
extern "C" {
#include "user_interface.h"
// this is in rom so we have to provide only prototype
// 2, 3 = reset (module dependent?), 4 = wdt
int rtc_get_reset_reason(void);
}
#endif
rst_info *myResetInfo;
int rtc_get_reset_reason(void);
int rtcResetReason = 0;
void setup() {
// put your setup code here, to run once:
//Serial.begin(74880); // just to match the bootloader !!! so we can read it ...
Serial.begin(115200);
// es gibt 2 reset reasons rtc und system NUR system ist richtig...
rtcResetReason = rtc_get_reset_reason();
// myResetInfo = ESP.getResetInfoPtr();
myResetInfo = system_get_rst_info();
}
void loop() {
delay(1000); // slow down so we really can see the reason!!
Serial.printf("myResetInfo->reason %x (hex since uint32) rtcResetReason %d (d)\n",
myResetInfo->reason,
rtcResetReason); // reason is uint32
}
BUT even on power on where I should get 4 as a reset reason I get 6.
I don't think that this is a HW problem since when flashing the nodemcu firmware I get the correct reset reason.
Testet with esp8266 Arduino and 2.4.rc1 and even the branch with the SDK version 2.1.0...
Any ideas welcome
please help
Ognian