You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With MICROBIT_BLE_PAIRING_MODE =0, adding uBit.sleep(100) before the uBit.buttonA.isPressed() (which happens in uBit.init() when pairing mode is enabled) seems to resolve the issue. 🤔
Essentially it takes 8 ticks (32ms) before isPressed() can return true, and the first call happens in the Button constructor.
The issue for button A and B were introduced in v0.2.60, in commit d083143. This is because as part of that refactor there was two 10ms delays (one in the Acc and another in the Mag constructors), but the LSM only needs ~7ms, so this was reduced from 20ms to 7ms. This reduced the uBit initialisation time by 13ms, which is long enough for this issue to appear. To confirm this, adding a 12ms delay before buttonA.isPressed() is enough for it to return the correct value.
The reason the issue is not triggered when MICROBIT_BLE_PAIRING_MODE is enabled is because this feature adds additional time in the uBit.init(), when it checks the button state for entering pairing mode when A+B are pressed on startup.
Simple program, on startup if Button A is pressed it displays the letter
A
, otherwise?
:MICROBIT.hex.zip
A
✅?
❌The text was updated successfully, but these errors were encountered: