Skip to content

Upgrade connection library to v1.0.0-beta.0 for serial fixes#1238

Merged
microbit-matt-hillsdon merged 4 commits intomainfrom
upgrade-connection-library
Apr 29, 2026
Merged

Upgrade connection library to v1.0.0-beta.0 for serial fixes#1238
microbit-matt-hillsdon merged 4 commits intomainfrom
upgrade-connection-library

Conversation

@microbit-matt-hillsdon
Copy link
Copy Markdown
Collaborator

@microbit-matt-hillsdon microbit-matt-hillsdon commented Mar 6, 2026

This contains the pre-1.0 breaking API changes and USB serial re-work.

This should improve serial issues after first physical connection + flash and extra serial from previous programs leaking into subsequent ones.

I've also changed the default logger to a console logger as it's annoying to get less log output without the micro:bit theme - particularly important for testing the connection library and getting its logs.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

This contains the pre-1.0 breaking API changes and USB serial re-work.

This should improve serial issues after first physical connection + flash and
extra serial from previous programs leaking into subsequent ones.

This is a preview version for testing on a review branch, we won't merge this
directly.
This has the UICR fix and the last of the breaking changes.
@microbit-grace
Copy link
Copy Markdown
Contributor

microbit-grace commented Apr 29, 2026

Mostly looks good. Found 2 things whilst testing:

  1. Switching tabs doesn't seem to pause serial in the same way we do in live.
    Update [not an issue]: I think it's because I had devtools opened with "Emulate a focused page" checked. Once I closed devtools or unchecked the option, it was working fine.

  2. When I CTRL+D (soft reboot) in the serial window multiple times and then interrupt the program (CTRL+C), it soft reboots automatically after interruption. This happens in live. Not sure if it is a bug.

@microbit-matt-hillsdon microbit-matt-hillsdon marked this pull request as ready for review April 29, 2026 11:25
@microbit-matt-hillsdon microbit-matt-hillsdon changed the title [DO NOT MERGE] Upgrade connection library to preview version Upgrade connection library to 1.0.0-beta.0 for serial fixes Apr 29, 2026
@microbit-matt-hillsdon microbit-matt-hillsdon changed the title Upgrade connection library to 1.0.0-beta.0 for serial fixes Upgrade connection library to v1.0.0-beta.0 for serial fixes Apr 29, 2026
@microbit-grace
Copy link
Copy Markdown
Contributor

microbit-grace commented Apr 29, 2026

Connect and flash error handling seems to match changes in DeviceErrorCode -

private async handleWebUSBError(
e: any,
userAction: ConnectionAction,
finalFocusRef: FinalFocusRef
) {
if (e instanceof DeviceError) {
switch (e.code) {
case "unsupported":
this.webusbNotSupportedError(finalFocusRef);
return;
case "no-device-selected": {
// User just cancelled the browser dialog, perhaps because there
// where no devices.
await this.handleNotFound(userAction, finalFocusRef);
return;
}
case "device-disconnected": {
// The UI will already reflect the disconnection.
return;
}
case "firmware-update-required":
await this.handleFirmwareUpdate(e.code, userAction, finalFocusRef);
return;
case "device-in-use":
return this.handleDeviceInUseError(finalFocusRef);
case "timeout":
return this.handleTimeoutError(finalFocusRef);
case "connection-error":
return this.handleConnectionError(finalFocusRef);
default: {
return this.actionFeedback.unexpectedError(e);
}
}
} else {
this.actionFeedback.unexpectedError(e);
}
}

@microbit-matt-hillsdon microbit-matt-hillsdon merged commit e6b4a7d into main Apr 29, 2026
1 check passed
@microbit-matt-hillsdon microbit-matt-hillsdon deleted the upgrade-connection-library branch April 29, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants