Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
2277aecd
Commit
2277aecd
authored
Jan 15, 2016
by
Terry Ellison
Browse files
Merge pull request #938 from DiUS/rst-info-opt
Optimized node.bootreason() for size.
parents
74e5ebdf
30f8f624
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/node.c
View file @
2277aecd
...
@@ -469,24 +469,19 @@ static int node_setcpufreq(lua_State* L)
...
@@ -469,24 +469,19 @@ static int node_setcpufreq(lua_State* L)
return
1
;
return
1
;
}
}
// Lua: code = bootreason()
// Lua: code
, reason [, exccause, epc1, epc2, epc3, excvaddr, depc ]
= bootreason()
static
int
node_bootreason
(
lua_State
*
L
)
static
int
node_bootreason
(
lua_State
*
L
)
{
{
struct
rst_info
*
ri
=
system_get_rst_info
();
const
struct
rst_info
*
ri
=
system_get_rst_info
();
lua_pushnumber
(
L
,
rtc_get_reset_reason
());
uint32_t
arr
[
8
]
=
{
lua_pushnumber
(
L
,
ri
->
reason
);
rtc_get_reset_reason
(),
if
(
ri
->
reason
==
REASON_EXCEPTION_RST
)
ri
->
reason
,
{
ri
->
exccause
,
ri
->
epc1
,
ri
->
epc2
,
ri
->
epc3
,
ri
->
excvaddr
,
ri
->
depc
lua_pushnumber
(
L
,
ri
->
exccause
);
};
lua_pushnumber
(
L
,
ri
->
epc1
);
int
i
,
n
=
((
ri
->
reason
!=
REASON_EXCEPTION_RST
)
?
2
:
8
);
lua_pushnumber
(
L
,
ri
->
epc2
);
for
(
i
=
0
;
i
<
n
;
++
i
)
lua_pushnumber
(
L
,
ri
->
epc3
);
lua_pushinteger
(
L
,
arr
[
i
]);
lua_pushnumber
(
L
,
ri
->
excvaddr
);
return
n
;
lua_pushnumber
(
L
,
ri
->
depc
);
return
8
;
}
else
return
2
;
}
}
// Lua: restore()
// Lua: restore()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment