main/ims_tcp.c
/*
 * Initialise wifi with the set ip address. Can be called at any time but connection will be lost and reset
 */
Initialise wifi with the set ip address. Can be called at any time but connection will be lost and reset
Initialise wifi with the set ip address . Can be called at any time but connection will be lost and reset
void init_wifi(){
	tcpip_adapter_init();
	wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
	ESP_ERROR_CHECK(esp_wifi_init(&cfg));
	tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA);
	tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &globalIpInfo.localIpInfo);
	ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_FLASH));
	ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
	wifi_config_t sta_config = {
			.sta = {
					.ssid = WIFI_SSID,
					.password = WIFI_PASSWORD,
					.bssid_set = false,
			}
	};
	ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &sta_config));
	ESP_ERROR_CHECK(esp_wifi_start());
	ESP_ERROR_CHECK(esp_wifi_disconnect());
	ESP_ERROR_CHECK(esp_wifi_connect());
}
void init_wifi ( ) { tcpip_adapter_init ( ) ; wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT ( ) ; ESP_ERROR_CHECK ( esp_wifi_init ( & cfg ) ) ; tcpip_adapter_dhcpc_stop ( TCPIP_ADAPTER_IF_STA ) ; tcpip_adapter_set_ip_info ( TCPIP_ADAPTER_IF_STA , & globalIpInfo . localIpInfo ) ; ESP_ERROR_CHECK ( esp_wifi_set_storage ( WIFI_STORAGE_FLASH ) ) ; ESP_ERROR_CHECK ( esp_wifi_set_mode ( WIFI_MODE_STA ) ) ; wifi_config_t sta_config = { . sta = { . ssid = WIFI_SSID , . password = WIFI_PASSWORD , . bssid_set = false , } } ; ESP_ERROR_CHECK ( esp_wifi_set_config ( WIFI_IF_STA , & sta_config ) ) ; ESP_ERROR_CHECK ( esp_wifi_start ( ) ) ; ESP_ERROR_CHECK ( esp_wifi_disconnect ( ) ) ; ESP_ERROR_CHECK ( esp_wifi_connect ( ) ) ; }
Initialise wifi with the set ip address.
Initialise wifi with the set ip address .
//manually set ip address for wifi STA connection //ESP_LOGI(TAG, "wifi starting, wait..");