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
52ca40b8
Commit
52ca40b8
authored
Mar 22, 2015
by
funshine
Browse files
add init.lua examples
parent
4332b21e
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/platform/flash_api.c
View file @
52ca40b8
...
...
@@ -369,8 +369,8 @@ bool flash_init_data_blank(void)
// It will init system config to blank!
bool
result
=
false
;
#if defined(FLASH_SAFE_API)
if
((
SPI_FLASH_RESULT_OK
==
flash_safe_erase_sector
((
flash_
rom
_get_sec_num
()
-
2
)))
&&
(
SPI_FLASH_RESULT_OK
==
flash_safe_erase_sector
((
flash_
rom
_get_sec_num
()
-
1
))))
if
((
SPI_FLASH_RESULT_OK
==
flash_safe_erase_sector
((
flash_
safe
_get_sec_num
()
-
2
)))
&&
(
SPI_FLASH_RESULT_OK
==
flash_safe_erase_sector
((
flash_
safe
_get_sec_num
()
-
1
))))
#else
if
((
SPI_FLASH_RESULT_OK
==
spi_flash_erase_sector
((
flash_rom_get_sec_num
()
-
2
)))
&&
(
SPI_FLASH_RESULT_OK
==
spi_flash_erase_sector
((
flash_rom_get_sec_num
()
-
1
))))
...
...
examples/init.lua
0 → 100644
View file @
52ca40b8
--init.lua, something like this
countdown
=
3
tmr
.
alarm
(
0
,
1000
,
1
,
function
()
print
(
countdown
)
countdown
=
countdown
-
1
if
countdown
<
1
then
tmr
.
stop
(
0
)
countdown
=
nil
local
s
,
err
if
file
.
open
(
"user.lc"
)
then
file
.
close
()
s
,
err
=
pcall
(
function
()
dofile
(
"user.lc"
)
end
)
else
s
,
err
=
pcall
(
function
()
dofile
(
"user.lua"
)
end
)
end
if
not
s
then
print
(
err
)
end
end
end
)
examples/user.lua
0 → 100644
View file @
52ca40b8
print
(
"hello NodeMCU"
)
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