-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit_safe.lua
30 lines (29 loc) · 909 Bytes
/
init_safe.lua
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
30
--init
--node.setcpufreq(node.CPU80MHZ) -- 'node.CPU80MHZ|node.CPU160MHZ'
boot_status=file.exists("boot_status.lua")
node_version="driot"
--for m_srv.lua and init_var_xxx.lua
m={}
pl=""
function normal()
print("boot status set to normal")
file.open("boot_status.lua", "w")
file.write(1)
file.close()
end
if (boot_status~=true)then
if file.exists("m_recovery.lc") then dofile("m_recovery.lc") end
else
file.remove("boot_status.lua")
if file.exists("m_srv.lc") then dofile("m_srv.lc") end
if file.exists("m_client.lc") then dofile("m_client.lc") end
if file.exists("init_var.lc") then dofile("init_var.lc") set_modules() init_modules() set_modules,init_modules=nil,nil end
init_tmr=tmr.create()
tmr.register(init_tmr, 500, tmr.ALARM_SINGLE, function ()
normal()
--init_tmr=nil
end)
tmr.start(init_tmr)
end
--print(node.heap())
--print(boot_status)