openLuat / LuatOS

LuatOS -- Powerful embedded Lua Engine for IoT devices, with many components and low memory requirements (16K RAM, 128K Flash)
https://wiki.luatos.com
MIT License
452 stars 102 forks source link

nimble.disconnect()无法断开蓝牙连接 #101

Closed mxdljwxx closed 7 months ago

mxdljwxx commented 7 months ago

描述一下这个bug / Describe the bug

LuatOS-SoC_V1022_AIR601, nimble.disconnect()不能断开蓝牙连接! 查luatos源码,luat_nimble_mode_central.c 中 if (!g_ble_conn_handle) { return 0; }

应全局连接g_ble_conn_handle = 0 ,导致if判断语句为1,退出,不执行断链语句。 可能在lua中编程习惯,C中只有0和1。 建议修改为 if (g_ble_conn_handle < 0)

复现步骤 / To Reproduce

如上

如果正常,应该是什么样 / Expected behavior

主动断开连接

截图 / Screenshots

![Uploading nimble_lib_mode_central-disconnect-error.png…]()

日志 / Logs

如图

PACK包版本 / Version

LuatOS-SoC_V1022_AIR601

验证

wendal commented 7 months ago

-_- 下周看看

wendal commented 7 months ago

咦, 已经分析出原因了? 直接给个pull request嘛

wendal commented 7 months ago

已修复