Merge pull request #29 from borromeotlhs/patch-8

Update node_info.lua
This commit is contained in:
Marcos 2015-07-20 15:42:30 -05:00
commit 1d3cdaf1a7

View File

@ -1,6 +1,6 @@
local function sendHeader(connection)
connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nCache-Control: private, no-store\r\n\r\n")
end
local function sendAttr(connection, attr, val)
@ -10,9 +10,7 @@ end
return function (connection, args)
collectgarbage()
sendHeader(connection)
connection:send('<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>A Lua script sample</title></head>')
connection:send('<body>')
connection:send('<h1>Node info</h1>')
connection:send('<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>A Lua script sample</title></head><body><h1>Node info</h1><ul>')
majorVer, minorVer, devVer, chipid, flashid, flashsize, flashmode, flashspeed = node.info();
sendAttr(connection, "NodeMCU version" , majorVer.."."..minorVer.."."..devVer)
sendAttr(connection, "chipid" , chipid)
@ -24,6 +22,5 @@ return function (connection, args)
sendAttr(connection, 'Memory in use (KB)' , collectgarbage("count"))
sendAttr(connection, 'IP address' , wifi.sta.getip())
sendAttr(connection, 'MAC address' , wifi.sta.getmac())
connection:send('</ul>')
connection:send('</body></html>')
connection:send('</ul></body></html>')
end