Left here for archival purposes.

User avatar
By ThomasW
#3227
scargill wrote:>> elseif pl=="YES3\n" then l3="1\n" c:send("OK\n")
>> elseif pl=="NO3\n" then l3="0\n" c:send("OK\n")
>> elseif pl=="YES4\n" then l4="1\n" c:send("OK\n")
c_GORSvf.SzfJSzfn
Pete's LUA module 0.1
NodeMcu 0.9.2 build 20141124 powered by Lua 5.1.4
>
Loading functions
Connecting
Connected to.loft-east.IP:.192.168.0.22
OK
This is a trivial example - yet as you can see, the interpreter is giving up before the final command - and once again rebooting.


Just a guess - the commandline interpreter in the module probably has limited resources/stack and bails out on those elseif's. Uploading the same code to a file and then executing it with "dofile()" works just fine.

Thomas
User avatar
By ThomasW
#3228
zeroday wrote:when in server mode. the conn from listen() actually is connected already.
Code: Select allsrv:listen(80,function(conn)  end)

means:
Code: Select allsrv:on("connection",function(conn)  end)   --only MEANS this but can't execute.
srv:listen(80)

But I put this event in listen().


Ah ok, so the code for directly answering a connection goes there. Thanks for the clarification!

Thomas
User avatar
By scargill
#3229 ThomasW - great minds think alike - I've just seen your response and indeed the pesky lack of RAM situation was responsible - putting it in a file did the trick.

It would be nice however if the interpreter were able to simple say "Sorry, out of RAM" instead of crashing or rebooting". Also there may be a bug? Not sure about this one..

My line that says sv=net.createServer(net.TCP, 90)

that 90 isn't doing anything - if I shut my APP down for a few minutes (ie turn the phone off) nothing happens - no message to say the connection is closed or anything. If I then after minutes, turn the phone back on - it just continues as if it had never stopped (which I might add is a darn sight better than I got out of the AT command set with it's constant "busy s..." - so this is looking like it might be going somewhere.

If anyone looking in knows how, instead of those " then c:send(L1" statements I can have the unit wait at the serial for a little while for some input and send that, I would be eternally grateful - in this application it will be an Arduino being informed of those commands.... and doing something about them - and then firing a response almost immediately back at the board...

so if (pl=="GO1\n") then c:send(l1)

in English... needs to be

if pl=="GO1\n" then send that out of the serial, wait a bit - c:send the response.. and continue as before

So the other test elseifs are not needed. Thoughts?
User avatar
By alonewolfx2
#3230 module crash and join a bootloop when if i call removed lua file in the init.lua. is it issue? maybe it can say "cannot open xxxx.lua file".