More cleanup before starting the webserver
This commit is contained in:
parent
1755c9ef5a
commit
f440ccf684
7
main.lua
7
main.lua
@ -240,7 +240,11 @@ local btnCounter=0
|
|||||||
local btntimer = tmr.create()
|
local btntimer = tmr.create()
|
||||||
btntimer:register(500, tmr.ALARM_AUTO, function (t)
|
btntimer:register(500, tmr.ALARM_AUTO, function (t)
|
||||||
if (gpio.read(3) == 0) then
|
if (gpio.read(3) == 0) then
|
||||||
|
-- stop the main loop
|
||||||
|
if (mlt ~= nil) then
|
||||||
mlt:unregister()
|
mlt:unregister()
|
||||||
|
mlt = nil
|
||||||
|
end
|
||||||
print("Button pressed " .. tostring(btnCounter))
|
print("Button pressed " .. tostring(btnCounter))
|
||||||
btnCounter = btnCounter + 5
|
btnCounter = btnCounter + 5
|
||||||
|
|
||||||
@ -255,8 +259,9 @@ btntimer:register(500, tmr.ALARM_AUTO, function (t)
|
|||||||
file.remove("config.lc")
|
file.remove("config.lc")
|
||||||
node.restart()
|
node.restart()
|
||||||
elseif (btnCounter == 10) then
|
elseif (btnCounter == 10) then
|
||||||
-- start the webserver module
|
collectgarbage()
|
||||||
mydofile("webserver")
|
mydofile("webserver")
|
||||||
|
-- start the webserver module
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user