[SOLVED] A machine.reset() different than pushing reset
-
@BetterAuto You can use machine.reset_cause() after reboot to tell, what happened. Look for it in the docs.
-
@robert-hh Wouldn't machine.reset() give the same reset_cause() for both a pushbutton reset and programmatic reset? Since it says in the documentation, "machine.reset() resets the device in a manner similar to pushing the external RESET button."
-
@BetterAuto It seems that you are right. I used that feature on an ESP8266, and there you can use it to tell the difference between a reset caused by machine.reset() or a hard one (pushing the button).
In the Pycom port, it tells the difference between a reset cause by Ctrl-D versus machine.reset(), push button, etc.
I just tried both variants. -
So I gather you're saying reset_cause() on a WiPy 2.0 will say one thing after issuing machine.reset() and something different after pushing reset?
I will test these out later if you're not sure.
-
@BetterAuto No. This is on an ESP8266 port of micropython.org. The ESP32 ports of pycom.io do NOT tell the difference between pushing the button snd machine.reset(). That looks inconsistent, since there seems no method to force an soft reset like Ctrl-D by software.
-
Alright so how can I do this? Do I need to set a flag in the filesystem?
-
I tested it on my WiPy. Pressing the reset button on the board then running machine.reset_cause() shows 0 which equals to machine.PWRON_RESET, whereas running machine.reset() gives reset_cause 2, equal to machine.WDT_RESET.
WDT_RESET? Unexpected.
-
@BetterAuto OK. I was testing with 1.6.12. With 1.6.13, at least there is a difference between hard reset, reset by machine.reset() and reset by Ctrl-D. I do not know whether WDT_RESET is unexpected. It is also a kind of software reset, but it might be nice to tell the difference.
-
@robert-hh Perhaps machine.reset() works by tripping the watchdog?
-
@BetterAuto
Maybe - but i think better will be to distinguished this
PS. We have also another reset conditiondeep sleep -
daniel said in New firmware release 1.6.12.b1:
Fix bug caused by machine.reset(). Used a quick WDT reset instead which actually performs a full reset of the chip.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login