-
Notifications
You must be signed in to change notification settings - Fork 23
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
Update of Button and Pin input blocks #89
Conversation
* handle continuous state * adding shims * update rendering for continuous servos * fixing sim * fix sig * typo * fix sim * bump pxt * bump pxt
- add Button and Pin event types - merge onPinPressed & onPinReleased in new onPinEvent function - create new onButtonEvent function
ok, I see. I have to change the tests first. |
I recommend having an enum that hides DAL |
thank you, used the enum now instead of DAL. I also brought back the deprecated blocks, so they are displayed in block view when old hex files or js code is imported. |
I would recommend to create a new extension for these blocks to simplify your life w.r.t. to merging Microbit changes. Also we are trying to keep all the editors compatible so this should probably go into common packages. |
I'm not sure how this simplifies my life, since I'm still working myself into this and have to figure out how things work in pxt.
My reason for these changes are, that the block The Microbit pin and button event listeners have the same mix-up of |
I remembered this issue: microsoft/pxt-microbit#963 |
ready? |
docs/examples/gameofLife.md
Outdated
@@ -22,13 +22,13 @@ Here's a program that simulates cell life in the LED matrix. Use button ``A`` fo | |||
let lifeChart: Image = null | |||
|
|||
//Use button A for the next iteration of game of life | |||
input.onButtonPressed(Button.A, () => { | |||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? Kids should not have to deal with the DAL object. This is super ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is outdated and changed within 07fe264
docs/examples/gameofLife.md
Outdated
@@ -22,13 +22,13 @@ Here's a program that simulates cell life in the LED matrix. Use button ``A`` fo | |||
let lifeChart: Image = null | |||
|
|||
//Use button A for the next iteration of game of life | |||
input.onButtonPressed(Button.A, () => { | |||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, the other one is the outdated file, so this is what the kids will deal with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have to type Input twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, sorry. Yes, that's wrong. I`ll change that.
This change will make future merging from upstream microbit harder. |
@Amerlander I agree to pelikhan. Wait with the update of the pinevent. The standard Calliope user doesn´t see the difference. It it necessary to keep merging of microbit source easy. The Pinevents will be (perhaps) updated. Look, there is a new issue |
@MKleinSB, of course it would make sense to wait when micro bit is changing there something at all. I just wonder whether there is any plan to do this and how I could help with that. The Issue on the micro bit side was labeled with "next-release", but then removed. They said in 2018 they will introduce a fix next year, but since then there is not really any progress in the issue and also not an answer to my question. I would be glad if the issue can be closed on the side of micro bit, and we can just check in. The issue microsoft/pxt-microbit#2667 doesn't seem to target this, since its more about when a click event is triggered and when it is a long click and when its not a click at all (a down event where another event comes in between before the up event is not triggered as click anymore). And there the behavior seems to differ from simulator to hardware. |
@Amerlander If you stay working on makecode.calliope it´s ok ( for me ;-) ) |
I would recommend to create a new extension that produces the better blocks then merging would be easier. We should setup a call to discuss these things. |
onPinPressed
& theonPinReleased
blocks into a newonPinEvent
block.onButtonEvent
block, which replaces the oldonButtonPressed
one (which actually was click-listener instead of pressed)