I'm trying to make ESP32 connect to AP, I''ve two different codes, one is working and the other isn't
module connects to AP when i declare the following:
wifi_config_t wifi_config_sta= {
.sta = {
.ssid = CONFIG_DEAFULT_AP_SSID,//ESP_STA_SSID,
.password = CONFIG_DEFAULT_AP_WIFI_PASSWORD//ESP_STA_PASS
},
};
module didn't connect to AP when I initialize like:
strcpy ((char*)wifi_config_sta.sta.ssid, CONFIG_DEAFULT_AP_SSID);
strcpy ((char*)wifi_config_sta.sta.password, CONFIG_DEFAULT_AP_WIFI_PASSWORD);
can anyone tell me what is the differences between this declerations?
Thank you in advance,
ESP32 STA configuration
Re: ESP32 STA configuration
Not sure. Try printing the strlen of both examples and make sure they are the same length, is where I would start.
-
- Posts: 9724
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP32 STA configuration
How do you declare your wifi_config_sta variable in the 2nd example?
-
- Posts: 48
- Joined: Mon Apr 30, 2018 5:32 pm
Re: ESP32 STA configuration
ESP_Sprite,
This is the declaration of the wifi_config_sta variable in the second example.
wifi_config_t wifi_config_sta;
strcpy ((char*)wifi_config_sta.sta.ssid, CONFIG_DEAFULT_AP_SSID);
strcpy ((char*)wifi_config_sta.sta.password, CONFIG_DEFAULT_AP_WIFI_PASSWORD);
This is the declaration of the wifi_config_sta variable in the second example.
wifi_config_t wifi_config_sta;
strcpy ((char*)wifi_config_sta.sta.ssid, CONFIG_DEAFULT_AP_SSID);
strcpy ((char*)wifi_config_sta.sta.password, CONFIG_DEFAULT_AP_WIFI_PASSWORD);
-
- Posts: 48
- Joined: Mon Apr 30, 2018 5:32 pm
Re: ESP32 STA configuration
user_name,
This is what I did first and they are the same
This is what I did first and they are the same
-
- Posts: 48
- Joined: Mon Apr 30, 2018 5:32 pm
Re: ESP32 STA configuration
ESP_Sprite,
Thank you for the hint, seems that when I declare
wifi_config_t wifi_config_sta;
the memory bloack that wifi_config_sta variable use is not 0 !!!
When I wrote:
wifi_config_t wifi_config_sta = {0};
everything work fine.
Regards,
Thank you for the hint, seems that when I declare
wifi_config_t wifi_config_sta;
the memory bloack that wifi_config_sta variable use is not 0 !!!
When I wrote:
wifi_config_t wifi_config_sta = {0};
everything work fine.
Regards,
Re: ESP32 STA configuration
It is recommended to use this for init:
Code: Select all
wifi_init_config_t wifi_init_config = WIFI_INIT_CONFIG_DEFAULT();
--
Paul.
Paul.
Who is online
Users browsing this forum: No registered users and 115 guests