Code: Select all
BLEDevice::init("");
pBLEScan = BLEDevice::getScan(); //create new scan
if (pBLEScan)
{
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
pBLEScan->setActiveScan(true); //set passive scan; active scan uses more power, but get results faster
pBLEScan->setInterval(100);
pBLEScan->setWindow(99); // less or equal setInterval value
BLEScanResults foundDevices = pBLEScan->start(5,false);
pBLEScan->stop();
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
delete pBLEScan;
pBLEScan=0;
}
BLEDevice::deinit(true);
The whole Bluetooth-stuff is completely initialised and removed on every call due to memory problems - when I do not release this stuff completely, my application lacks enough memory./home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1443 (xQueueGenericReceive)- assert failed!
Any idea what is wrong and how I can avoid this crash?
Thanks!