Skip to content
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

System optimizations #453

Merged
merged 21 commits into from
Sep 24, 2024
Merged

System optimizations #453

merged 21 commits into from
Sep 24, 2024

Conversation

odudex
Copy link
Member

@odudex odudex commented Sep 9, 2024

Description

Problem: A damaged camera currently renders devices unusable.

Solution: This PR addresses the issue by allowing Krux to operate without a functioning camera and includes some performance optimizations.

Changes:

  • Krux can now function without a camera, enabling key loading from storage or manual input, as well as signing transactions using an SD card.
  • The camera is reinitialized only when necessary, reducing load time.

Other Optimizations

  • Battery status reading and its display are now decoupled from the menu rendering process, improving menu responsiveness on devices equipped with a PMU.
  • Translation refactor reduces total firmware size in ~5% and increases free RAM at boot in ~3%

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 94.96124% with 13 lines in your changes missing coverage. Please review.

Project coverage is 94.67%. Comparing base (4495164) to head (223d74f).
Report is 22 commits behind head on develop.

Files with missing lines Patch % Lines
src/krux/pages/home_pages/sign_message_ui.py 93.25% 12 Missing ⚠️
src/krux/camera.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #453      +/-   ##
===========================================
- Coverage    94.82%   94.67%   -0.15%     
===========================================
  Files           60       70      +10     
  Lines         7434     7575     +141     
===========================================
+ Hits          7049     7172     +123     
- Misses         385      403      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@odudex odudex marked this pull request as ready for review September 16, 2024 13:17
@odudex
Copy link
Member Author

odudex commented Sep 18, 2024

Translation refactor reduces total firmware size in ~5% and increases free RAM at boot in ~3%

@jdlcdl
Copy link
Collaborator

jdlcdl commented Sep 22, 2024

I've visually reviewed the code changes in 30 files here.

Much of this I've tested on Amigo (whose camera works fine), but none since this pr was readied last week, nor any of the changes since "translation optimizations". Currently I'm having personal hw problems and cannot build for my amigo but I expect this to be resolved soon and will edit this message when done.

@odudex
Copy link
Member Author

odudex commented Sep 22, 2024

Thank you Jean! I also ended up adding new Sparrow's SD message signing feature here too, and this will require a few more tests to be written.
I hope you have your hw issues solved without too much hassle 🙏.

@jdlcdl
Copy link
Collaborator

jdlcdl commented Sep 23, 2024

Message signing via qrcode and via sdcard with sparrow 2.0.0 worked fine for me.
All tests passed since commit 4855a70 and poetry run poe pre-commit also completed successfully.
I like the baked translations tables separated per locale so that krux is loading a much smaller module and the others -- or the last-one-used can be garbage-collected.

try:
parts = derivation_path.split("/")
return parts[0] == "m" and all(
p.endswith("'") or p.endswith("h") or p.isdigit() for p in parts[1:]
Copy link
Collaborator

@jdlcdl jdlcdl Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: check that derivation_path.lower() happens prior to this... or add "H"

)
self.ctx.input.wait_for_button()
return sig
script_from_deriv = int(parts[1].strip("'").strip("h"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as last comment

@odudex odudex merged commit 1ca09a4 into develop Sep 24, 2024
7 checks passed
@odudex odudex deleted the system_optimizations branch September 26, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants