-
Notifications
You must be signed in to change notification settings - Fork 639
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
Make pin parameters variable #5700
Conversation
@carlosperate @jaustin can you review this and let us know if these changes to blocks are ok? |
Is there any user facing impact to the blocks and/or the javascript API? If so, can we get a before and after screenshot? |
Do you know any good methods for testing equality that children can use? |
Thanks for the screenshot @sae220! What about the Javascript pin API, how does the code change? |
Sorry, but I can't understand well. You mean you want to check for equality of different pins?
As far as I know, there are no code changes in JavaScript. |
I have two variables with pin. |
So you mean you want to compare obviously inequal pins (like Sorry for my poor English. |
Some pins are stored in a variable. How do we know afterwards which pin is in the variable? How can we check if a specific pin is present in the variable? |
I'm very sorry, but I can't understand the situation well. |
@sae220
|
@abchatra |
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.
LGTM!
This needs upgrade rules to ensure backwards compat with old projects
Also needs new docs pages for the two new blocks
...but we can just file an issue for that and do it later
@sae220 thanks for contribution. There are few follow ups: upgrade rules for existing projects and doc pages update. If you can file issues for the same it would be great. If you want to tackle the upgrade rules feel free to do so as well. |
@sae220 it's all in this file: https://github.com/microsoft/pxt-microbit/blob/master/editor/patch.ts basically just need to add some code that converts the old xml to the new one, just like you did for the test code |
Also @sae220 you should be able to see the new block in /beta now. Greatly appreciate the work. |
@abchatra would you like us to raise a new issue or continue talking here for feedback on these changes? Two things that seem confusing right away:
Should there be some typing that means this isn't possible? The blocks now read in a more cumbersome and confusing way |
@jaustin But it isn't caused by this pr that the getter method To solve other problem, what do you think about the integration of |
@abchatra |
@abchatra looks like the change in the blocks is causes issue loading older projects, like in #5728. Even if the generated code is identical the change in the blocks themselves seems to be causing this issue. |
We can fix the update issues. |
@microbit-carlos @abchatra |
Thanks for all the work on these PRs @sae220! I have a few suggestions, which might be worth considering as I think it'd likely affect #5712 as well. To reduce the block visual difference, and word redundancy (
We can probably create a separate block with just the pin name, that is only used as a shadow block for other pin blocks. So my suggestion to this PR would be something like this:
And so the change between MakeCode v6 and v7 would be very small:
@abchatra having this smaller digital/analog pin block to serve only as a shadow block something you'd consider accepting? We can still keep the new pin blocks, as these are new and they also need to be self explanatory on their own: Another change that would be needed is to revert back the pulse event block, or to change it in a way that doesn't let the user add a variable for of the pin: This is because unfortunately the code generation can end up placing the event handler code on top of the "on start" code, and so we might end up with an undefined variable: As a separate conversation we might need to consider if the "analog pin" block can be improved in the future as well, as something like this code snippet should not work, but MakeCode doesn't show any errors and it even works in the simulator: And to clarify, this was not introduced in this PR, it has been like this in MakeCode for a very long time, but this PR makes it a bit more obvious as a user creating a list of pins now needs to choose between selecting a "digital pin" vs an "analog pin". I've created this issue to discuss this problem: |
@microbit-carlos To solve second point, how about fix compiling code to bring |
#5558
microsoft/pxt#10015