being slightly annoyed by the quite slow and error-prone way of downloading files and code to the ESP using the serial port, I've written a quicker and easier way to load code onto the ESP modules.
The library basically consists of two files, http.lua and httpDL.lua.
httpDL.lua allows you to download files to the internal filesystem of the module,
http.lua allows you to get the returned data from a HTTP-get-Request as a string. Also it has the ability to send an array of key->value data to the server.
I have included some sample code on my GitHub Repository:
https://github.com/Manawyrm/ESP8266-HTTP
For downloading code to the ESP module I have written a small function which I put into my init.lua:
function download(filename)
tmr.wdclr()
httpDL = require("httpDL")
collectgarbage()
httpDL.download("10.4.0.5", 80, "/api/esp8266/lichtTreppe/"..filename, filename, function (payload)
print("OK.")
end)
httpDL = nil
package.loaded["httpDL"]=nil
collectgarbage()
end
It basically allows you to download a file with a specified name by just calling download("filename.lua") in the console.
Please test the lib and let me know how it works for you.
So long,
Tobias