i have some problems with my code to connect to my home wifi network. This is my code:
#include <ets_sys.h>
#include <osapi.h>
#include <gpio.h>
#include <os_type.h>
void ICACHE_FLASH_ATTR user_set_station_config(void){
char ssid[32] = "my_ssid";
char password[64] = "my_password";
struct station_config stationConf;
os_memset(stationConf.ssid, 0, 32);
os_memset(stationConf.password, 0, 64);
//need not mac address
stationConf.bssid_set = 0;
//Set ap settings
os_memcpy(&stationConf.ssid, ssid, 32);
os_memcpy(&stationConf.password, password, 64);
wifi_station_set_config(&stationConf);
wifi_station_connect();
}
void user_init(void)
{
wifi_set_opmode(STATIONAP_MODE);
user_set_station_config();
}
The problem is, that i get the error message, that the struct size is not known (basically that means that the struct itself is unknown) and that 'STATIONAP_MODE' also isn't known.
I searched around and i found that the station_config struct is defined in the file 'esp_sta.h'. So i copied the file from the SDK folder into my 'include/driver' folder and added that line:
#include "driver/esp_sta.h"
Now at least the station_config error disappears but i get the error that the 'AUTH_MODE' is a unknown type in the 'esp_sta.h' file:
struct bss_info {
STAILQ_ENTRY(bss_info) next; /**< information of next AP */
uint8 bssid[6]; /**< MAC address of AP */
uint8 ssid[32]; /**< SSID of AP */
uint8 ssid_len; /**< SSID length */
uint8 channel; /**< channel of AP */
sint8 rssi; /**< single strength of AP */
AUTH_MODE authmode; /**< authmode of AP */ //ERROR appears HERE
uint8 is_hidden; /**< SSID of current AP is hidden or not. */
sint16 freq_offset; /**< frequency offset */
sint16 freqcal_val;
uint8 *esp_mesh_ie;
};
I am working with the the windows SDK from CHERTS.
Any ideas what i have to do to fix that?