Commit 2ff1324d authored by Terry Ellison's avatar Terry Ellison
Browse files

Merge pull request #924 from DiUS/rst-info

Expose extended reset info via node.bootreason().
parents e9f16d1a 57917601
......@@ -472,8 +472,20 @@ static int node_setcpufreq(lua_State* L)
// Lua: code = bootreason()
static int node_bootreason (lua_State *L)
{
struct rst_info *ri = system_get_rst_info ();
lua_pushnumber (L, rtc_get_reset_reason ());
return 1;
lua_pushnumber (L, ri->reason);
if (ri->reason == REASON_EXCEPTION_RST)
{
lua_pushnumber (L, ri->epc1);
lua_pushnumber (L, ri->epc2);
lua_pushnumber (L, ri->epc3);
lua_pushnumber (L, ri->excvaddr);
lua_pushnumber (L, ri->depc);
return 7;
}
else
return 2;
}
// Lua: restore()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment