Просмотр исходного кода

【添加】wlan 断开连接属性 disconnect

SummerGift 6 лет назад
Родитель
Сommit
554016801f
2 измененных файлов с 3 добавлено и 2 удалено
  1. 1 0
      port/genhdr/qstrdefs.generated.h
  2. 2 2
      port/network_wlan.c

+ 1 - 0
port/genhdr/qstrdefs.generated.h

@@ -700,6 +700,7 @@ QDEF(MP_QSTR_ffivar, (const byte*)"\x49\x06" "ffivar")
 QDEF(MP_QSTR_network, (const byte*)"\x5b\x07" "network")
 QDEF(MP_QSTR_isconnected, (const byte*)"\x80\x0b" "isconnected")
 QDEF(MP_QSTR_WLAN, (const byte*)"\x11\x04" "WLAN")
+QDEF(MP_QSTR_disconnect, (const byte*)"\xa5\x0a" "disconnect")
 
 
 // This file was automatically generated by makeqstrdata.py

+ 2 - 2
port/network_wlan.c

@@ -174,7 +174,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp_connect_obj, 1, esp_connect);
 
 STATIC mp_obj_t esp_disconnect(mp_obj_t self_in) {
     require_if(self_in, STATION_IF);
-    error_check(rt_wlan_disconnect(), "Cannot disconnect from AP");
+    error_check(rt_wlan_disconnect() == RT_EOK, "Cannot disconnect from AP");
     return mp_const_none;
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_disconnect_obj, esp_disconnect);
@@ -498,7 +498,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_isconnected_obj, esp_isconnected);
 STATIC const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
 //    { MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&esp_active_obj) },
 //    { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&esp_connect_obj) },
-//    { MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&esp_disconnect_obj) },
+    { MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&esp_disconnect_obj) },
 //    { MP_ROM_QSTR(MP_QSTR_status), MP_ROM_PTR(&esp_status_obj) },
 //    { MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&esp_scan_obj) },
     { MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&esp_isconnected_obj) },