Unload all functions, not necessary for the webserver
This commit is contained in:
parent
883adb671c
commit
b4e8eec9bf
@ -135,31 +135,45 @@ function startWebServer()
|
|||||||
|
|
||||||
|
|
||||||
if (payload:find("GET /") ~= nil) then
|
if (payload:find("GET /") ~= nil) then
|
||||||
httpSending=true
|
httpSending=true
|
||||||
--here is code for handling http request from a web-browser
|
--here is code for handling http request from a web-browser
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
-- Stop all
|
-- Stop all
|
||||||
for i=0,5 do tmr.stop(i) end
|
for i=0,5 do tmr.stop(i) end
|
||||||
-- unload all other modules
|
-- unload all other functions
|
||||||
package.loaded['displayword.lc']=nil
|
-- grep function *.lua | grep -v webserver | cut -f 2 -d ':' | grep "^function" | sed "s/function //g" | grep -o "^[a-zA-Z0-9\_]*"
|
||||||
package.loaded['main.lc']=nil
|
updateColor = nil
|
||||||
package.loaded['wordclock']=nil
|
drawLEDs = nil
|
||||||
|
round = nil
|
||||||
|
generateLEDs = nil
|
||||||
|
startSetupMode = nil
|
||||||
|
syncTimeFromInternet = nil
|
||||||
|
displayTime = nil
|
||||||
|
normalOperation = nil
|
||||||
|
isSummerTime = nil
|
||||||
|
getUTCtime = nil
|
||||||
|
getTime = nil
|
||||||
|
display_timestat = nil
|
||||||
|
display_countcharacters_de = nil
|
||||||
|
display_countwords_de = nil
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
ws2812.write(string.char(0,0,0):rep(56) .. color:rep(2) .. string.char(0,0,0):rep(4) .. color:rep(2) .. string.char(0,0,0):rep(48))
|
ws2812.write(string.char(0,0,0):rep(56) .. color:rep(2) .. string.char(0,0,0):rep(4) .. color:rep(2) .. string.char(0,0,0):rep(48))
|
||||||
-- Start Time after 1 minute
|
-- Start Time after 1 minute
|
||||||
tmr.alarm(6, 60000, 0 ,function()
|
tmr.alarm(5, 60000, 0 ,function()
|
||||||
-- Start the time Thread
|
-- Start the time Thread
|
||||||
tmr.alarm(1, 20000, 1 ,function()
|
tmr.alarm(1, 20000, 1 ,function()
|
||||||
dofile("main.lc")
|
dofile("main.lc")
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
if (sendPage ~= nil) then
|
-- send response after 100ms
|
||||||
print("Sending webpage.html (" .. tostring(node.heap()) .. "B free) ...")
|
tmr.alarm(5, 100, 0 ,function()
|
||||||
-- Load the sendPagewebcontent
|
if (sendPage ~= nil) then
|
||||||
replaceMap=fillDynamicMap()
|
print("Sending webpage.html (" .. tostring(node.heap()) .. "B free) ...")
|
||||||
sendPage(conn, "webpage.html", replaceMap)
|
-- Load the sendPagewebcontent
|
||||||
end
|
replaceMap=fillDynamicMap()
|
||||||
|
sendPage(conn, "webpage.html", replaceMap)
|
||||||
|
end
|
||||||
|
end)
|
||||||
else if (payload:find("POST /") ~=nil) then
|
else if (payload:find("POST /") ~=nil) then
|
||||||
--code for handling the POST-request (updating settings)
|
--code for handling the POST-request (updating settings)
|
||||||
_, postdatastart = payload:find("\r\n\r\n")
|
_, postdatastart = payload:find("\r\n\r\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user