wifi_config_t structrue ap and sta members are overriten
Posted: Thu Apr 19, 2018 3:53 pm
Hi, I'm starting a project with ESP32 using esp-idf and I'm getting some wierd behaviors when using wifi_config_t structures.
If I initialize the structure like this:
and then print:
and the result I get is:
WiFi Configuration:
ap:
ssid:SCANN
password:SCANNPASS
ssid_len:0
channel:0
authmode:33619968
ssid_hidden:3
max_connection:4
beacon_interval:5
sta:
ssid:SCANN
password:SCANNPASS
bssid_set:0
bssid: 0: 1: 2: 3: 4: 5
channel:0
sort_method:0
threshold.rssi:-127
threshold.authmode:0
Note that the members from the member ap from wifi_config_t are affected by initializing the member sta. Does someone has similar problem? What am I missing?
Thanks a lot for any help.
If I initialize the structure like this:
Code: Select all
wifi_config_t wifi_cfg = {
.ap = {
.ssid = "TEST",
.password = "TESTPASS",
.ssid_len = 8,
.channel = 1,
.authmode = WIFI_AUTH_WPA2_PSK,
.ssid_hidden = false,
.max_connection = 1,
.beacon_interval = 100
},
.sta = {
.ssid = "SCANN",
.password = "SCANNPASS",
.bssid_set = false,
.bssid[0] = 0,
.bssid[1] = 1,
.bssid[2] = 2,
.bssid[3] = 3,
.bssid[4] = 4,
.bssid[5] = 5,
.channel = 0,
.sort_method = WIFI_CONNECT_AP_BY_SIGNAL,
.threshold = {
.rssi = -127,
.authmode = WIFI_AUTH_OPEN
}
}
};
Code: Select all
ESP_LOGD(HYPERION_WIFI_TAG,"WiFi Configuration:\n\tap:\n\t\tssid:%s\n\t\tpassword:%s\n\t\tssid_len:%u\n\t\tchannel:%u\n\t\tauthmode:%u\n\t\tssid_hidden:%u\n\t\tmax_connection:%u\n\t\tbeacon_interval:%u\n\tsta:\n\t\tssid:%s\n\t\tpassword:%s\n\t\tbssid_set:%u\n\t\tbssid:%2x:%2x:%2x:%2x:%2x:%2x\n\t\tchannel:%u\n\t\tsort_method:%u\n\t\tthreshold.rssi:%d\n\t\tthreshold.authmode:%u", wifi_cfg.ap.ssid,wifi_cfg.ap.password, wifi_cfg.ap.ssid_len, wifi_cfg.ap.channel, wifi_cfg.ap.authmode, wifi_cfg.ap.ssid_hidden, wifi_cfg.ap.max_connection, wifi_cfg.ap.beacon_interval, wifi_cfg.sta.ssid, wifi_cfg.sta.password, wifi_cfg.sta.bssid_set, wifi_cfg.sta.bssid[0], wifi_cfg.sta.bssid[1], wifi_cfg.sta.bssid[2], wifi_cfg.sta.bssid[3], wifi_cfg.sta.bssid[4], wifi_cfg.sta.bssid[5], wifi_cfg.sta.channel, wifi_cfg.sta.sort_method, wifi_cfg.sta.threshold.rssi, wifi_cfg.sta.threshold.authmode);
WiFi Configuration:
ap:
ssid:SCANN
password:SCANNPASS
ssid_len:0
channel:0
authmode:33619968
ssid_hidden:3
max_connection:4
beacon_interval:5
sta:
ssid:SCANN
password:SCANNPASS
bssid_set:0
bssid: 0: 1: 2: 3: 4: 5
channel:0
sort_method:0
threshold.rssi:-127
threshold.authmode:0
Note that the members from the member ap from wifi_config_t are affected by initializing the member sta. Does someone has similar problem? What am I missing?
Thanks a lot for any help.