Hi,
I have set up the https_ota_example. The password is set up through menuconfig but is there a way to change the password from inside the code calling a function or something. I couldn't find anything on the documentation
changing wifi password
-
- Posts: 1725
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: changing wifi password
Documentation: https://docs.espressif.com/projects/esp ... i_config_t
The relevant code from the examples is here/here.
The relevant code from the examples is here/here.
Re: changing wifi password
Like I said I didn't find how to change the password in the documentation. I don't see the library providing a function for that. Changing the library is not very wise since other updates might change it back
Re: changing wifi password
You don't need to change anything. @MicroController pointed you to the right places.
Here is a small example
Here is a small example
Code: Select all
bool wifi_join(const char *ssid, const char *pass, int timeout_ms)
{
int bits = 0;
if(isConnected())
wifi_disconnect(1, NULL);
wifi_config_t wifi_config = { 0 };
strlcpy((char *) wifi_config.sta.ssid, ssid, sizeof(wifi_config.sta.ssid));
if (pass)
strlcpy((char *) wifi_config.sta.password, pass, sizeof(wifi_config.sta.password));
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
esp_wifi_connect();
bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
pdFALSE, pdTRUE, timeout_ms / portTICK_PERIOD_MS);
return (bits & CONNECTED_BIT) != 0;
}
Re: changing wifi password
Thanks a lot ! That's what I was looking for!
I searched for that function and found it here :
esp-idf\examples\system\console\advanced\components\cmd_wifi\cmd_wifi.c
I will test it
I searched for that function and found it here :
esp-idf\examples\system\console\advanced\components\cmd_wifi\cmd_wifi.c
I will test it
Who is online
Users browsing this forum: No registered users and 314 guests