add init.lua examples
This commit is contained in:
parent
4332b21ef3
commit
52ca40b8ea
|
@ -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))))
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
--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)
|
|
@ -0,0 +1 @@
|
|||
print("hello NodeMCU")
|
Loading…
Reference in New Issue