angeliacfq wrote:
你好:
在mesh_demo里,调用espconn_mesh_is_root_candidate(),返回的都是false,如下:
static bool ICACHE_FLASH_ATTR router_init()
{
struct station_config config;
if (!espconn_mesh_is_root_candidate())
{
MESH_DEMO_PRINT("!espconn_mesh_is_root_candidate\r\n");
goto INIT_SMARTCONFIG;
}
MESH_DEMO_MEMSET(&config, 0, sizeof(config));
espconn_mesh_get_router(&config);
if (config.ssid[0] == 0xff ||
config.ssid[0] == 0x00) {
MESH_DEMO_PRINT(" please change MESH_ROUTER_SSID and MESH_ROUTER_PASSWD according to your router\r\n");
/*
* please change MESH_ROUTER_SSID and MESH_ROUTER_PASSWD according to your router
*/
MESH_DEMO_MEMSET(&config, 0, sizeof(config));
MESH_DEMO_MEMCPY(config.ssid, MESH_ROUTER_SSID, MESH_DEMO_STRLEN(MESH_ROUTER_SSID));
MESH_DEMO_MEMCPY(config.password, MESH_ROUTER_PASSWD, MESH_DEMO_STRLEN(MESH_ROUTER_PASSWD));
/*
* if you use router with hide ssid, you MUST set bssid in config,
* otherwise, node will fail to connect router.
*
* if you use normal router, please pay no attention to the bssid,
* and you don't need to modify the bssid, mesh will ignore the bssid.
*/
// config.bssid_set = 1;
// MESH_DEMO_MEMCPY(config.bssid, MESH_ROUTER_BSSID, sizeof(config.bssid));
}
/*
* use espconn_mesh_set_router to set router for mesh node
*/
if (!espconn_mesh_set_router(&config)) {
MESH_DEMO_PRINT("set_router fail\n");
return false;
}
INIT_SMARTCONFIG:
/*
* use esp-touch(smart configure) to sent information about router AP to mesh node
*/
esptouch_init();
MESH_DEMO_PRINT("flush ssid:%s pwd:%s\n", config.ssid, config.password);
return true;
}
please use espconn_mesh_set_router before root_candidate.Statistics: Posted by Guest — Mon Dec 05, 2016 10:37 am
]]>