Move the complete logic of the http server into webserver.lua

This commit is contained in:
Ollo 2021-02-07 17:51:57 +01:00
parent 716b31303f
commit fbbecd0b6d
3 changed files with 27 additions and 25 deletions

View File

@ -45,6 +45,10 @@ function mydofile(mod)
dofile( mod .. ".lua") dofile( mod .. ".lua")
elseif (file.open(mod .. ".lc")) then elseif (file.open(mod .. ".lc")) then
dofile(mod .. ".lc") dofile(mod .. ".lc")
elseif (file.open(mod .. "_diet.lc")) then
dofile(mod .. "_diet.lc")
elseif (file.open(mod .. "_diet.lua")) then
dofile(mod .. "_diet.lua")
elseif (file.open(mod)) then elseif (file.open(mod)) then
dofile(mod) dofile(mod)
else else
@ -62,7 +66,7 @@ initTimer:register(5000, tmr.ALARM_SINGLE, function (t)
(file.open("timecore.lua")) or (file.open("timecore.lua")) or
(file.open("wordclock.lua")) or (file.open("wordclock.lua")) or
(file.open("displayword.lua")) or (file.open("displayword.lua")) or
(file.open("websrv_diet.lua")) or (file.open("webserver.lua")) or
(file.open("mqtt.lua")) or (file.open("mqtt.lua")) or
(file.open("ds18b20.lua")) or (file.open("ds18b20.lua")) or
(file.open("telnet.lua")) (file.open("telnet.lua"))
@ -83,7 +87,7 @@ initTimer:register(5000, tmr.ALARM_SINGLE, function (t)
dofile("config.lua") dofile("config.lua")
normalOperation() normalOperation()
else else
mydofile("websrv_diet") mydofile("webserver")
-- Logic for inital setup -- Logic for inital setup
startSetupMode() startSetupMode()
end end

View File

@ -26,7 +26,7 @@ if [ $# -eq 0 ]; then
fi fi
if [ $# -eq 1 ]; then if [ $# -eq 1 ]; then
FILES="displayword.lua main.lua timecore.lua webpage.html websrv_diet.lua telnet.lua wordclock.lua init.lua" FILES="displayword.lua main.lua timecore.lua webpage.html webserver_diet.lua telnet.lua wordclock.lua init.lua"
else else
FILES=$2 FILES=$2
fi fi

View File

@ -292,7 +292,6 @@ function startWebServer()
end end
function startSetupMode()
-- start the webserver module -- start the webserver module
collectgarbage() collectgarbage()
wifi.setmode(wifi.SOFTAP) wifi.setmode(wifi.SOFTAP)
@ -314,4 +313,3 @@ function startSetupMode()
print("Please visit 192.168.4.1") print("Please visit 192.168.4.1")
startWebServer() startWebServer()
collectgarbage() collectgarbage()
end