I am running with wifi initialised in APSTA mode currently.
What I'm trying to do is setup the station and softAP interface with different IP addresses in different subnets when the Station has connected to an AP.
So what happens is the Station connects to its network, then the AP is reconfigured with an IP address in a different subnet.
However, when I configure the AP after the Station connects the Station's IP addresses are changed to what the AP is configured with. The image shows the gist of what I'm talking about from the terminal. The Station gets its DHCP assigned address, then the AP's is changed, but the event comes back syaing the sta ip is changed...
My code to change the AP IP stops the DHCP server, makes the change and re enables.
Code: Select all
ESP_ERROR_CHECK(tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_AP));
tcpip_adapter_ip_info_t ap_ip_info;
memset(&ap_ip_info, 0, sizeof(ap_ip_info));
IP4_ADDR(&ap_ip_info.ip, 192, 168, 4, first_host_addr);
IP4_ADDR(&ap_ip_info.netmask, 255, 255, 255, subnet_last8);
IP4_ADDR(&ap_ip_info.gw, 192, 168, 4, first_host_addr);
ESP_ERROR_CHECK(tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_AP, &ap_ip_info));
ESP_ERROR_CHECK(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA));