-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathinit.lua
More file actions
29 lines (25 loc) · 713 Bytes
/
init.lua
File metadata and controls
29 lines (25 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- check/flash/use LFS support, if possible
if node.getpartitiontable().lfs_size > 0 then
if file.exists("lfs.img") then
if file.exists("lfs_lock") then
file.remove("lfs_lock")
file.remove("lfs.img")
else
local f = file.open("lfs_lock", "w")
f:flush()
f:close()
file.remove("httpserver-compile.lua")
node.LFS.reload("lfs.img")
end
end
pcall(node.flashindex("_init"))
end
-- Compile freshly uploaded nodemcu-httpserver lua files.
if file.exists("httpserver-compile.lua") then
dofile("httpserver-compile.lua")
file.remove("httpserver-compile.lua")
end
-- Set up NodeMCU's WiFi
dofile("httpserver-wifi.lc")
-- Start nodemcu-httpsertver
dofile("httpserver-init.lc")