Webserver is included into the autostart
This commit is contained in:
parent
3e5327447b
commit
fc8ddab368
28
main.lua
28
main.lua
@ -1,6 +1,20 @@
|
|||||||
-- Main Module
|
-- 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)
|
wifi.setmode(wifi.STATION)
|
||||||
|
if ( file.list()["config.lua"] ) then
|
||||||
dofile("config.lua")
|
dofile("config.lua")
|
||||||
|
else
|
||||||
|
startSetupMode()
|
||||||
|
end
|
||||||
dofile("timecore.lua")
|
dofile("timecore.lua")
|
||||||
dofile("wordclock.lua")
|
dofile("wordclock.lua")
|
||||||
dofile("displayword.lua")
|
dofile("displayword.lua")
|
||||||
@ -25,6 +39,12 @@ tmr.alarm(0, 500, 1, function()
|
|||||||
tmr.stop(0)
|
tmr.stop(0)
|
||||||
print('IP: ',wifi.sta.getip())
|
print('IP: ',wifi.sta.getip())
|
||||||
|
|
||||||
|
print("Start webserver...")
|
||||||
|
tmr.alarm(2, 2000, 0 ,function()
|
||||||
|
dofile("webserver.lua")
|
||||||
|
startWebServer()
|
||||||
|
end)
|
||||||
|
|
||||||
--ptbtime1.ptb.de
|
--ptbtime1.ptb.de
|
||||||
sntp.sync(sntpserverhostname,
|
sntp.sync(sntpserverhostname,
|
||||||
function(sec,usec,server)
|
function(sec,usec,server)
|
||||||
@ -37,13 +57,7 @@ tmr.alarm(0, 500, 1, function()
|
|||||||
end
|
end
|
||||||
-- when no wifi available, open an accesspoint and ask the user
|
-- when no wifi available, open an accesspoint and ask the user
|
||||||
if (connect_counter == 300) then -- 300 is 30 sec in 100ms cycle
|
if (connect_counter == 300) then -- 300 is 30 sec in 100ms cycle
|
||||||
tmr.stop(0)
|
startSetupmode()
|
||||||
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")
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user