Skip to content

Commit 6f91c57

Browse files
committed
firmware/sagas: add delay after connecting
This adds a delay after connecting to a hub when flashing firmware via BLE before sending any commands. This gives the OS Bluetooth stack time to finish enumerating the Bluetooth device before we start trying to interact with the device. Hopefully this fixes issues for some people who are seeing problems while flashing firmware. Issue: https://github.com/orgs/pybricks/discussions/792
1 parent b2e098f commit 6f91c57

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66

77
### Fixed
88
- Fixed app freezing when checking for updates and update server is unreachable ([pybricks-code#1299]).
9+
- Added delay to try to mitigate errors when flashing firmware on city hubs ([support#792]).
910

1011
[pybricks-code#1299]: https://github.com/pybricks/pybricks-code/issues/1299
12+
[support#792]: https://github.com/orgs/pybricks/discussions/792
1113

1214
## [2.0.0-beta.10] - 2022-11-11
1315

src/firmware/sagas.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,12 @@ function* handleFlashFirmware(action: ReturnType<typeof flashFirmware>): Generat
393393
return;
394394
}
395395

396+
// istanbul ignore if
397+
if (process.env.NODE_ENV !== 'test') {
398+
// give OS Bluetooth stack some time to settle
399+
yield* delay(1000);
400+
}
401+
396402
const nextMessageId = yield* getContext<() => number>('nextMessageId');
397403

398404
const infoAction = yield* put(infoRequest(nextMessageId()));

0 commit comments

Comments
 (0)