esp_iot_sdk_v1.0.1_15_04_24 不能设置softAp ssid 和 password

carrus
Posts: 9
Joined: Mon Apr 27, 2015 10:05 am

esp_iot_sdk_v1.0.1_15_04_24 不能设置softAp ssid 和 password

Postby carrus » Wed May 06, 2015 1:14 pm

你好!:

我刚学习esp8266.遇到这个问题请帮忙解决。

使用的是esp_iot_sdk_v1.0.1_15_04_24.zip SDK.

烧录工具是FLASH_DOWNLOAD_TOOLS_v0.9.6_150419.rar。

使用附件的参数,烧录ok.

电脑通过wifi,输入密码:1a:fe:34:fe:41:b4_v*%W>L<@i&Nxe!
连接上softAp.

在windos ,参考 2B-ESP8266__SDK__IOT_Demo_CN_v0.5.pdf
使用curl 命令修改softAp ssid 和密码不成功。

命令使用:
curl -X POST -H "Content-Type:application/json" -d "{/"Request/":{/"
Softap/":{/"Connect_Softap/":{/"authmode/":/"WPAPSK/WPA2PSK/", /"channel/":6, /"
SSID/":/"ESP_IOT_SOFTAP/", /"password/":/"34567890/"}}}}" http://192.168.4.1/con
fig?command=wifi

这个也不行。
curl -X POST -H "Content-Type:application/json" -d "{/"Request/":{/"Softap/":{/"Connect_Softap/":{/"authmode/":/"WPA2PSK/", /"channel/":6, /"SSID/":/"ESP_IOT_SOFTAP/", /"password/":/"34567890/"}}}}" http://192.168.4.1/config?command=wifi




具体log:
命令log:

C:\Users\yk>curl -X GET http://192.168.4.1/client?command=info
{
"Version":{
"hardware":"0.3",
"sdk_version":"1.0.1",
"iot_version":"v1.0.2t12335(a)"
},
"Device":{
"product":"Humiture",
"manufacturer":"Espressif Systems"
}
}


C:\Users\yk>curl -X GET http://192.168.4.1/config?command=wifi
{
"Response":{
"Station":{
"Connect_Station":{
"ssid":"",
"password":""
},
"Ipinfo_Station":{
"ip":"0.0.0.0",
"mask":"0.0.0.0",
"gw":"0.0.0.0"
}
},
"Softap":{
"Connect_Softap":{
"authmode":"WPAPSK/WPA2PSK",
"channel":1,
"ssid":"ESP_FE41B4",
"password":"1a:fe:34:fe:41:b4_v*%W>L<@i&Nxe!"
},
"Ipinfo_Softap":{
"ip":"192.168.4.1",
"mask":"255.255.255.0",
"gw":"192.168.4.1"
}
}
}
}


C:\Users\yk>curl -X POST -H "Content-Type:application/json" -d "{/"Request/":{/"
Softap/":{/"Connect_Softap/":{/"authmode/":/"WPAPSK/WPA2PSK/", /"channel/":6, /"
SSID/":/"ESP_IOT_SOFTAP/", /"password/":/"34567890/"}}}}" http://192.168.4.1/con
fig?command=wifi

C:\Users\yk>


串口log:

ets Jan 8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 28304, room 16
tail 0
chksum 0xed
load 0x3ffe8000, len 3252, room 8
tail 12
chksum 0x6d
ho 0 tail 12 room 4
load 0x3ffe8cc0, len 3336, room 12
tail 12
chksum 0x45
csum 0x45

SDK ver: 1.0.1 compiled @ Apr 24 2015 19:31:11
phy ver: 329, pp ver: 8.4

SDK version:1.0.1
IOT VERSION = v1.0.2t12335(a)
addr not ack when tx write cmd
pcb->localport 80
mode : sta(18:fe:34:fe:41:b4) + softAP(1a:fe:34:fe:41:b4)
add if0
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
add if1
bcn 100
add 1
aid 1
station: 20:7c:8f:26:3a:ba join, AID = 1
We have a GET request.
webserver's 192.168.4.2:65232 disconnect
We have a GET request.
webserver's 192.168.4.2:65235 disconnect
We have a POST request.
webserver's 192.168.4.2:65240 disconnect
Attachments
flash_op.png
烧录参数
flash_op.png (35.29 KiB) Viewed 11870 times

carrus
Posts: 9
Joined: Mon Apr 27, 2015 10:05 am

Re: esp_iot_sdk_v1.0.1_15_04_24 不能设置softAp ssid 和 password

Postby carrus » Wed May 06, 2015 1:22 pm

我使用的是IoT_Demo的代码。

默认编译参数。

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: esp_iot_sdk_v1.0.1_15_04_24 不能设置softAp ssid 和 password

Postby ESP_Faye » Thu May 07, 2015 11:01 am

您好,

curl 命令需要注意格式,不能多了或者少了空格,要使用英文符号,不能使用中文符号。
测试可以正常设置 softAP
softap_curl_config.png
softap_curl_config.png (112.29 KiB) Viewed 11827 times


测试指令如下:

Code: Select all

curl -X POST -H "Content-Type:application/json" -d "{\"Request\":{\"Softap\":{\"Connect_Softap\":{\"authmode\":\"WPA2PSK\",\"channel\":6,\"ssid\":\"ESP_IOT_SOFTAP\",\"password\":\"88888888\"}}}}" http://192.168.4.1/config?command=wifi


另注意,在 IOT_Demo 的 user_esp_platform_init 中,如下代码会再次设置 softAP 的密码,您可以将它改为 #if 0 注释掉,以免重启后,影响 curl 指令的设置结果

Code: Select all

#ifdef SOFTAP_ENCRYPT
        struct softap_config config;
        char password[33];
        char macaddr[6];

        wifi_softap_get_config(&config);
        wifi_get_macaddr(SOFTAP_IF, macaddr);

        os_memset(config.password, 0, sizeof(config.password));
        os_sprintf(password, MACSTR "_%s", MAC2STR(macaddr), PASSWORD);
        os_memcpy(config.password, password, os_strlen(password));
        config.authmode = AUTH_WPA_WPA2_PSK;

        wifi_softap_set_config(&config);
#endif

carrus
Posts: 9
Joined: Mon Apr 27, 2015 10:05 am

Re: esp_iot_sdk_v1.0.1_15_04_24 不能设置softAp ssid 和 password

Postby carrus » Thu May 07, 2015 2:22 pm

谢谢!
现在可以了。

原因是:按文件 2B-ESP8266__SDK__IOT_Demo_CN_v0.5.pdf
第8页,描述的方法:
Windows curl:
curl -X POST -H "Content-Type:application/json" -d "{/"Request/":{/"Softap/":
{/"Connect_Softap/":{/"authmode/":/"OPEN/", /"channel/":
6, /"SSID/":/"ESP_IOT_SOFTAP/", /"password/":/"/"}}}}" http://192.168.4.1/config?
command=wifi

而你给我的方法则为:
curl -X POST -H "Content-Type:application/json" -d "{\"Request\":{\"Softap\":{\"Connect_Softap\":{\"authmode\":\"WPA2PSK\",\"channel\":6,\"ssid\":\"ESP_IOT_SOFTAP\",\"password\":\"88888888\"}}}}" http://192.168.4.1/config?command=wifi


两者的区别在于双引号前的字符, 能用的是斜线\不能用的是反斜线/


2B-ESP8266__SDK__IOT_Demo_CN_v0.5.pdf 文件还有些这样描述

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: esp_iot_sdk_v1.0.1_15_04_24 不能设置softAp ssid 和 password

Postby ESP_Faye » Thu May 07, 2015 3:53 pm

您好,

确实我们的文档在撰写时将符号写错了,非常感谢您的热心提醒,我们将尽快修正。

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: esp_iot_sdk_v1.0.1_15_04_24 不能设置softAp ssid 和 password

Postby ESP_Faye » Thu May 07, 2015 5:11 pm

您好,

文档已经更新,您可以下载使用 http://bbs.espressif.com/viewtopic.php?f=5&t=398&p=1650#p1650

Who is online

Users browsing this forum: No registered users and 144 guests