提交 a0f0bd93 编写于 作者: C copercini 提交者: Me No Dev

Fix BTserial memory leaks (#1801)

- Delete queue at end
- Close BT connection before end
- DeInit SPP
上级 80c110ec
......@@ -152,6 +152,9 @@ static bool _init_bt(const char *deviceName)
static bool _stop_bt()
{
if (btStarted()){
if(_spp_client)
esp_spp_disconnect(_spp_client);
esp_spp_deinit();
esp_bluedroid_disable();
esp_bluedroid_deinit();
btStop();
......@@ -172,6 +175,7 @@ BluetoothSerial::BluetoothSerial()
BluetoothSerial::~BluetoothSerial(void)
{
_stop_bt();
vQueueDelete(_spp_queue);
}
bool BluetoothSerial::begin(String localName)
......@@ -262,6 +266,7 @@ void BluetoothSerial::flush()
void BluetoothSerial::end()
{
_stop_bt();
vQueueDelete(_spp_queue);
}
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册