-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Implement working program slots #266
Conversation
Yes!. On the spike prime, however: test program: from pybricks import version
print(f'version {version}') pybricksdev with debug:
|
Ah, I forgot about that -- there is probably a remnant of an old program still on your hub 😄 This will normally automatically resets between new firmware versions, but the version hasn't been bumped yet. I've been thinking to add a way for users to delete all their programs. Looks like a good use case for us developers/testers too. |
So I should install a say 3.4 firmware first and re-try? |
Try this version: firmware.zip. |
That helps! Thank you. |
Some loose notes:
So far for now. Thank you both for the fun with pybricks. Bert |
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.
I would much prefer to see slots saved to external flash when not in use rather than trying to keep all slots in RAM at the same time. Otherwise, we are wasting a lot of RAM.
Sure, though in that case I suppose we should probably make the jump to a proper file system. In the mean time, you have to try quite hard to make 5x 20K sized programs, and you'll still have way more RAM remaining than what we have on any of the other hubs. Since this PR is a fairly small change, it seems like a step worth taking. |
I think we could potentially set |
Just a remark after using the slots for some time. Maybe (very much) later an indication in the source to indicate which program slot this source is targetted? |
Right - the thinking is to merge this with slots disabled until further notice 🙂
We could indeed make this persistent. For now the thinking was to always start at slot 0 so you can operate it without even seeing the display. (But I suppose that could still work if this was persistent.) |
6341d09
to
de84b9b
Compare
Merging with slot UI disabled on all hubs. Further discussion with various notes from here are collected in pybricks/support#1799 |
This is a closed issue, but I did not know what would be the best place to add this. Had this before 😉 but my impression was that it was fixed.
installed the firmware from your remark here above installed CI build 3565 over it and then all is OK. Is the "old program data" still on the hub if we install a current CI build? |
Firmware released from now on will delete old programs. The 3.5.0 firmware did not. So if download a program to a 3.6.0 firmware hub and then switch back to 3.5.0, the program still on the hub may not run, and shut down the hub. But you should be able to download new programs without issue. So when you say:
Did you mean you just pressed the hub button to start the saved program, or did running new 3.5.0 programs fail? |
Sorry for the confusion, Laurens.
Trying to run (F5) a new program on 3.6.0b1 did the power-off. For clarity and re-tested: The program: while True:
pass
While installing 3.6.0b1 I think that the phase "erasing old firmware" takes longer than on 3.5.0 and I assume that indicates there is more to be erased. So that is fine. Bert |
Thank you! I can reproduce something similar. |
This implements pybricks/support#139 and pybricks/support#1790. Because much of the work was already done in #264 and #261, this update is quite small and just implements it in
sys/storage.c
andsys/hmi.c
.This makes it work using only changes on the firmware side. We could make it a lot better by making accompanying changes to Pybricks Code.
Still, this should be a reasonable way to try out the user experience and find the right improvements.
Feel free to give it a try, @afarago , @BertLindeman !
At minimum, we'll also want to do the following:
PBIO_PYBRICKS_STATUS_RECEIVING_PROGRAM
to prevent the UI interactions like a slot change while a big program is being loaded. This isn't done yet, so changing slot while loading lead to failure.We can probably rethink the logic for downloading programs more generally. At the moment, Pybricks Code sets the program size to 0 (to prevent it from being run), then uploads the program, then downloads the size. This is no longer sufficient, hence the need for a status. Alternately, maybe this should be a process of some kind so the hub can know about failure (and clear that status). Right now, if uploading stops halfway the hub has no way of knowing since it doesn't know the final file size.
Also, we used to provide access to user code on the REPL by allowing you to import it. This is now extended to providing access to the active slot. Do we really want that though? Maybe REPL should just really be independent. It was already kind of broken due to pybricks/support#745 anyway. To get interaction on a stored user module, users can trigger the
KeyboardInterrupt
instead, which should be sufficient?