[solved]Init Wifi ssid & pw from string
Posted: Thu Apr 30, 2020 7:33 am
Hello,
I did an IDF update from an early IDF V3 to V4 and try to migrate some of my projects.
Within one of them, I do a wifi configuration from spiffs config.txt which does not work anymore,
but the current wifi sta example works fine.
This code works fine in the past:
Right now there is no warning or error from compiler or monitor, but just no login to wifi AP.
also not work but
show always the right strings in Monitor.
Are there any hints what went wrong?
(I'm not so much experienced in C)
I did an IDF update from an early IDF V3 to V4 and try to migrate some of my projects.
Within one of them, I do a wifi configuration from spiffs config.txt which does not work anymore,
but the current wifi sta example works fine.
This code works fine in the past:
Code: Select all
static uint8_t wifi_ssid[32] = WIFI_SSID; // init default values
static uint8_t wifi_pw[64] = WIFI_PW;
.....
// read data from config.txt
.....
wifi_config_t sta_config;
memcpy(sta_config.sta.ssid,wifi_ssid,sizeof(wifi_ssid));
memcpy(sta_config.sta.password,wifi_pw,sizeof(wifi_pw));
Code: Select all
strcpy((char *)sta_config.sta.ssid,(char *)wifi_ssid);
strcpy((char *)sta_config.sta.password,(char *)wifi_pw);
Code: Select all
ESP_LOGI(TAG,"ssid: %s", sta_config.sta.ssid);
ESP_LOGI(TAG,"pw: %s", sta_config.sta.password);
Are there any hints what went wrong?
(I'm not so much experienced in C)