1

我正在尝试在 ESP32 上使用 BLE 和 WiFi。正如我所见,它们不能同时使用,所以我试图找出一种方法来停止从 BLE 服务器接收数据。这是我迄今为止尝试过的停止 BLE 的方法:

btStop();
esp_bt_controller_disable();
esp_bluedroid_disable();

然而,似乎没有一个工作。ESP32 应该连接到 WiFi(使用 WiFiManager),但是当我尝试连接到 Firebase 或 Twilio 时,连接被拒绝。在尝试连接到 Firebase 之前,我有 35000 个空闲堆和 twilio 80000。那么,有没有办法检查 BLE 扫描/连接是否已停止?是否有任何其他命令可以将其关闭?可能是我的堆用完了,因此我无法连接到 Firebase?

4

2 回答 2

2

You're currently missing a couple of deinit calls

esp_bluedroid_disable();
esp_bluedroid_deinit();  //**
esp_bt_controller_disable();
esp_bt_controller_deinit(); //**

You might also have to ensure Wi-Fi hasn't been started while BLE was enabled, you can init, but starting might cause issues where it starts trying to use the radio immediately

于 2021-07-09T16:06:20.180 回答
0

如果您使用的是 BLEDevice 库,请尝试以下操作:

 BLEDevice::deinit(true);
于 2021-07-24T15:30:47.867 回答