Chat freely about anything...

User avatar
By wjzhang
#22020 :? we try setup our SSID but get failed.
here the code:
wifi_softap_get_config(&esp8266SoftAPcfg);
os_memset(esp8266SoftAPcfg.ssid, 0, sizeof(esp8266SoftAPcfg.ssid));
os_memset(esp8266SoftAPcfg.password, 0, sizeof(esp8266SoftAPcfg.password));
//copy moduleID. and check last
os_memcpy(esp8266SoftAPcfg.ssid, moduleID, 8);
for(i = 7; i > 0; i--)
{
if(esp8266SoftAPcfg.ssid[i] == 0x00)
{
esp8266SoftAPcfg.ssid[i] = 0x20; //replace with space
}
else
{
break;
}
}
//copy 64bit to 16 char string.
for(i = 0; i < 8; i++)
{
esp8266SoftAPcfg.ssid[8+2*i] = toHexTable[(uniqueID[i]>>4) & 0x0F];
esp8266SoftAPcfg.ssid[8+2*i+1] = toHexTable[(uniqueID[i]) & 0x0F];
}
//copy password
os_memcpy(esp8266SoftAPcfg.password, password, passwdlen);

/*set SoftAP config*/
esp8266SoftAPcfg.ssid_len = 24;
esp8266SoftAPcfg.ssid_hidden = 0;
esp8266SoftAPcfg.authmode = AUTH_WPA_WPA2_PSK;
esp8266SoftAPcfg.max_connection = 1; //only 1 Gateway

ESP_DBG("SSID:%24s\r\n", esp8266SoftAPcfg.ssid);
//save current SoftAP config
//wifi_softap_set_config(&esp8266SoftAPcfg);
//wifi_softap_set_config_current(&esp8266SoftAPcfg);
if(wifi_softap_set_config(&esp8266SoftAPcfg) != true )
{
ESP_DBG("wifi_softap_set_config failed\r\n");
}

if(wifi_softap_set_config_current(&esp8266SoftAPcfg) != true )
{
ESP_DBG("wifi_softap_set_config_current failed\r\n");
}
......

the wifi_softap_set_config/wifi_softap_set_config_current both get failed on ESP-01 module. but it's working on 果云科技 module.

the config parameters seem no problem!
is there document describe why get failed?
Thanks for your help!
User avatar
By wjzhang
#22044 :? :shock:
the same ESP-01 working fine with 果云科技 board.
the ok log:
...
set SoftAP parameters
SSID:tt_3001 414B303818581743

bcn 0
del if1
usl
sul 0 0
set SoftAP mode
stop DHCP
set static IP address
start TCP server

pcb->localport 80
start UDP client
add if1
bcn 100
.....

the wrong log:
......
set SoftAP parameters
SSID:tt_3001 414B303818581743
wifi_softap_set_config_current failed
set SoftAP mode
stop DHCP
set static IP address
start TCP server

pcb->localport 80
start UDP client
.......