Merge pull request #924 from DiUS/rst-info
Expose extended reset info via node.bootreason().
This commit is contained in:
commit
2ff1324d2e
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue