Skip to content

Commit 2af80e4

Browse files
committed
Update variables ofscan time and scan end for NimBle 2.1.3
1 parent bcf9ce1 commit 2af80e4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/XboxSeriesXControllerESP32_asukiaaa.hpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ class ScanCallbacks : public NimBLEScanCallbacks {
132132
advDevice = advertisedDevice;
133133
}
134134
}
135+
136+
void onScanEnd(const NimBLEScanResults& scanResults, int reason) override {
137+
#ifdef XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL
138+
XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL.println("Scan Ended");
139+
#endif
140+
}
135141
};
136142

137143
class Core {
@@ -236,8 +242,7 @@ class Core {
236242
#ifdef XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL
237243
XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL.println("Start scan");
238244
#endif
239-
// assign scanCompleteCB to scan on other thread
240-
pScan->start(scanTime, &Core::scanCompleteCB, false);
245+
pScan->start(msScanTime);
241246
}
242247

243248
XboxControllerNotificationParser xboxNotif;
@@ -255,7 +260,7 @@ class Core {
255260
private:
256261
ConnectionState connectionState = ConnectionState::Scanning;
257262
unsigned long receivedNotificationAt = 0;
258-
uint32_t scanTime = 4; /** 0 = scan forever */
263+
uint32_t msScanTime = 4000; /** 0 = scan forever */
259264
uint8_t countFailedConnection = 0;
260265
uint8_t retryCountInOneConnection = 3;
261266
unsigned long retryIntervalMs = 100;
@@ -527,12 +532,6 @@ class Core {
527532
#endif
528533
}
529534
}
530-
531-
static void scanCompleteCB(NimBLEScanResults results) {
532-
#ifdef XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL
533-
XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL.println("Scan Ended");
534-
#endif
535-
}
536535
};
537536

538537
}; // namespace XboxSeriesXControllerESP32_asukiaaa

0 commit comments

Comments
 (0)