diff --git a/CHANGELOG.md b/CHANGELOG.md index 545218cf..3d4c607d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,10 @@ ### Fixed - Fixed app freezing when checking for updates and update server is unreachable ([pybricks-code#1299]). +- Added delay to try to mitigate errors when flashing firmware on city hubs ([support#792]). [pybricks-code#1299]: https://github.com/pybricks/pybricks-code/issues/1299 +[support#792]: https://github.com/orgs/pybricks/discussions/792 ## [2.0.0-beta.10] - 2022-11-11 diff --git a/src/firmware/sagas.ts b/src/firmware/sagas.ts index 6ef85cc5..f64bb5ea 100644 --- a/src/firmware/sagas.ts +++ b/src/firmware/sagas.ts @@ -393,6 +393,12 @@ function* handleFlashFirmware(action: ReturnType): Generat return; } + // istanbul ignore if + if (process.env.NODE_ENV !== 'test') { + // give OS Bluetooth stack some time to settle + yield* delay(1000); + } + const nextMessageId = yield* getContext<() => number>('nextMessageId'); const infoAction = yield* put(infoRequest(nextMessageId()));