pxt-microbit icon indicating copy to clipboard operation
pxt-microbit copied to clipboard

bluetooth problems

Open crouse12 opened this issue 2 years ago • 2 comments

Problem One: I choose "No Pairing Required: Anyone can connect via Bluetooth" to make my microbit program. The same program have different conditions on microbit v1 and v2. https://drive.google.com/file/d/1InGlHbB7_ZxIO_FFYtJubk1rWTqvN6aw/view?usp=sharing Microbit v1 asks password. Without password, I cannot pair microbit v1. However, I don't set it.

Screenshot_20231128_200622_Settings

However, microbit v2 doesn't ask any password, so I can pair microbit v2.

Screenshot_20231128_200801_Settings

Problem TWO: Bluetooth option one and Bluetooth option two are upside down. When I choose "No Pairing Required", I still need pair microbit. When I choose "JustWorks pairing (default)", I don't need pair microbit.

image

crouse12 avatar Nov 28 '23 12:11 crouse12

@martinwork can you triage this and let me know what needs to be done here?

abchatra avatar Feb 13 '24 18:02 abchatra

@abchatra I think this is essentially the same problem as https://github.com/microsoft/pxt-microbit/issues/5336 and https://github.com/microsoft/pxt-microbit/issues/4378.

MakeCode often does not use changes to the settings in the next project build.

It's not really a Bluetooth problem. I have noticed the same issue when editing the settings as text to change or add config macros, including ones not related to Bluetooth. It can be difficult to persuade it to use the changes at all.

Try this project https://makecode.microbit.org/_dTUdb0cvfHJp . It uses an extension to dump the config macros to serial, so you don't have to use Bluetooth to see the problem.

  • Download to micro:bit
  • Choose Show data Device
  • Press RESET on micro:bit to see the settings
  • See "MICROBIT_BLE_SECURITY_LEVEL = SECURITY_MODE_ENCRYPTION_NO_MITM"
  • Change to "no pairing", and repeat.

I just tried it and found there was no long compilation after the change, and MICROBIT_BLE_SECURITY_LEVEL was unchanged. I tried everything to get it build the "no pairing" version: reload the project, etc.

Eventually, I changed the setting back to just works. That triggered building the "no pairing" version! Now I can switch between pairing modes, but they are the wrong way round compared to the settings (see Problem TWO above).

I haven't noticed the reversal before, so that may be new, but there has been something wrong since v3.

martinwork avatar Feb 13 '24 23:02 martinwork