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")
elseif (file.open(mod .. ".lc")) then
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
dofile(mod)
else
@ -62,7 +66,7 @@ initTimer:register(5000, tmr.ALARM_SINGLE, function (t)
(file.open("timecore.lua")) or
(file.open("wordclock.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("ds18b20.lua")) or
(file.open("telnet.lua"))
@ -83,7 +87,7 @@ initTimer:register(5000, tmr.ALARM_SINGLE, function (t)
dofile("config.lua")
normalOperation()
else
mydofile("websrv_diet")
mydofile("webserver")
-- Logic for inital setup
startSetupMode()
end

View File

@ -26,7 +26,7 @@ if [ $# -eq 0 ]; then
fi
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
FILES=$2
fi

View File

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