-->
Page 42 of 53

Re: NodeMcu - A lua based firmware for esp8266 (build 20141

PostPosted: Thu Nov 20, 2014 11:34 pm
by zeroday
rrezaii wrote:
haven't test this with IOS app yet.
Note: put ap in 11b/g mode only, will not work in 11n or 11ac mode.
Code: Select allwifi.startsmart(6, callback())

should be
Code: Select allwifi.startsmart(6, callback)


Thanks. I'll try tonight, but the API documentation may need to be corrected as it requires the "()":

Code: Select allSyntax

wifi.startsmart(channel, function succeed_callback())

Parameters

channel: 1~13, startup channel for searching, if nil, default to 6. 20 seconds for each channel.
succeed_callback: callback function called after configuration, which is called when got password and connected to AP.

Returns

nil

Example

    wifi.startsmart(6, cb())


Thank you, it will be fixed soon.

Re: NodeMcu - A LUA based firmware for ESP8266 (build 20141

PostPosted: Thu Nov 20, 2014 11:40 pm
by zeroday
gorec2005 wrote:print(tmr.now()) realy uint32?
i see negative value - i't a bug or it's a feature? or i can't understand? :?


:oops:
It's a uint32 in C, but when put it into Lua, it becomes a Lua Number type.
negative means bigger than 0x80000000.
don't know how to convert to unsigned in lua yet :oops:

Re: NodeMcu - A LUA based firmware for ESP8266 (build 20141

PostPosted: Fri Nov 21, 2014 3:05 am
by scargill
So I did some more tests this morning.

Examples from here: https://github.com/nodemcu/nodemcu-firmware

The TELNET example does not work and results in the module resetting every time..

The Web page example looks exciting at first.. but I noticed the browser returned the result "Hello NodeMCU but was constantly busy... and as browsers do, it retries the page.. and after 5 retries, the ESP-01 resets. Here's the output I monitored on the serial.

So here is the power up sequence and my init file getting an address from the router - all of that works..

Pete's LUA module 0.1
NodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
> c_GORSvfJSz.JSzfn
Pete's LUA module 0.1
NodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
>
Loading functions
Connecting
Connected to.loft-east.IP:.192.168.0.22
OK


and then here is where I add in the web page example


> srv=net.createServer(net.TCP)
> srv:listen(80,function(conn)
>> conn:on("receive",function(conn,payload)
>> print(payload)
>> conn:send("<h1> Hello, NodeMcu.</h1>")
>> end)
>> end)
>


and then here is the result...

> GET / HTTP/1.1
Host: 192.168.0.22
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Linux; Android 5.0; Nexus 10 Build/LRX21P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.59 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6


but then wait... the browser of course gets the page again... and again. and....

GET / HTTP/1.1
Host: 192.168.0.22
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Linux; Android 5.0; Nexus 10 Build/LRX21P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.59 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6


PANIC: unprotected error in call to Lua API (attempt to call a nil value)
c_GORSvf
SzfJSzfn
Pete's LUA module 0.1
NodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
>
Loading functions
Connecting
Connected to.loft-east.IP:.192.168.0.22
OK

So a quick test suggests it works - but in fact after a few refreshes - the unprotected error occurs and the board resets.

Re: NodeMcu - A LUA based firmware for ESP8266 (build 20141

PostPosted: Fri Nov 21, 2014 3:09 am
by zeroday
Add a examples folder to git.
and the new repo address:
https://github.com/nodemcu/nodemcu-firmware

sorry for the inconvenience.