Hi,
I am not getting channel number
wifi_config_t sta_config;
esp_err_t esp_err = ::esp_wifi_get_config(WIFI_IF_STA, &sta_config);
if (esp_err == ESP_OK) {
sta_config.sta.channel; // 0
sta_config.sta.ssid // this work.
I am not getting channel number for joined WiFi. I do get AP chanenl number.
I try calling below method as well.
ESP_ERROR_CHECK(esp_wifi_set_promiscuous(true));
channel number for STA WiFi
Re: channel number for STA WiFi
I do get info when I connect to Wifi
I (4187) wifi: ap channel adjust o:1,0 n:6,0
I (4188) wifi: n:6 0, o:1 0, ap:6 0, sta:6 0, prof:1
I (4878) wifi: state: init -> auth (b0)
I (4888) wifi: state: auth -> assoc (0)
I (4899) wifi: state: assoc -> run (10)
I (4914) wifi: connected with Actiguest, channel 6
I (4915) wifi: pm start, type: 1
The correct channel. How to get channel number later.
I (4187) wifi: ap channel adjust o:1,0 n:6,0
I (4188) wifi: n:6 0, o:1 0, ap:6 0, sta:6 0, prof:1
I (4878) wifi: state: init -> auth (b0)
I (4888) wifi: state: auth -> assoc (0)
I (4899) wifi: state: assoc -> run (10)
I (4914) wifi: connected with Actiguest, channel 6
I (4915) wifi: pm start, type: 1
The correct channel. How to get channel number later.
Re: channel number for STA WiFi
Also I am set my Access point channel. but it some time change to channel=6
wifi_config_t ap_config;
ap_config.ap.ssid_len = 0;
ap_config.ap.channel = 4;
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &ap_config));
ESP_ERROR_CHECK(esp_wifi_start());
wifi_config_t ap_config;
ap_config.ap.ssid_len = 0;
ap_config.ap.channel = 4;
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &ap_config));
ESP_ERROR_CHECK(esp_wifi_start());
Re: channel number for STA WiFi
Ap channel has to be the same as sta channel if sta is connected. That channel is set by external ap you are connected to.
Re: channel number for STA WiFi
Q# 1
wifi_config_t config;
esp_err_t esp_err = ::esp_wifi_get_config(WIFI_IF_AP, &config);
if (esp_err == ESP_OK) {
config.sta.channel; // This will give me channel number wether I am connect to STA or not. After connect to STA. channel will be STA channel.
Q #2
I can only set or change ap channel if you are not connect to any sta. Is this correct?
wifi_config_t config;
esp_err_t esp_err = ::esp_wifi_get_config(WIFI_IF_AP, &config);
if (esp_err == ESP_OK) {
config.sta.channel; // This will give me channel number wether I am connect to STA or not. After connect to STA. channel will be STA channel.
Q #2
I can only set or change ap channel if you are not connect to any sta. Is this correct?
Who is online
Users browsing this forum: Google [Bot] and 122 guests