Skip to content

Commit f853d0b

Browse files
committed
FIX - Fix Crazyflie scanning after recent change in Firmware #97
#97
1 parent 4e7957f commit f853d0b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/se/bitcraze/crazyfliecontrol/ble/BleLink.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord)
240240
if (device != null && device.getName() != null) {
241241
mLogger.debug("Scanned device \"" + device.getName() + "\" RSSI: " + rssi);
242242

243-
if (device.getName().equals(CF_DEVICE_NAME) && rssi>rssiThreshold) {
243+
if (device.getName().startsWith(CF_DEVICE_NAME) && !device.getName().equals(CF_LOADER_DEVICE_NAME) && rssi > rssiThreshold) {
244244
stopScan();
245245
if (mScannTimer != null) {
246246
mScannTimer.cancel();
@@ -262,6 +262,7 @@ public void run() {
262262
private void scan () {
263263
// Filtered scan
264264
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
265+
//FIXME
265266
ScanFilter cfFilter = new ScanFilter.Builder().setDeviceName(CF_DEVICE_NAME).build();
266267
mBluetoothLeScanner.startScan(Arrays.asList(cfFilter), new ScanSettings.Builder().build(), mScanCallback21);
267268
} else {
@@ -320,7 +321,7 @@ public void onScanResult(int callbackType, ScanResult result) {
320321
if (device != null && device.getName() != null) {
321322
// mLogger.debug("Scanned device \"" + device.getName() + "\" RSSI: " + rssi);
322323

323-
if (device.getName().equals(CF_DEVICE_NAME) && rssi > rssiThreshold) {
324+
if (device.getName().startsWith(CF_DEVICE_NAME) && !device.getName().equals(CF_LOADER_DEVICE_NAME) && rssi > rssiThreshold) {
324325
stopScan();
325326
if (mScannTimer != null) {
326327
mScannTimer.cancel();

0 commit comments

Comments
 (0)