Hi,
My use case is simple. There are 2 flows depending on the D1 Mini start up. If the user press reset button I need to follow an specific startup flow. If the D1 Mini starts because of a power turn-off/turn-on it is another flow.
The problem is:
Using D1 Mini 4M with external antenna (picture below) when I reset (using reset button) the (*rinfo).reason is 6, that is OK. When I disconnect and connect the power cable (USB) the (*rinfo).reason is also 6. That is the problem, It should be 0, as far as I could read and understand. This version is my preferred version because it has external antenna to increase the signal range.
Doing the same procedure with D1 Mini Pro (picture below) when I reset (using reset button) the (*rinfo).reason is 6 that is OK. When I disconnect and connect the power cable (USB) the (*rinfo).reason is 0. This is the behavior I expected from D1 Mini 4M with external antenna
This is the sketch I'm using:
#include <ESP8266WiFi.h>
rst_info *rinfo;
void setup() {
Serial.begin(115200);
while (!Serial) {;}
rinfo = ESP.getResetInfoPtr();
}
void loop() {
Serial.println(" ");
Serial.println(String("ResetInfo.reason = ") + (*rinfo).reason);
delay(15000);
}
Results with D1 Mini Pro:
With reset button pressed:
12:48:10.584 -> ResetInfo.reason = 6
12:48:10.584 ->
12:48:25.590 -> ResetInfo.reason = 6
With power on/off (USB disconnect)
12:50:07.730 ->
12:50:07.733 -> ResetInfo.reason = 0
12:50:07.733 ->
D1 Mini 4M with external antenna:
With reset button pressed:
12:51:45.674 -> ResetInfo.reason = 6
12:51:45.707 ->
12:52:00.466 -> ResetInfo.reason = 6
With power on/off (USB disconnect)
12:52:40.255 -> ResetInfo.reason = 6
12:52:40.266 ->
12:52:55.258 -> ResetInfo.reason = 6
So, How do I fix the D1 Mini 4M with external antenna to distinguish between a power down / power up and the user pressing reset button ?
Thank you in advance,