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
04a5e674
Commit
04a5e674
authored
Dec 31, 2014
by
funshine
Browse files
add node.info() to get version, chipid, flash info
parent
2553795b
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/include/user_config.h
View file @
04a5e674
#ifndef __USER_CONFIG_H__
#ifndef __USER_CONFIG_H__
#define __USER_CONFIG_H__
#define __USER_CONFIG_H__
#define NODE_VERSION_MAJOR 0U
#define NODE_VERSION_MINOR 9U
#define NODE_VERSION_REVISION 4U
#define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION "NodeMcu 0.9.4"
#define NODE_VERSION "NodeMcu 0.9.4"
#define BUILD_DATE "build 20141230"
#define BUILD_DATE "build 20141230"
// #define FLASH_512K
// #define FLASH_512K
...
...
app/modules/node.c
View file @
04a5e674
...
@@ -32,6 +32,20 @@ static int ICACHE_FLASH_ATTR node_deepsleep( lua_State* L )
...
@@ -32,6 +32,20 @@ static int ICACHE_FLASH_ATTR node_deepsleep( lua_State* L )
return
0
;
return
0
;
}
}
// Lua: info()
static
int
ICACHE_FLASH_ATTR
node_info
(
lua_State
*
L
)
{
lua_pushinteger
(
L
,
NODE_VERSION_MAJOR
);
lua_pushinteger
(
L
,
NODE_VERSION_MINOR
);
lua_pushinteger
(
L
,
NODE_VERSION_REVISION
);
lua_pushinteger
(
L
,
system_get_chip_id
());
// chip id
lua_pushinteger
(
L
,
spi_flash_get_id
());
// flash id
lua_pushinteger
(
L
,
flash_get_size_byte
()
/
1024
);
// flash size in KB
lua_pushinteger
(
L
,
flash_get_mode
());
lua_pushinteger
(
L
,
flash_get_speed
());
return
8
;
}
// Lua: chipid()
// Lua: chipid()
static
int
ICACHE_FLASH_ATTR
node_chipid
(
lua_State
*
L
)
static
int
ICACHE_FLASH_ATTR
node_chipid
(
lua_State
*
L
)
{
{
...
@@ -264,6 +278,7 @@ const LUA_REG_TYPE node_map[] =
...
@@ -264,6 +278,7 @@ const LUA_REG_TYPE node_map[] =
{
{
{
LSTRKEY
(
"restart"
),
LFUNCVAL
(
node_restart
)
},
{
LSTRKEY
(
"restart"
),
LFUNCVAL
(
node_restart
)
},
{
LSTRKEY
(
"dsleep"
),
LFUNCVAL
(
node_deepsleep
)
},
{
LSTRKEY
(
"dsleep"
),
LFUNCVAL
(
node_deepsleep
)
},
{
LSTRKEY
(
"info"
),
LFUNCVAL
(
node_info
)
},
{
LSTRKEY
(
"chipid"
),
LFUNCVAL
(
node_chipid
)
},
{
LSTRKEY
(
"chipid"
),
LFUNCVAL
(
node_chipid
)
},
{
LSTRKEY
(
"flashid"
),
LFUNCVAL
(
node_flashid
)
},
{
LSTRKEY
(
"flashid"
),
LFUNCVAL
(
node_flashid
)
},
{
LSTRKEY
(
"flashsize"
),
LFUNCVAL
(
node_flashsize
)
},
{
LSTRKEY
(
"flashsize"
),
LFUNCVAL
(
node_flashsize
)
},
...
...
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