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
06666a78
Commit
06666a78
authored
Jul 22, 2019
by
Gregor
Browse files
using lua_setfield now
parent
5fafa637
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/node.c
View file @
06666a78
...
@@ -127,64 +127,48 @@ static int node_info( lua_State* L )
...
@@ -127,64 +127,48 @@ static int node_info( lua_State* L )
case
0
:
{
// hw
case
0
:
{
// hw
lua_createtable
(
L
,
0
,
5
);
lua_createtable
(
L
,
0
,
5
);
int
table_index
=
lua_gettop
(
L
);
int
table_index
=
lua_gettop
(
L
);
lua_pushliteral
(
L
,
"chip_id"
);
lua_pushinteger
(
L
,
system_get_chip_id
());
// chip id
lua_pushinteger
(
L
,
system_get_chip_id
());
// chip id
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"chip_id"
);
lua_pushliteral
(
L
,
"flash_id"
);
lua_pushinteger
(
L
,
spi_flash_get_id
());
// flash id
lua_pushinteger
(
L
,
spi_flash_get_id
());
// flash id
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"flash_id"
);
lua_pushliteral
(
L
,
"flash_size"
);
lua_pushinteger
(
L
,
flash_rom_get_size_byte
()
/
1024
);
// flash size in KB
lua_pushinteger
(
L
,
flash_rom_get_size_byte
()
/
1024
);
// flash size in KB
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"flash_size"
);
lua_pushliteral
(
L
,
"flash_mode"
);
lua_pushinteger
(
L
,
flash_rom_get_mode
());
lua_pushinteger
(
L
,
flash_rom_get_mode
());
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"flash_mode"
);
lua_pushliteral
(
L
,
"flash_speed"
);
lua_pushinteger
(
L
,
flash_rom_get_speed
());
lua_pushinteger
(
L
,
flash_rom_get_speed
());
lua_set
table
(
L
,
table_index
);
lua_set
field
(
L
,
table_index
,
"flash_speed"
);
return
1
;
return
1
;
}
}
case
1
:
{
// sw_version
case
1
:
{
// sw_version
lua_createtable
(
L
,
0
,
7
);
lua_createtable
(
L
,
0
,
7
);
int
table_index
=
lua_gettop
(
L
);
int
table_index
=
lua_gettop
(
L
);
lua_pushliteral
(
L
,
"node_version_major"
);
lua_pushinteger
(
L
,
NODE_VERSION_MAJOR
);
lua_pushinteger
(
L
,
NODE_VERSION_MAJOR
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"node_version_major"
);
lua_pushliteral
(
L
,
"node_version_minor"
);
lua_pushinteger
(
L
,
NODE_VERSION_MINOR
);
lua_pushinteger
(
L
,
NODE_VERSION_MINOR
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"node_version_minor"
);
lua_pushliteral
(
L
,
"node_version_revision"
);
lua_pushinteger
(
L
,
NODE_VERSION_REVISION
);
lua_pushinteger
(
L
,
NODE_VERSION_REVISION
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"node_version_revision"
);
lua_pushliteral
(
L
,
"git_branch"
);
lua_pushstring
(
L
,
BUILDINFO_BRANCH
);
lua_pushstring
(
L
,
BUILDINFO_BRANCH
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"git_branch"
);
lua_pushliteral
(
L
,
"git_commit_id"
);
lua_pushstring
(
L
,
BUILDINFO_COMMIT_ID
);
lua_pushstring
(
L
,
BUILDINFO_COMMIT_ID
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"git_commit_id"
);
lua_pushliteral
(
L
,
"git_release"
);
lua_pushstring
(
L
,
BUILDINFO_RELEASE
);
lua_pushstring
(
L
,
BUILDINFO_RELEASE
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"git_release"
);
lua_pushliteral
(
L
,
"git_commit_dts"
);
lua_pushstring
(
L
,
BUILDINFO_RELEASE_DTS
);
lua_pushstring
(
L
,
BUILDINFO_RELEASE_DTS
);
lua_set
table
(
L
,
table_index
);
lua_set
field
(
L
,
table_index
,
"git_commit_dts"
);
return
1
;
return
1
;
}
}
case
2
:
{
// build_config
case
2
:
{
// build_config
lua_createtable
(
L
,
0
,
4
);
lua_createtable
(
L
,
0
,
4
);
int
table_index
=
lua_gettop
(
L
);
int
table_index
=
lua_gettop
(
L
);
lua_pushliteral
(
L
,
"ssl"
);
lua_pushboolean
(
L
,
BUILDINFO_SSL
);
lua_pushboolean
(
L
,
BUILDINFO_SSL
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"ssl"
);
lua_pushliteral
(
L
,
"lfs_size"
);
lua_pushnumber
(
L
,
BUILDINFO_LFS
);
lua_pushnumber
(
L
,
BUILDINFO_LFS
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"lfs_size"
);
lua_pushliteral
(
L
,
"modules"
);
lua_pushstring
(
L
,
BUILDINFO_MODULES
);
lua_pushstring
(
L
,
BUILDINFO_MODULES
);
lua_settable
(
L
,
table_index
);
lua_setfield
(
L
,
table_index
,
"modules"
);
lua_pushliteral
(
L
,
"number_type"
);
lua_pushstring
(
L
,
BUILDINFO_BUILD_TYPE
);
lua_pushstring
(
L
,
BUILDINFO_BUILD_TYPE
);
lua_set
table
(
L
,
table_index
);
lua_set
field
(
L
,
table_index
,
"number_type"
);
return
1
;
return
1
;
}
}
default:
default:
...
...
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