forked from marcoskirsch/nodemcu-httpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttpserver-wifi.lua
More file actions
31 lines (24 loc) · 790 Bytes
/
httpserver-wifi.lua
File metadata and controls
31 lines (24 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- httpserver-wifi.lua
-- Part of nodemcu-httpserver, configures NodeMCU's WiFI in boot.
-- Author: Marcos Kirsch
local conf = nil
if file.exists("httpserver-conf.lc") then
conf = dofile("httpserver-conf.lc")
else
conf = dofile("httpserver-conf.lua")
end
wifi.setmode(conf.wifi.mode)
if (conf.wifi.mode == wifi.SOFTAP) or (conf.wifi.mode == wifi.STATIONAP) then
print('AP MAC: ',wifi.ap.getmac())
wifi.ap.config(conf.wifi.accessPoint.config)
wifi.ap.setip(conf.wifi.accessPoint.net)
end
if (conf.wifi.mode == wifi.STATION) or (conf.wifi.mode == wifi.STATIONAP) then
print('Client MAC: ',wifi.sta.getmac())
wifi.sta.config(conf.wifi.station)
end
print('chip: ',node.chipid())
print('heap: ',node.heap())
conf = nil
collectgarbage()
-- End WiFi configuration