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
3b9ef17d
Commit
3b9ef17d
authored
May 12, 2024
by
Jade Mattsson
Committed by
Jade Mattsson
May 21, 2024
Browse files
Added node.chipmodel().
Updated and removed incorrect node module documentation.
parent
3203eba8
Changes
2
Show whitespace changes
Inline
Side-by-side
components/modules/node.c
View file @
3b9ef17d
...
@@ -174,6 +174,13 @@ static int node_chipid( lua_State *L )
...
@@ -174,6 +174,13 @@ static int node_chipid( lua_State *L )
}
}
#endif
#endif
// Lua: node.chipmodel()
static
int
node_chipmodel
(
lua_State
*
L
)
{
lua_pushstring
(
L
,
CONFIG_IDF_TARGET
);
return
1
;
}
// Lua: node.heap()
// Lua: node.heap()
static
int
node_heap
(
lua_State
*
L
)
static
int
node_heap
(
lua_State
*
L
)
{
{
...
@@ -868,6 +875,7 @@ LROT_BEGIN(node, NULL, 0)
...
@@ -868,6 +875,7 @@ LROT_BEGIN(node, NULL, 0)
#if defined(CONFIG_IDF_TARGET_ESP32)
#if defined(CONFIG_IDF_TARGET_ESP32)
LROT_FUNCENTRY
(
chipid
,
node_chipid
)
LROT_FUNCENTRY
(
chipid
,
node_chipid
)
#endif
#endif
LROT_FUNCENTRY
(
chipmodel
,
node_chipmodel
)
LROT_FUNCENTRY
(
compile
,
node_compile
)
LROT_FUNCENTRY
(
compile
,
node_compile
)
LROT_FUNCENTRY
(
dsleep
,
node_dsleep
)
LROT_FUNCENTRY
(
dsleep
,
node_dsleep
)
#if defined(CONFIG_LUA_VERSION_51)
#if defined(CONFIG_LUA_VERSION_51)
...
...
docs/modules/node.md
View file @
3b9ef17d
...
@@ -71,7 +71,7 @@ if reset_reason == 0 then print("Power UP!") end
...
@@ -71,7 +71,7 @@ if reset_reason == 0 then print("Power UP!") end
## node.chipid()
## node.chipid()
Returns the ESP chip ID.
Returns the ESP chip ID.
Only available on the base ESP32 model.
#### Syntax
#### Syntax
`node.chipid()`
`node.chipid()`
...
@@ -85,6 +85,19 @@ chip ID (string)
...
@@ -85,6 +85,19 @@ chip ID (string)
Note that due to the chip id being a much larger value on the ESP32, it is
Note that due to the chip id being a much larger value on the ESP32, it is
reported as a string now. E.g.
`"0x1818fe346a88"`
.
reported as a string now. E.g.
`"0x1818fe346a88"`
.
## node.chipmodel()
Returns the model of the ESP chip.
#### Syntax
`node.chipmodel()`
#### Parameters
none
#### Returns
The chip model as a string, e.g. "esp32c3". This is the string corresponding to the IDF's Kconfig parameter
`IDF_TARGET`
.
## node.compile()
## node.compile()
Compiles a Lua text file into Lua bytecode, and saves it as .lc file.
Compiles a Lua text file into Lua bytecode, and saves it as .lc file.
...
@@ -153,20 +166,6 @@ node.dsleep({ gpio = 13, level = 0, pull = true })
...
@@ -153,20 +166,6 @@ node.dsleep({ gpio = 13, level = 0, pull = true })
-
[
`node.sleep()`
](
#nodesleep
)
-
[
`node.sleep()`
](
#nodesleep
)
## node.flashid()
Returns the flash chip ID.
#### Syntax
`node.flashid()`
#### Parameters
none
#### Returns
flash ID (number)
## node.flashindex() --deprecated
## node.flashindex() --deprecated
Deprecated synonym for
[
`node.LFS.get()`
](
#nodelfsget
)
to return an LFS function reference.
Deprecated synonym for
[
`node.LFS.get()`
](
#nodelfsget
)
to return an LFS function reference.
...
@@ -191,31 +190,6 @@ none
...
@@ -191,31 +190,6 @@ none
#### Returns
#### Returns
system heap size left in bytes (number)
system heap size left in bytes (number)
## node.info()
Returns NodeMCU version, chipid, flashid, flash size, flash mode, flash speed.
#### Syntax
`node.info()`
#### Parameters
none
#### Returns
-
`majorVer`
(number)
-
`minorVer`
(number)
-
`devVer`
(number)
-
`chipid`
(number)
-
`flashid`
(number)
-
`flashsize`
(number)
-
`flashmode`
(number)
-
`flashspeed`
(number)
#### Example
```
lua
majorVer
,
minorVer
,
devVer
,
chipid
,
flashid
,
flashsize
,
flashmode
,
flashspeed
=
node
.
info
()
print
(
"NodeMCU "
..
majorVer
..
"."
..
minorVer
..
"."
..
devVer
)
```
## node.input()
## node.input()
...
...
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