mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-15 02:54:07 +00:00
ble: add 1 second delay after connecting
This might help with some people that have connection issues where the OS is still busy enumerating the device when we are trying to read characteristics.
This commit is contained in:
@@ -10,6 +10,7 @@ import { Task, buffers, eventChannel } from 'redux-saga';
|
||||
import {
|
||||
call,
|
||||
cancel,
|
||||
delay,
|
||||
fork,
|
||||
put,
|
||||
select,
|
||||
@@ -164,6 +165,12 @@ function* handleBleConnectPybricks(): Generator {
|
||||
|
||||
defer.push(() => server.disconnect());
|
||||
|
||||
// istanbul ignore if
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
// give OS Bluetooth stack some time to settle
|
||||
yield* delay(1000);
|
||||
}
|
||||
|
||||
const deviceInfoService = yield* call(() =>
|
||||
server.getPrimaryService(deviceInformationServiceUUID).catch((err) => {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user