microbit-foundation / microbit-swift-playgrounds

We've built a Swift Playground that lets you program the micro:bit. This also includes a Swift API for interacting with the micro:bit.
https://microbit.org/guide/swift-playgrounds/
Other
22 stars 8 forks source link

Pairing/connecting in app is unreliable #33

Open microbit-mark opened 4 years ago

microbit-mark commented 4 years ago

Describe the bug The in-app pairing and connecting process no longer seems to work as expected.

Using the updated pairing Univeral hex from https://microbit.org/get-started/user-guide/mobile/#prepare-your-micro:bit

The process seems to be to attempt the pairing process which fails by saying it cannot find the micro:bit, exit the app, restart the app which then asks for Bluetooth permissions and then the micro:bit sometimes pairs and connects, but often doesn't.

Hard to reproduce

To Reproduce Steps to reproduce the behavior:

Ensure previously paired micro:bits have been removed in settings

  1. Flash pairing Hex from https://microbit.org/get-started/user-guide/mobile/#prepare-your-micro:bit or MakeCode https://makecode.microbit.org/_DMye9YMmiaqj (removing services has no effect)
  2. Enter pairing mode and open app
  3. Attempt pairing, which fails saying check the LEDs
  4. Exit app and check Settings, micro:bit is not paired
  5. Re-enter app, Bluetooth access is requested
  6. Attempt pairing, fails again
  7. Repeat 4. - 6. multiple times

On the odd occasion the micro:bit pairs and connects and you can run code, but this is sporadic.

micro:bit: V1 and V2 micro:bit playground: 1.1.0 swift version: 3.4 iOS: 13.5.1

Expected behavior A clear and concise description of what you expected to happen.

Screenshots/recordings Add screenshots and recordings to help explain your problem. You can copy and paste the screenshot or screenrecording in the github report. (screen recordings will need to be in .gif format or attached as a .zip file)

iPad

Additional context Add any other context about the problem here.

microbit-mark commented 4 years ago

@microbit-pauline @martinwork can you check this on your iOS devices. Playground is also available on Mac https://microbit.org/get-started/user-guide/mobile/#swift-playgrounds

martinwork commented 4 years ago

Got there in the end! After subscribing to the microbit book and entering the right LEDs pattern, it says paired first time. I had also forgotten all previous pairings in Settings/Bluetooth. Connect to micro:bit leads to error 020. It works after I removed the UART service.

martinwork commented 4 years ago

The above was with a V1. With V2 it says "...may have been flashed since" and suggests forgetting the pairing. But it hasn't been paired. Tried several times. Paired with iOS app and tried again. No luck.

microbit-mark commented 4 years ago

@gary-atkinson had a couple of people report problems now. I'm not sure if this is due to updates in Swift and/or Bluetooth on the V2 device. Are you able to take a look?

gary-atkinson commented 4 years ago

I need to get hold of a V2 device as I do not currently have one. Is it just the V2 micro:bit that is causing the issues?

On 1 Dec 2020, at 10:01, Mark notifications@github.com wrote:

@gary-atkinson https://github.com/gary-atkinson had a couple of people report problems now. I'm not sure if this is due to updates in Swift and/or Bluetooth on the V2 device. Are you able to take a look?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microbit-foundation/microbit-swift-playgrounds/issues/33#issuecomment-736369249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJO26U5YEZIWRQXAQJJDHC3SSS5JFANCNFSM4UCCZRPQ.

microbit-mark commented 4 years ago

It's buggy with V1 as well for me, so worth checking with both boards. We'll ship you a V2.


From: Gary J.H. Atkinson notifications@github.com Sent: 01 December 2020 19:49 To: microbit-foundation/microbit-swift-playgrounds microbit-swift-playgrounds@noreply.github.com Cc: Mark Williams mark@microbit.org; Author author@noreply.github.com Subject: Re: [microbit-foundation/microbit-swift-playgrounds] Pairing/connecting in app is unreliable (#33)

I need to get hold of a V2 device as I do not currently have one. Is it just the V2 micro:bit that is causing the issues?

On 1 Dec 2020, at 10:01, Mark notifications@github.com wrote:

@gary-atkinson https://github.com/gary-atkinson had a couple of people report problems now. I'm not sure if this is due to updates in Swift and/or Bluetooth on the V2 device. Are you able to take a look?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microbit-foundation/microbit-swift-playgrounds/issues/33#issuecomment-736369249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJO26U5YEZIWRQXAQJJDHC3SSS5JFANCNFSM4UCCZRPQ.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microbit-foundation/microbit-swift-playgrounds/issues/33#issuecomment-736778740, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHOLU7M6OXOJ24OETULDRBTSSVCDDANCNFSM4UCCZRPQ.

microbit-mark commented 3 years ago

@gary-atkinson did you get your V2 board? Wondering if you've had a chance to test the Playground book with it.

gary-atkinson commented 3 years ago

Yes the boards have arrived. I need to update you with my new address but I do now have them. I have been moving house over the last week but will try and do some tests later this week or over the weekend.

On 6 Jan 2021, at 09:02, Mark notifications@github.com wrote:

@gary-atkinson https://github.com/gary-atkinson did you get your V2 board? Wondering if you've had a chance to test the Playground book with it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microbit-foundation/microbit-swift-playgrounds/issues/33#issuecomment-755175409, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJO26UZMU7KUQZFDXVGXPODSYQRMFANCNFSM4UCCZRPQ.

gary-atkinson commented 3 years ago

Tested on the latest iPad Air Gen 4, iOS 14.3 and Playgrounds app 3.4 These are the latest versions of everything Apple and iOS related. The playground book is the currently published book, version 1.2.0

On a V1 board There are definitely issues with the hex file downloaded from the micro:bit website. I managed to get it to pair first time but then there were issues with connecting.

On reverting to my ‘old’ hex file that I used for development and that is dated 20/12/2019 this attempted to connect to the micro:bit from a saved configuration which was only resolved by resetting the book. I also removed the pairing from the Bluetooth in iOS Settings. After this it paired successfully first time, connects consistently and works as expected with the playground book.

*My hex file of Bluetooth services created from new MakeCode. I flashed this to the V1 board too and it successfully paired but on resetting the micro:bit it reported the error code 020 suggesting that the micro:bit had run out of memory enabling Bluetooth with the new hex code.

On a V2 board Using the hex file from the micro:bit site did not managed a pairing at all.

My legacy hex file does not work with an error code: 529

I recreated a hex file from MakeCode using the same blocks as my legacy hex file. This flashed and booted but it still failed to pair in exactly the same way. Yes you do get a message about removing the device from Settings but this is not the problem.

This is the same ‘new’ hex file I tested with the V1 board too.

In conclusion The v1 board, flashed with a legacy bluetooth hex file pairs; connects and works exactly as expected. This is despite many changes to iOS hardware, iOS operating system and Playground app. We cannot look to issues with Apple or the current playground book in terms of ‘what has been changed / broken.

The issue appears to be somewhere within the micro:bit hardware / DAL / MakeCode. For me to investigate this any further I will need to speak with Jonny.