为什么1.2固件 Smartconfig 无法保存AP wifi名称和密码
为什么1.2固件 Smartconfig 无法保存AP wifi名称和密码
Postby zhujieo » Tue Aug 04, 2015 11:03 pm
我使用官方1.2固件中的SmartConfig 实例未修改编译成固件烧录到ESP8266中,可以进行EspTouch和Air Kiss的配置,但是重启以后还是得重新配置,这是怎么回事?还有官方提供的手机APP中的SSID is Hidden选项好像无效,我隐藏了SSID进行第一次配置从事不成功的,只有在不隐藏的情况下先配置成功一次,才能在隐藏的时候也能配置。如果重新烧录一次又得把WIFI信号设置成广播。
Re: 为什么1.2固件 Smartconfig 无法保存AP wifi名称和密码
Postby ESP_Faye » Tue Aug 11, 2015 3:46 pm
您好,
非常抱歉未能及时回复您的问题。
smartconfig 不会保存 SSID 和 password,smartconfig 获得目标 AP 的 SSID 和 password 后,调用 wifi_station_set_config 连接 AP 时,会记录到 flash。
手机 APP 的问题 我们将进行查证,晚些回复您。如果您能提供更多问题相关的信息,例如 APP 版本,测试步骤等,将会很有帮助。
感谢您对 乐鑫信息科技 和 ESP8266 的关注!
非常抱歉未能及时回复您的问题。
smartconfig 不会保存 SSID 和 password,smartconfig 获得目标 AP 的 SSID 和 password 后,调用 wifi_station_set_config 连接 AP 时,会记录到 flash。
手机 APP 的问题 我们将进行查证,晚些回复您。如果您能提供更多问题相关的信息,例如 APP 版本,测试步骤等,将会很有帮助。
感谢您对 乐鑫信息科技 和 ESP8266 的关注!
Re: 为什么1.2固件 Smartconfig 无法保存AP wifi名称和密码
Postby zhujieo » Tue Aug 18, 2015 9:31 pm
可是,我使用官方例程中关于SmartConfig的代码没有修改。里面确实有wifi_station_set_config(sta_conf);这个函数,应该是可以保存到Flash的啊。等模块重启还是要重新配置。
Code: Select all
/******************************************************************************
* Copyright 2013-2014 Espressif Systems (Wuxi)
*
* FileName: user_main.c
*
* Description: entry file of user application
*
* Modification history:
* 2014/1/1, v1.0 create this file.
*******************************************************************************/
#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
#include "smartconfig.h"
void ICACHE_FLASH_ATTR
smartconfig_done(sc_status status, void *pdata)
{
switch(status) {
case SC_STATUS_WAIT:
os_printf("SC_STATUS_WAIT\n");
break;
case SC_STATUS_FIND_CHANNEL:
os_printf("SC_STATUS_FIND_CHANNEL\n");
break;
case SC_STATUS_GETTING_SSID_PSWD:
os_printf("SC_STATUS_GETTING_SSID_PSWD\n");
sc_type *type = pdata;
if (*type == SC_TYPE_ESPTOUCH) {
os_printf("SC_TYPE:SC_TYPE_ESPTOUCH\n");
} else {
os_printf("SC_TYPE:SC_TYPE_AIRKISS\n");
}
break;
case SC_STATUS_LINK:
os_printf("SC_STATUS_LINK\n");
struct station_config *sta_conf = pdata;
wifi_station_set_config(sta_conf);
wifi_station_disconnect();
wifi_station_connect();
break;
case SC_STATUS_LINK_OVER:
os_printf("SC_STATUS_LINK_OVER\n");
if (pdata != NULL) {
uint8 phone_ip[4] = {0};
os_memcpy(phone_ip, (uint8*)pdata, 4);
os_printf("Phone ip: %d.%d.%d.%d\n",phone_ip[0],phone_ip[1],phone_ip[2],phone_ip[3]);
}
smartconfig_stop();
break;
}
}
void user_rf_pre_init(void)
{
}
void user_init(void)
{
os_printf("SDK version:%s\n", system_get_sdk_version());
wifi_set_opmode(STATION_MODE);
smartconfig_start(smartconfig_done);
}
Re: 为什么1.2固件 Smartconfig 无法保存AP wifi名称和密码
Postby succu » Sat Aug 22, 2015 9:14 am
我遇到的也是同样的问题,sdk里的代码没改过
那么是否我需要设计启动后先自动重连,重连不上再进入smartconfig呢
有尝试过
wifi_set_opmode(STATION_MODE);
wifi_station_set_auto_connect(1);
然后判断wifi_station_get_connect_status的返回值
如果没连上就smartconfig_start(smartconfig_done);
请问这样思路对吗,反正没成功,请问有可以参考的其他example吗,谢谢
那么是否我需要设计启动后先自动重连,重连不上再进入smartconfig呢
有尝试过
wifi_set_opmode(STATION_MODE);
wifi_station_set_auto_connect(1);
然后判断wifi_station_get_connect_status的返回值
如果没连上就smartconfig_start(smartconfig_done);
请问这样思路对吗,反正没成功,请问有可以参考的其他example吗,谢谢
Re: 为什么1.2固件 Smartconfig 无法保存AP wifi名称和密码
Postby ESP_Faye » Tue Aug 25, 2015 10:59 am
succu wrote:wifi_set_opmode(STATION_MODE);
wifi_station_set_auto_connect(1);
然后判断wifi_station_get_connect_status的返回值
如果没连上就smartconfig_start(smartconfig_done);
您好,
这个思路是正确的,smartconfig_start 控制进入 smart config 快连模式,因此不会自动连接。
可以设置一个定时器 os_timer,如果一段时间内 wifi_station_get_connect_status 和 wifi_get_ip_info 查询仍未连接到路由,获得 IP 地址,则进入 smart config 快连模式。
感谢您对 ESP8266 的关注!
Who is online
Users browsing this forum: No registered users and 27 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.