Current Lua downloadable firmware will be posted here

User avatar
By zeroday
#2959
scargill wrote:Ernie - I don't agree. That is a function call - I don't think there should be a space where you suggest. If it IS necessary surely that's a bug?

All -

I've done some more tests.

In each case I am blowing the BLANK file and then the nodemcu_512k.bin file just to be sure.

In each case after doing this.. If I send the file below to the unit.. it works... BUT the delay is too short to show the IP address.

When I say WORKS I mean one initial message and one run of the code.

There are TWO things wrong.

Firstly If I then RELOAD the file - subsequent powerup goes wrong - there is something wrong with your file.remove() command
Secondly if I try to change the time delay HERE...

file.writeline([[wifi.sta.config(ssid,pw)]])
file.writeline([[tmr.delay(500000)]])

from half a seconds to 2 seconds....

EITHER by making it longer OR using it 4 times..

i.e.

file.writeline([[wifi.sta.config(ssid,pw)]])
file.writeline([[tmr.delay(2000000)]])

or

file.writeline([[wifi.sta.config(ssid,pw)]])
file.writeline([[tmr.delay(500000)]])
file.writeline([[tmr.delay(500000)]])
file.writeline([[tmr.delay(500000)]])
file.writeline([[tmr.delay(500000)]])

Either way this FAILS and the unit ends up in a loop - Am I right in guessing this is some kind of WATCHDOG issue?

Is it possible to fix these two issues - we are SO CLOSE!!




file.remove("init.lua")
file.open("init.lua","w")
file.writeline([[print("Petes Tester 4")]])
file.writeline([[tmr.alarm(15000, 0, function() dofile("thelot.lua") end )]])
file.close()
file.remove("thelot.lua")
file.open("thelot.lua","w")
file.writeline([[print("Stopping timer")]])
file.writeline([[tmr.stop()]])
file.writeline([[tmr.delay(500000)]])
file.writeline([[print("creating function")]])
file.writeline([[connecttoap = function (ssid,pw)]])
file.writeline([[print(wifi.sta.getip())]])
file.writeline([[wifi.setmode(wifi.STATION)]])
file.writeline([[tmr.delay(500000)]])
file.writeline([[wifi.sta.config(ssid,pw)]])
file.writeline([[tmr.delay(500000)]])
file.writeline([[print("Connected to ",ssid," as ",wifi.sta.getip())]])
file.writeline([[end]])
file.writeline([[print("Running function")]])
file.writeline([[connecttoap("loft-east","1921681974")]])
file.writeline([[print("Done")]])
file.close()


I've made contact with the chip manufacturer Espressif.
the tmr.delay() issue is caused by watchdog, and so is the long time loop issue.
since Espressif doesn't offer function to init/disable/enable watchdog in SDK, there is little we can do.
they do give me a method to clear the watchdog count.
I have tested it by separate delay time into several 1-second, it worked.
when I delay more than 3 seconds(say 5s), no hardware reset caused,
but a "beacon timeout" occurred, the chip lose connection to AP, and will reconnect to AP, obtain a IP using DHCP, again.
if you have a tcp connection, it will disconnect.
and there is no function to deal with "beacon timer" neither.
Anyway, it's better than hardware reset.
I will release a update soon, fix tmr.delay(), and may add a tmr.wdclr() or something.
User avatar
By rrezaii
#2960
zeroday wrote:
rrezaii wrote:Is there support for WPS (wifi protected security). The module itself supports it according to the data sheet. It'd be great if NodeMcu provides support for it. Any plans ?

ESP8266 sdk have no api for WPS.
but it provide a way to sniffer.
so nodemcu have a way to get wifi config like cc3000.
Code: Select allwifi.startsmart()

will start sniffer for ssid and password.
use the android app same as cc3000.
no crypt supported.
not work in 11n, only work in 11b/g.


That's fantastic!
I tried to use TI's iOS app to configure wifi credentials for esp8266 device using the following script on the esp8266.


Code: Select allfunction callback()
   print("I think I got the wifi credentials!")
   wifi.stopsmart()
   wifi.sta.connect()
   print(wifi.sta.getip())
end

wifi.sta.disconnect()
print(wifi.sta.getip())
wifi.startsmart(6, callback())


But, I get the following output and it goes in a never-ending cycle where it seems to scan all channels without success. Also, why is it calling the callback function right away?

Code: Select all> dofile("smartWifiConfig.lua")
192.168.1.161
I think I got the wifi credentials!
192.168.1.161
set channel to 6
> switch to channel 1
switch to channel 14
switch to channel 2
switch to channel 3
switch to channel 4
User avatar
By zeroday
#2961
rrezaii wrote:
zeroday wrote:
rrezaii wrote:Is there support for WPS (wifi protected security). The module itself supports it according to the data sheet. It'd be great if NodeMcu provides support for it. Any plans ?

ESP8266 sdk have no api for WPS.
but it provide a way to sniffer.
so nodemcu have a way to get wifi config like cc3000.
Code: Select allwifi.startsmart()

will start sniffer for ssid and password.
use the android app same as cc3000.
no crypt supported.
not work in 11n, only work in 11b/g.


That's fantastic!
I tried to use TI's iOS app to configure wifi credentials for esp8266 device using the following script on the esp8266.


Code: Select allfunction callback()
   print("I think I got the wifi credentials!")
   wifi.stopsmart()
   wifi.sta.connect()
   print(wifi.sta.getip())
end

wifi.sta.disconnect()
print(wifi.sta.getip())
wifi.startsmart(6, callback())


But, I get the following output and it goes in a never-ending cycle where it seems to scan all channels without success. Also, why is it calling the callback function right away?

Code: Select all> dofile("smartWifiConfig.lua")
192.168.1.161
I think I got the wifi credentials!
192.168.1.161
set channel to 6
> switch to channel 1
switch to channel 14
switch to channel 2
switch to channel 3
switch to channel 4


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)
User avatar
By 4refr0nt
#2962 Hi!

I'm write small python script for loading user LUA-file to ESP8266 init.lua for autorunnig after restart.
Last edited by 4refr0nt on Thu Nov 20, 2014 12:49 pm, edited 1 time in total.