-
Notifications
You must be signed in to change notification settings - Fork 60
[Refactor] Human-friendly splash definition #765
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
base: develop
Are you sure you want to change the base?
[Refactor] Human-friendly splash definition #765
Conversation
|
Nice! I think it can work, as long you replace the fstrings with a "{}".format ... |
|
Hey @kdmukai! 👋 Great to see your contribution! If you are using linux it is as simple as running |
|
@tadeubas , do you remember what's the reason we switched to THIN_SPACE? |
|
I'll flip this to DRAFT until those TODO items are resolved. |
|
I never know python syntax nuance. This works as expected: But seems like the "proper" way to format it is: 🤷♂️ |
|
Compilation against 3b385bd for the Flashing to my device will be a challenge since Docker is trashed on my dev laptop. |
If you manage to have access to ktool-mac and kboot.kfpkg inside build folder. You can copy them to local machine and flash the device. Put them in the same folder and run: |
No I don't, just found this was the old one but used to occupy more ram: Than changed to this compressed one: Than removed from boot.py and added to display.py for reuse with screensaver: The above ☝️ on the line before my comment says "# Splash will use horizontally-centered text plots. Uses Thin spaces to help with alignment", so maybe it is necessary or was necessary for alignment |
The end of the script copy those files generated inside the docker machine to the folder |
Maybe this is the reason I used thin-spaces? to store less chars as possible in ram and to have it beautiful drawn at the same time? Not sure if @kdmukai has run into this before, but we usually optimize things a lot since we’re working with pretty limited resources. Maybe it is not worthy to change this code to be more human readable 🤣 |
I've definitely been spoiled by the Pi Zero's 512MB of RAM! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #765 +/- ##
===========================================
+ Coverage 97.10% 97.37% +0.27%
===========================================
Files 82 83 +1
Lines 10422 10526 +104
===========================================
+ Hits 10120 10250 +130
+ Misses 302 276 -26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Some nits. Also, THIN_SPACE isn't used anymore, and this will raise a warning by pylint, so it need to be removed from src/krux/display:
src/krux/display.py:27:0: W0611: Unused THIN_SPACE imported from settings (unused-import)| THIN_SPACE + "██" + THIN_SPACE * 2 + "██", | ||
| THIN_SPACE * 2 + "██" + THIN_SPACE * 3 + "██", | ||
| ] | ||
| human_friendly_splash = """ |
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.
This will throw an warning on pylint:
src/krux/display.py:55:0: C0103: Constant name "human_friendly_splash" doesn't conform to UPPER_CASE naming style (invalid-name)| human_friendly_splash = """ | |
| SPLASH = """ |
| """ | ||
| # Reformat as a list of strings w/fixed length padding to preserve the shape | ||
| # when it's rendered as horizontally centered individual lines. | ||
| SPLASH = ["{:<9}".format(row) for row in human_friendly_splash.split("\n") if row != ''] |
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.
| SPLASH = ["{:<9}".format(row) for row in human_friendly_splash.split("\n") if row != ''] | |
| SPLASH = ["{:<9}".format(row) for row in SPLASH.split("\n") if row != ''] |

What is this PR for?
Very minor refactor. Have a few changes coming but trying to keep each one as simple and as isolated as possible.
While working on some screensaver experiments, it seemed like the
SPLASHdefinition was unnecessarily complex.THIN_SPACEshouldn't be any different than a normal space char, right?Question: Is the currently used version of MicroPython okay with the
f"{row:9}"f-string formatting?This change is running fine in the emulator for
maixpy_amigobut I haven't tried it on an actual device yet. I can't discern any visual difference vs the original definition.Changes made to:
Did you build the code and tested on device?
What is the purpose of this pull request?