Update init.lua

This commit is contained in:
Artem Pastukhov 2015-04-02 15:32:33 +03:00
parent 5301792d16
commit 11d1f96351

View File

@ -1,22 +1,15 @@
-- Tel--l the chip to connect to the access point
--wifi.setmode(wifi.STATIONAP)
wifi.setmode(wifi.STATION) wifi.setmode(wifi.STATION)
print('set (mode='..wifi.getmode()..')') print('set (mode='..wifi.getmode()..')')
print('MAC: ',wifi.sta.getmac()) print('MAC: ',wifi.sta.getmac())
print('chip: ',node.chipid()) print('chip: ',node.chipid())
print('heap: ',node.heap()) print('heap: ',node.heap())
<<<<<<< HEAD
local joincounter = 0
cfg={} cfg={}
cfg.ssid="ESP-"..node.chipid() cfg.ssid="ESP-"..node.chipid()
cfg.pwd="ESP-"..node.chipid() cfg.pwd="ESP-"..node.chipid()
wifi.ap.config(cfg) wifi.ap.config(cfg)
cfg = nil cfg = nil
=======
wifi.sta.config("Kirsch Extreme","1151511515")
>>>>>>> parent of 4989410... Update init.lua
-- Compile server code and remove original .lua files. -- Compile server code and remove original .lua files.
-- This only happens the first time afer the .lua files are uploaded. -- This only happens the first time afer the .lua files are uploaded.
@ -29,7 +22,7 @@ local compileAndRemoveIfNeeded = function(f)
end end
end end
local serverFiles = {'httpserver.lua', 'httpserver-request.lua', 'httpserver-static.lua', 'httpserver-error.lua','http/ual.lua'} local serverFiles = {'httpserver.lua', 'httpserver-request.lua', 'httpserver-static.lua', 'httpserver-error.lua'}
for i, f in ipairs(serverFiles) do compileAndRemoveIfNeeded(f) end for i, f in ipairs(serverFiles) do compileAndRemoveIfNeeded(f) end
compileAndRemoveIfNeeded = nil compileAndRemoveIfNeeded = nil
@ -37,6 +30,9 @@ serverFiles = nil
-- Connect to the WiFi access point. Once the device is connected, -- Connect to the WiFi access point. Once the device is connected,
-- you may start the HTTP server. -- you may start the HTTP server.
local joincounter = 0
tmr.alarm(0, 3000, 1, function() tmr.alarm(0, 3000, 1, function()
if wifi.sta.getip() == nil and joincounter < 5 then if wifi.sta.getip() == nil and joincounter < 5 then