-
Notifications
You must be signed in to change notification settings - Fork 289
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
💻 Implemented "is" and sleep command for Micro:bit for level 2 #5587
Conversation
for more information, see https://pre-commit.ci
Cleaning the code a bit adding the sleep command and setting the feature flag to false
…to Microbit-Level_1
for more information, see https://pre-commit.ci
…to Microbit-Level_1
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.
As agreed during the meeting with Teodor:
- I am converting both PRs to draft, since some changes are needed
- All added whitespacing needs to be removed from the microbit transpiler and added where the program is put together with the
while True:
cycle. - Tests need to be added for the commands that are changed (the extent depends on the overall status of the project)
Got rid of the white spaces in the transpiler. Modified the save_transpiled_code_for_microbit function to display microbit code properly.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
The assign function now checks if the value is string it encapsulates it in ' ' if it is a number there will be no ' '
…to Microbit-Level_1
While looking at your code I see that you generate a file in the backend and then send it to the frontend, where it downloads. What would happen if there are concurrent calls to the endpoint? I'm pretty sure that will cause either slowdowns or race conditions. I think that a much better approach would be to send the transpiled code to the front-end and generate the file directly in the user's machine, this will prevent having to write to disc for every call. |
Do we do that for dst files too (if not, that is probably a wise idea!) Maybe we can combine this into one part of the code that does that? |
I just checked and for those files we generate a unique random filename, this would also prevent race conditions in this case! |
That's a good idea. I basically did the same was as we are doing the files for the turtle. I had some issues converting the file to hex that's why i used he same name for the file. After your comment i'll try to use a random file name. |
for more information, see https://pre-commit.ci
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.
fixed
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Added the assignment to a variable from level 2 in Hedy to Micro:bit
Added sleep functionality for Micro:bit
How to test
Follow these steps to verify this PR works as intended:
Open Hedy and choose level 2. Assign a variable and then print it. This will generate a hex file that can be uploaded here:
https://python.microbit.org/v/3/reference.
You should see the correct python code after you upload the file.
If you're unsure about any of these, don't hesitate to ask. We're here to help!