microsoft / microsoft/pxt-microbit

Pressing buttons too long returns nothing after release

Open
#5,445 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

apis
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

Describe the bug
When pressing button A, B or A+B for more than about 3 second, nothing happens.
Carlos Pereira told me last week on Bett that might be due to a planned long press that never came into use.

A clear and concise description of what the bug is.

To Reproduce
(makecode javascript:)

input.onButtonPressed(Button.A, function () {
basic.showString("A")
})
input.onButtonPressed(Button.B, function () {
basic.showString("B")
})
basic.clearScreen()
basic.forever(function () {

})

Steps to reproduce the behavior:
Press and hold button A for more than 3 seconds

Expected behavior
Nothing happens even after releasing the button.

micro:bit version (please complete the following information):
I believe it applies to all versions (I am using the V2 micro:bit and latest official makecode)

Additional context
Say you have a microbit acting as a remote for a drone or hovercraft. You are instructed to press A + B to start the vehicle. Often people press and hold too long so they don´t get to start it. We have to tell them "To quickly press and release A+B" which is less practical.

It would be much better if the key press resulted in immediate action as soon as the key was pressed (not upon release), or at least upon release but no matter how long it was hold.

Or: Enabling long press for buttons A, B and A+B, which would give a lot more options.

Currently, there seems to be no option for a long press event (see screen shot)

Screenshot 2024-01-30 at 16 10 35

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied MakeCode JavaScript reproduction on the micro:bit and holding A, B, and A+B for more than three seconds. No source files or tests are named, so trace the button-event entry point and first clarify whether the intended behavior is immediate action, action on release, or a long-press event. Done should include reliable behavior after long holds and coverage for the affected button combinations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.