Webserver is included into the autostart

This commit is contained in:
ollo 2016-06-18 19:46:23 +02:00
parent 3e5327447b
commit fc8ddab368

View File

@ -1,6 +1,20 @@
-- Main Module
function startSetupMode()
tmr.stop(0)
dofile("webserver.lua")
wifi.setmode(wifi.SOFTAP)
wifi.ap.config({ssid='clock',pwd='clock'})
print("Waiting in access point >clock< for Clients")
print("Please visit 192.168.4.1")
startWebServer()
end
wifi.setmode(wifi.STATION)
if ( file.list()["config.lua"] ) then
dofile("config.lua")
else
startSetupMode()
end
dofile("timecore.lua")
dofile("wordclock.lua")
dofile("displayword.lua")
@ -25,6 +39,12 @@ tmr.alarm(0, 500, 1, function()
tmr.stop(0)
print('IP: ',wifi.sta.getip())
print("Start webserver...")
tmr.alarm(2, 2000, 0 ,function()
dofile("webserver.lua")
startWebServer()
end)
--ptbtime1.ptb.de
sntp.sync(sntpserverhostname,
function(sec,usec,server)
@ -37,13 +57,7 @@ tmr.alarm(0, 500, 1, function()
end
-- when no wifi available, open an accesspoint and ask the user
if (connect_counter == 300) then -- 300 is 30 sec in 100ms cycle
tmr.stop(0)
wifi.setmode(wifi.SOFTAP)
wifi.ap.config({ssid='clock',pwd='clock'})
print("Waiting in access point >clock< for Clients")
print("Please visit 192.168.4.1")
dofile("webserver.lua")
startSetupmode()
end
end)