Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulator and micro:bit have different behaviour for button press event when holding button #2653

Closed
jaustin opened this issue Aug 3, 2017 · 6 comments

Comments

@jaustin
Copy link

jaustin commented Aug 3, 2017

Hi all,

On the real micro:bit, press-->hold-->release of a button does not register as a 'press' however on the simulator it appears that it does:

https://makecode.microbit.org/_eKuYe6YbzR47

This program behaves differently on the micro:bit to in the simulator when you press and hold the A button. It works fine just clicking the button.

The DAL has two kinds of event, long and short click, and I suspect we're hitting the long click

https://github.com/lancaster-university/microbit-dal/blob/9adafccbf6af5adaade378a4577802f0b47a153a/source/drivers/MicroBitButton.cpp#L123

Do we configure the buttons to use simple events?

https://github.com/lancaster-university/microbit-dal/blob/9adafccbf6af5adaade378a4577802f0b47a153a/source/drivers/MicroBitButton.cpp#L39

@finneyj may be one for you?

@finneyj
Copy link

finneyj commented Aug 3, 2017

Nope - we'll be generating all the events (the simple events mode is really to supress the generation of more advanced events (click etc) which we're using MultiButton A+B etc.

If the cause for this is the LONG_CLICK (and well could be - good thinking @jaustin), then also subscribing to that event might be the easiest way forward... Alternatively, LONG_CLICK is a very rarely used feature that we could consider dropping / making a compile time option.

@HelenFoster
Copy link

#2445

Seems like the simulator only checks mouse-up.

@finneyj
Copy link

finneyj commented Aug 4, 2017

Thanks @HelenFoster

Looks like the binding to the hardware is looking for a CLICK event though:
https://github.com/Microsoft/pxt-microbit/blob/39071b56269232d0aaab69adc7c449360535a293/libs/core/input.cpp

You could consider binding to the UP even there also (MICROBIT_BUTTON_EVT_UP) ?

Joe

@finneyj
Copy link

finneyj commented Aug 4, 2017

...or expose a richer set of button events into MakeCode. ;-)

@HelenFoster
Copy link

I added DOWN and UP to the Control blocks in microsoft/pxt-microbit#468 . Didn't think it was such a good idea to add LONG_CLICK and HOLD, as that drop-down menu is getting too long now.

As you say, onButtonPressed is bound to CLICK. There are good reasons it should have been DOWN, but it can't be changed at this stage.

@lock
Copy link

lock bot commented Sep 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants