Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/modules/ble/BLE_Suite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3644,7 +3644,7 @@ String selectTargetFromScan(const char *title) {

const int ACTIVE_SCAN_TIME = 15, PASSIVE_SCAN_TIME = 15;

tft.setCursor(20, 120);
tft.setCursor(20, tftHeight - 30);
tft.print("Active scan (15s)...");

#ifdef NIMBLE_V2_PLUS
Expand All @@ -3653,7 +3653,7 @@ String selectTargetFromScan(const char *title) {
NimBLEScanResults results = pBLEScan->start(ACTIVE_SCAN_TIME, false);
#endif

tft.setCursor(20, 140);
tft.setCursor(20, tftHeight - 15);
tft.print("Passive scan (15s)...");
pBLEScan->setActiveScan(false);

Expand Down Expand Up @@ -3720,7 +3720,7 @@ String selectTargetFromScan(const char *title) {
size_t deviceCount = scannerData.size();

if (xSemaphoreTake(scannerData.mutex, portMAX_DELAY)) {
for (size_t i = 0; i < scannerData.deviceAddresses.size() - 1; i++) {
for (size_t i = 0; scannerData.deviceAddresses.size() > 1 && i < scannerData.deviceAddresses.size() - 1; i++) {
for (size_t j = i + 1; j < scannerData.deviceAddresses.size(); j++) {
bool swapNeeded = false;
if (scannerData.deviceFastPair[j] && !scannerData.deviceFastPair[i]) swapNeeded = true;
Expand Down
5 changes: 2 additions & 3 deletions src/modules/ble/ble_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void ble_scan_setup() {
BLEDevice::init("");
pBLEScan = BLEDevice::getScan();
#ifdef NIMBLE_V2_PLUS
pBLEScan->setScanCallbacks(new NimBLEScanCallbacks());
pBLEScan->setScanCallbacks(new AdvertisedDeviceCallbacks());
#else
pBLEScan->setAdvertisedDeviceCallbacks(new AdvertisedDeviceCallbacks());
#endif
Expand Down Expand Up @@ -173,7 +173,7 @@ bool initBLEServer() {
pTxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_RX_UUID, NIMBLE_PROPERTY::NOTIFY);

pTxCharacteristic->addDescriptor(new NimBLE2904());
BLECharacteristic *pRxCharacteristic = pService->createCharacteristic(
pRxCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_TX_UUID, NIMBLE_PROPERTY::WRITE | NIMBLE_PROPERTY::WRITE_NR
);
pRxCharacteristic->setCallbacks(new MyCallbacks());
Expand Down Expand Up @@ -250,7 +250,6 @@ void disPlayBLESend() {
}

tft.setTextColor(TFT_WHITE);
pService->~NimBLEService();
pServer->getAdvertising()->stop();
#if defined(CONFIG_IDF_TARGET_ESP32C5)
esp_bt_controller_deinit();
Expand Down