I can see that machine.reset_cause() directly calls the function from the SDK. If you look in tools/sdk/include/user_interface.h. All the reasons in modmachine are mapped directly to this enum:
Code: Select all
typedef enum {
REASON_DEFAULT_RST = 0, /**< normal startup by power on */
REASON_WDT_RST, /**< hardware watch dog reset */
REASON_EXCEPTION_RST, /**< exception reset, GPIO status won't change */
REASON_SOFT_WDT_RST, /**< software watch dog reset, GPIO status won't change */
REASON_SOFT_RESTART, /**< software restart ,system_restart , GPIO status won't change */
REASON_DEEP_SLEEP_AWAKE, /**< wake up from deep-sleep */
REASON_EXT_SYS_RST /**< external system reset */
} rst_reason;
As you can see, we're missing REASON_EXCEPTION_RST, which would be the reset reason in your case. Perhaps we should add that to the esp8266/modmachine.c