-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Create "code.py" when creating the filesystem #2149
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
Comments
I'm not convinced this is a good idea. I assume you are not intending for it to have a "while True" loop in it. That would be even worse. But my concern is that now it gets executed everything the board reboots unless it is deleted. Just bothers me ;-) I guess I think the users should have some understanding of what is going on. this seems like a bit too much handholding to me. Just my opinion. |
What do you mean by "But my concern is that now it gets executed everything the board reboots unless it is deleted." ? The reason to do it is that we teach people to "plug it in and edit code.py" which works for boards that ship with CircuitPython and a demo but doesn't when they install CircuitPython themselves. |
I guess I have never been a big fan of using code.py in general. I only use it for finished projects. I much prefer to edit my files off line and copy them to the file system then execute from the REPL. I realize that is not the "official" workflow. |
An empty code.py seems like a good idea, but example code is going to take extra flash space, can we afford that? |
I wonder if it would be possible to extend the uf2 bootloader to support SPI flash, then we could have the initial filesystem contents in the uf2 file without taking extra flash space. |
I think it would be really great to have a code.py file considering the fact that recommended mu editor looks for that file and automatically loads in on detecting a CP board. A small demo code to print hello world or LED blink will also be great to have. @tannewt can I work on this one ? |
@iayanpahwa Please feel free to work on this and file a pull request. In case you didn't learn this yet for yourself, the area of the code to work in is probably
and
|
@jepler Thank you for code reference. I'll start working on it :) |
@iayanpahwa let's start with "Hello World". It can be changed to a more sophisticated example later on, if that's what's desired. |
I would also love to be able to disable this on per-board basis, to save space for the smaller boards. |
@deshipu I agree. @iayanpahwa after you have the basics working, let us know if you need guidance on how to make the code optional |
@iayanpahwa yes something that can be controlled from a You may find it useful to study how e.g., CIRCUITPY_DISPLAYIO works. Files involved include individual Let us know how it goes! |
PR Created - #2299 |
PR #2299 merged. This issue can now be closed. |
Thanks @iayanpahwa ! |
That way folks who install it have a file to edit. Bonus points if there is a very small bit of useful code. (Maybe just
print("Hello world!")
? It could be the translation too.)The text was updated successfully, but these errors were encountered: