Skip to content

Conversation

@microbit-matt-hillsdon
Copy link
Contributor

@microbit-matt-hillsdon microbit-matt-hillsdon commented Jan 5, 2026

This contains breaking changes (e.g. flash progress interface, connect
signature, device error codes) and will form part of a v1 at some point.
Migrating USB-only code should be trivial though.

Changes:

  • Switch to capacitor-ble for bluetooth

    • Quite a simplication as the service/characteristic lookups are deferred to
      point of use and the interactions are internally queued.
  • Support DFU and partial flashing on iOS/Android platforms

  • Drop a bunch of workarounds that need reevaluating after the switch

  • Temporarily drop uBit name support due to capacitor-ble limitation

  • Don't try to start notifications on absent services. Prevents issues when not
    in application mode for a flash.

  • Improve connect interface (which had a misleading return value) and
    connect/flash progress.

This branch is going to be long lived for a month or two during apps work, then
we'll loop back around and see what it means for Web Bluetooth - does it
replace it or do we have both implementations.

Design issues:

  • Should connecting and connecting for flashing both be the same flow? Or are
    the ideas different enough that we split them? It's nice in that it matches
    USB but it's also quite different because of pairing.

TODO:

  • Test in web, reinstate workarounds as needed, decide whether to use capacitor implementation for web (check bundles size)

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 5, 2026

Deploying microbit-connection with  Cloudflare Pages  Cloudflare Pages

Latest commit: 90a9e79
Status: ✅  Deploy successful!
Preview URL: https://75387384.microbit-connection.pages.dev
Branch Preview URL: https://apps.microbit-connection.pages.dev

View logs

This contains breaking changes (e.g. flash progress interface, connect
signature, device error codes) and will form part of a v1 at some point.
Migrating USB-only code should be trivial though.

Changes:
- Switch to capacitor-ble for bluetooth
  - Quite a simplication as the service/characteristic lookups are deferred to
    point of use and the interactions are internally queued.

- Support DFU and partial flashing on iOS/Android platforms
- Drop a bunch of workarounds that need reevaluating after the switch
- Temporarily drop uBit name support due to capacitor-ble limitation
- Don't try to start notifications on absent services. Prevents issues when not
  in application mode for a flash.
- Improve connect interface (which had a misleading return value) and
  connect/flash progress.

This branch is going to be long lived for a month or two during apps work, then
we'll loop back around and see what it means for Web Bluetooth - does it
replace it or do we have both implementations.

Design issues:

- Should connecting and connecting for flashing both be the same flow? Or are
  the ideas different enough that we split them? It's nice in that it matches
  USB but it's also quite different because of pairing.
- Use .js extension for imports consistently
- Fix typo in exports for types (also on main, but at least VS Code seems to cope)
This might be a behaviour change for bluetooth but is consistent with USB.
For USB there's not really anything to do but let's keep it consistent
This has caused app-level issues because disconnected doesn't let the app understand that
a reconnect will automatically happen.
You can want to pause due to a hidden tab, but defer it due to flashing then
become visible before you ever did pause. But we went ahead with the pause
incorrectly.
Remove them from the connection status.

Check them before connect but also provide pre-flight API for UX flows.

This better matches the iOS/Android permission model and is easier for client
code to manage.
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