@@ -123,6 +123,10 @@ static bool is_inf_up = false;
123123
124124//mutex for Timeout Counter protection
125125SemaphoreHandle_t timeout_mutex ;
126+ #if defined(FIPY ) || defined(GPY )
127+ // Variable saving DNS info
128+ static tcpip_adapter_dns_info_t wlan_sta_inf_dns_info ;
129+ #endif
126130
127131/******************************************************************************
128132 DECLARE PUBLIC DATA
@@ -156,7 +160,7 @@ static void wlan_timer_callback( TimerHandle_t xTimer );
156160static void wlan_validate_country (const char * country );
157161static void wlan_validate_country_policy (uint8_t policy );
158162STATIC void wlan_stop_sta_conn_timer ();
159- STATIC void wlan_inf_up (void );
163+ STATIC void wlan_set_default_inf (void );
160164//*****************************************************************************
161165//
162166//! \brief The Function Handles WLAN Events
@@ -346,7 +350,11 @@ STATIC esp_err_t wlan_event_handler(void *ctx, system_event_t *event) {
346350 break ;
347351 case SYSTEM_EVENT_STA_GOT_IP : /**< ESP32 station got IP from connected AP */
348352 xEventGroupSetBits (wifi_event_group , CONNECTED_BIT );
349- is_inf_up = true;
353+ #if defined(FIPY ) || defined(GPY )
354+ // Save DNS info for restoring if wifi inf is usable again after LTE disconnect
355+ tcpip_adapter_get_dns_info (TCPIP_ADAPTER_IF_STA , TCPIP_ADAPTER_DNS_MAIN , & wlan_sta_inf_dns_info );
356+ #endif
357+ is_inf_up = true;
350358 break ;
351359 case SYSTEM_EVENT_STA_DISCONNECTED : /**< ESP32 station disconnected from AP */
352360 xEventGroupClearBits (wifi_event_group , CONNECTED_BIT );
@@ -942,13 +950,14 @@ STATIC void promiscuous_callback(void *buf, wifi_promiscuous_pkt_type_t type)
942950 }
943951}
944952
945- STATIC void wlan_inf_up (void )
953+ STATIC void wlan_set_default_inf (void )
946954{
955+ #if defined(FIPY ) || defined(GPY )
947956 if (wlan_obj .mode == WIFI_MODE_STA || wlan_obj .mode == WIFI_MODE_APSTA ) {
957+ tcpip_adapter_set_dns_info (TCPIP_ADAPTER_IF_STA , TCPIP_ADAPTER_DNS_MAIN , & wlan_sta_inf_dns_info );
948958 tcpip_adapter_up (TCPIP_ADAPTER_IF_STA );
949- tcpip_adapter_dhcpc_stop (TCPIP_ADAPTER_IF_STA );
950- tcpip_adapter_dhcpc_start (TCPIP_ADAPTER_IF_STA );
951959 }
960+ #endif
952961}
953962
954963//STATIC void wlan_get_sl_mac (void) {
@@ -2618,7 +2627,7 @@ const mod_network_nic_type_t mod_network_nic_type_wlan = {
26182627 .n_ioctl = lwipsocket_socket_ioctl ,
26192628 .n_setupssl = lwipsocket_socket_setup_ssl ,
26202629 .inf_up = wlan_is_inf_up ,
2621- .set_inf_up = wlan_inf_up
2630+ .set_default_inf = wlan_set_default_inf
26222631};
26232632
26242633//STATIC const mp_irq_methods_t wlan_irq_methods = {
0 commit comments