@@ -124,6 +124,10 @@ static bool is_inf_up = false;
124124
125125//mutex for Timeout Counter protection 
126126SemaphoreHandle_t  timeout_mutex ;
127+ #if  defined(FIPY ) ||  defined(GPY )
128+ // Variable saving DNS info 
129+ static  tcpip_adapter_dns_info_t  wlan_sta_inf_dns_info ;
130+ #endif 
127131
128132/****************************************************************************** 
129133 DECLARE PUBLIC DATA 
@@ -157,7 +161,7 @@ static void wlan_timer_callback( TimerHandle_t xTimer );
157161static  void  wlan_validate_country (const  char  *  country );
158162static  void  wlan_validate_country_policy (uint8_t  policy );
159163STATIC  void  wlan_stop_sta_conn_timer ();
160- STATIC  void  wlan_inf_up (void );
164+ STATIC  void  wlan_set_default_inf (void );
161165//***************************************************************************** 
162166// 
163167//! \brief The Function Handles WLAN Events 
@@ -347,7 +351,11 @@ STATIC esp_err_t wlan_event_handler(void *ctx, system_event_t *event) {
347351            break ;
348352        case  SYSTEM_EVENT_STA_GOT_IP : /**< ESP32 station got IP from connected AP */ 
349353            xEventGroupSetBits (wifi_event_group , CONNECTED_BIT );
350-         is_inf_up  =  true;
354+ #if  defined(FIPY ) ||  defined(GPY )
355+             // Save DNS info for restoring if wifi inf is usable again after LTE disconnect 
356+             tcpip_adapter_get_dns_info (TCPIP_ADAPTER_IF_STA , TCPIP_ADAPTER_DNS_MAIN , & wlan_sta_inf_dns_info );
357+ #endif 
358+             is_inf_up  =  true;
351359            break ;
352360        case  SYSTEM_EVENT_STA_DISCONNECTED : /**< ESP32 station disconnected from AP */ 
353361            xEventGroupClearBits (wifi_event_group , CONNECTED_BIT );
@@ -943,13 +951,14 @@ STATIC void promiscuous_callback(void *buf, wifi_promiscuous_pkt_type_t type)
943951    }
944952}
945953
946- STATIC  void  wlan_inf_up (void )
954+ STATIC  void  wlan_set_default_inf (void )
947955{
956+ #if  defined(FIPY ) ||  defined(GPY )
948957    if  (wlan_obj .mode  ==  WIFI_MODE_STA  ||  wlan_obj .mode  ==  WIFI_MODE_APSTA ) {
958+         tcpip_adapter_set_dns_info (TCPIP_ADAPTER_IF_STA , TCPIP_ADAPTER_DNS_MAIN , & wlan_sta_inf_dns_info );
949959        tcpip_adapter_up (TCPIP_ADAPTER_IF_STA );
950-         tcpip_adapter_dhcpc_stop (TCPIP_ADAPTER_IF_STA );
951-         tcpip_adapter_dhcpc_start (TCPIP_ADAPTER_IF_STA );
952960    }
961+ #endif 
953962}
954963
955964//STATIC void wlan_get_sl_mac (void) { 
@@ -2619,7 +2628,7 @@ const mod_network_nic_type_t mod_network_nic_type_wlan = {
26192628    .n_ioctl  =  lwipsocket_socket_ioctl ,
26202629    .n_setupssl  =  lwipsocket_socket_setup_ssl ,
26212630	.inf_up  =  wlan_is_inf_up ,
2622- 	.set_inf_up  =  wlan_inf_up 
2631+ 	.set_default_inf  =  wlan_set_default_inf 
26232632};
26242633
26252634//STATIC const mp_irq_methods_t wlan_irq_methods = { 
0 commit comments