Current Lua downloadable firmware will be posted here

User avatar
By zeroday
#2604
gerardwr wrote:
zeroday wrote:
Sorry for my misunderstanding, A simple IDE with lua editor and serial console is under development.


No problem, thanks for your reaction.

If you are working on an IDE that means that there is a function in the firmware that allows the uploading of a text file to a lua file on the ESP.

I'm quite happy to use my own editor for editing the lua scripts on my PC, I now just need a way to upload.

Can you please share information on the upload facility in the current firmware with us, or is that a secret?


Thank you for your understanding, the so called IDE is as simple as a serial console plus an editor.
A tool/script read a file(say init.lua) line by line. and send the line to serial with
Code: Select allfile.write([[line text here]]).

example: init.lua has this(in your pc)
Code: Select allprint("hello world")

then the tool read from init.lua, found this line
Code: Select allprint("hello world")

it will send some thing to serial like this:
Code: Select allfile.open("init.lua","w")

Code: Select allfile.write([[print("hello world")]])

Code: Select allfile.close()


there is no black magic, ide just do this automatically for you.
if you are know some language can open a serial and communicate with it, you can write your "IDE".
just make sure do not write to serial too fast, wait for the coming back prompt '>'.
User avatar
By cendev
#2606 posted a small python script that can upload code via command line for linux like

python upload.py filenameonesp filenameonpc ip 8888

now coding a c# project, can list files, can read files and can upload files :) also can send commands :)

planning to add an interrupt for gpio0 to start the server, so when you push the button you get into scriptloader mode :) after download, will restart and close the server used for uploading :)

mostly done :)

but no experiance on mac
User avatar
By zeroday
#2607
xinort wrote:I'm not sure if this is the best place to ask this but I'm using the lua web server and running into a problem. I can connect but only 2 times before I get a MAX_SOCKET error. I can't figure out how to release the socket after sending the data. I've tried conn:close() but no joy. This is the lua script I'm trying to use:

Code: Select allsrv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print(payload)
door="open"
if gpio.read(8)==1 then door="open" else door="closed" end
conn:send("<h1> Door Sensor. The door is " .. door ..".</h1>")
conn:close()
end)
end)


MAX_SOCKET is 5.
A connection will closed in 180 seconds if it's inactive.
I will do more test on net module to find out why conn:close() doesn't work.
My experience is a Chrome will initiate 3 or 4 connections to host, if click on "refresh" too fast, the MAX_SOCKET is reached easily.