Skip to content

Support flashing a hex that needs a pin #741

@microbit-grace

Description

@microbit-grace

We need to support flashing over a hex that needs a pin. Existing radio bridge programs (remote and bridge) require pins to connect to.

For Android

  • If the micro:bit is not paired according to Bluetooth settings, we can full flash successfully over a micro:bit that requires a pin.
  • If the micro:bit is paired (without pin) according to Bluetooth settings, the pairing process with pin works and the micro:bit can get bonded, but the flashing process fails and the user would need to re-try to flash.
    • The Android micro:bit app appears to work ok for this case (pairs and flashes successfully).
    • When the app thinks that the micro:bit is already paired, it calls BleClient.connect, which raises the pairing dialog because it is not properly paired. This bug means that the connect resolves before the user has responded to the pairing dialog and continues to partial flash without re-pairing with pin. The process fails and is stopped to a halt in startNotifications in partial flashing, and a timeout error is thrown because an unanticipated pairing dialog with pin is triggered and it takes a while for a pin to be entered by the user.
10:32:02.513  I  File: http://192.168.1.104:5173/@fs/Users/grace/Code/microbit-connection/packages/microbit-connection/src/logging.ts - Line 9 - Msg: Got board version V2
10:32:02.517  D  setCharacteristicNotification() - uuid: e97d3b10-251d-470a-a062-fa1922dfa9a8 enable: true
10:32:06.798  D  onConnectionUpdated() - Device=XX:XX:XX:XX:B2:62 interval=15 latency=0 timeout=400 status=0
10:32:07.526  D  reject: writeDescriptor|e97dd91d-251d-470a-a062-fa1922dfa9a8|e97d3b10-251d-470a-a062-fa1922dfa9a8|00002902-0000-1000-8000-00805f9b34fb Setting notification timeout.
10:32:07.534  E  File: http://192.168.1.104:5173/@fs/Users/grace/Code/microbit-connection/packages/microbit-connection/src/logging.ts - Line 6 - Msg: Partial flash failed Error: Setting notification timeout.
10:32:07.535  E  File: http://192.168.1.104:5173/@fs/Users/grace/Code/microbit-connection/packages/microbit-connection/src/logging.ts - Line 6 - Msg: Failed to flash Error: Setting notification timeout.

Possible solution for Android:

  • Add starting and stopping of notifications check when checking whether micro:bit is bonded (here so that we are not just relying on BleClient.isBonded).

For iOS

  • [Similar to Android] If the micro:bit is not remembered to be paired by the app, we can full flash successfully over a micro:bit that requires a pin.
  • [Same as Android] If the micro:bit is paired (without pin), the pairing process with pin works and the micro:bit can get bonded, but the flashing process fails and the user would need to re-try to flash.
    • The iOS micro:bit app also fails with "Please Retry. Resetting micro:bit to Bluetooth mode may help." dialog. Trying again works.
⚡️  [log] - Got board version V2
⚡️  BluetoothLe - Set notifications true
⚡️  BluetoothLe - Reject setNotifications|E97DD91D-251D-470A-A062-FA1922DFA9A8|E97D3B10-251D-470A-A062-FA1922DFA9A8 Set notifications timeout.
ERROR MESSAGE:  {"errorMessage":"Set notifications timeout.","message":"Set notifications timeout."}
⚡️  [error] - {"errorMessage":"Set notifications timeout.","message":"Set notifications timeout."}
⚡️  [error] - Partial flash failed {"errorMessage":"Set notifications timeout."}
⚡️  [error] - Failed to flash {"code":"flash-partial-failed"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions