-->
Page 1 of 3

wifi.ap.config() issue

PostPosted: Fri Nov 28, 2014 12:44 am
by yes8s
When configuring AP mode to have new SSID and password, I get a reset everytime. When using standard AT firmware, this doesn't happen so I'm thinking it may be a Lua thing.

Code: Select all> cfg={}
> cfg.ssid="TestWifi"
> cfg.pwd="password"
> wifi.ap.config(cfg)
[04]Z[17]0£[0C]M9ÿAÈVGÈòÆ[13]1aæû
------------------------------
set mode=SOFTAP (mode=2)
MAC:    18-FE-34-9D-40-52
ChipID:    10305618
Heap:    17624
Connect to SSID: "TestWifi"
Pasword: "password"
------------------------------
NodeMcu 0.9.2 build 20141124  powered by Lua 5.1.4
>


Also,
Here above I used a table to store the SSID and PWD first as in the example in the API. Also documented is possibly a way of doing this without using a table but by configuring with one line as you would in STATION MODE, but, whatever syntax I used this wouldn't work. Am I missing something? Can this be done with one line or must one always define and use a table?

Re: wifi.ap.config() issue

PostPosted: Fri Nov 28, 2014 1:39 am
by ThomasW
yes8s wrote:When configuring AP mode to have new SSID and password, I get a reset everytime. When using standard AT firmware, this doesn't happen so I'm thinking it may be a Lua thing.

Code: Select all> cfg={}
> cfg.ssid="TestWifi"
> cfg.pwd="password"
> wifi.ap.config(cfg)
[04]Z[17]0£[0C]M9ÿAÈVGÈòÆ[13]1aæû
------------------------------
set mode=SOFTAP (mode=2)
MAC:    18-FE-34-9D-40-52
ChipID:    10305618
Heap:    17624
Connect to SSID: "TestWifi"
Pasword: "password"
------------------------------
NodeMcu 0.9.2 build 20141124  powered by Lua 5.1.4
>


Also,
Here above I used a table to store the SSID and PWD first as in the example in the API. Also documented is possibly a way of doing this without using a table but by configuring with one line as you would in STATION MODE, but, whatever syntax I used this wouldn't work. Am I missing something? Can this be done with one line or must one always define and use a table?


The one-liner would be:
wifi.ap.config({ssid="myssid",pwd="mypassword"})


Not sure about the reboot, isn't this required after a change in the ap-setting?

Thomas

Re: wifi.ap.config() issue

PostPosted: Fri Nov 28, 2014 8:20 am
by yes8s
ThomasW wrote:The one-liner would be:
wifi.ap.config({ssid="myssid",pwd="mypassword"})


Not sure about the reboot, isn't this required after a change in the ap-setting?

Thomas

Ok, so that one-liner works so thanks for that. I was just curious as to why the entry method is different for setting this as an AP vs setting it as a STATION.

i.e.
wifi.sta.config("myssid","mypassword")
wifi.ap.config({ssid="myssid",pwd="mypassword"})

As for the reported bug, I went back and loaded the stock AT based firmware and as you can see below there is no reset when setting SSID and Password as a STATION or when configuring as an AP. After setting the ESP as an AP and then setting the config, I was able to then connect to this network without a reboot.
Code: Select allAT
OK

AT+CWMODE=1
OK

AT+CWJAP="SEP","xxxxxxxxxx"
OK

AT+CIFSR
192.168.1.7
OK

AT+CWMODE=2
OK

AT+CWSAP="TEST","password",3,0
OK

AT+CIFSR
192.168.4.1
OK

Re: wifi.ap.config() issue

PostPosted: Fri Nov 28, 2014 9:27 pm
by zeroday
yes8s wrote:
ThomasW wrote:The one-liner would be:
wifi.ap.config({ssid="myssid",pwd="mypassword"})


Not sure about the reboot, isn't this required after a change in the ap-setting?

Thomas

Ok, so that one-liner works so thanks for that. I was just curious as to why the entry method is different for setting this as an AP vs setting it as a STATION.

i.e.
wifi.sta.config("myssid","mypassword")
wifi.ap.config({ssid="myssid",pwd="mypassword"})

As for the reported bug, I went back and loaded the stock AT based firmware and as you can see below there is no reset when setting SSID and Password as a STATION or when configuring as an AP. After setting the ESP as an AP and then setting the config, I was able to then connect to this network without a reboot.
Code: Select allAT
OK

AT+CWMODE=1
OK

AT+CWJAP="SEP","xxxxxxxxxx"
OK

AT+CIFSR
192.168.1.7
OK

AT+CWMODE=2
OK

AT+CWSAP="TEST","password",3,0
OK

AT+CIFSR
192.168.4.1
OK


the reboot is not a crash.
in my test, when 8266 change its ap ssid, my pc will discover 2 APs simultaneously, the previous one and the new one.
maybe it's a problem of my pc only. I reset 8266 just in case.

the table cfg method, is reserved for more complicated configuration. like ip, gateway, net mask...(can not do this right now, because no api in SDK 0.9.2)
sorry for the confusion