File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -305,10 +305,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_scan_obj, esp_scan);
305
305
306
306
STATIC mp_obj_t esp_isconnected (mp_obj_t self_in ) {
307
307
wlan_if_obj_t * self = MP_OBJ_TO_PTR (self_in );
308
- require_if (self_in , WIFI_IF_STA );
309
- tcpip_adapter_ip_info_t info ;
310
- tcpip_adapter_get_ip_info (self -> if_id , & info );
311
- return mp_obj_new_bool (info .ip .addr != 0 );
308
+ if (self -> if_id == WIFI_IF_STA ) {
309
+ tcpip_adapter_ip_info_t info ;
310
+ tcpip_adapter_get_ip_info (WIFI_IF_STA , & info );
311
+ return mp_obj_new_bool (info .ip .addr != 0 );
312
+ } else {
313
+ wifi_sta_list_t sta ;
314
+ esp_wifi_ap_get_sta_list (& sta );
315
+ return mp_obj_new_bool (sta .num != 0 );
316
+ }
312
317
}
313
318
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (esp_isconnected_obj , esp_isconnected );
314
319
You can’t perform that action at this time.
0 commit comments