Skip to content

Conversation

@tadeubas
Copy link
Member

@tadeubas tadeubas commented Nov 17, 2025

What is this PR for?

Screensaver now appear in all menu screens (even with info boxes) as requests from issue #760

Tested all screens that are changed by this PR, waiting for screensaver and seeing the result after, more than one time

Changes made to:

  • Code
  • Tests
  • Docs
  • CHANGELOG

Did you build the code and tested on device?

  • Yes, build and tested on Embed Fire

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Docs update
  • Other

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.38%. Comparing base (23dd732) to head (67a62f0).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #772   +/-   ##
========================================
  Coverage    97.37%   97.38%           
========================================
  Files           83       83           
  Lines        10521    10537   +16     
========================================
+ Hits         10245    10261   +16     
  Misses         276      276           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kdmukai
Copy link

kdmukai commented Nov 21, 2025

Tested ACK, though haven't reviewed / not really capable of reviewing the code changes.

Screensaver w/this PR successfully running on tzt, wonder_k, and m5stickv.

One oddity: My initial rebuild and flash of this PR on the wonder_k just made it freeze. Unplug, re-plug: blank gray screen. Reflashed. Same. Rebuilt the main branch and flashed: totally fine. Rebuilt the PR branch and flashed: ...totally fine!

So maybe something went wrong the first time I compiled this PR for the wonder_k? I didn't notice any errors (but wasn't paying close attention) and as far as I could tell those first two flashing attempts went as expected.

@tadeubas
Copy link
Member Author

Hey @kdmukai, thanks for testing this PR so quickly!
Yeah, asking you for a full code review would be a bit much. You already helped a ton by testing on three devices (two touch models and one with battery + button only). Really appreciate it! ❤️

One oddity: My initial rebuild and flash of this PR on the wonder_k just made it freeze.
… I didn’t notice any errors (but wasn’t paying close attention) …

I think I know exactly what happened. If you build with a typo like:

./krux build maixpy_wonderk

it just outputs, but nothing is built:

Wrong or unsupported device name, use maixpy_devicename

If you then run (without a typo 😜 ):

./krux flash maixpy_wonder_k

It will flash whatever was previously built. So if your last successful build was for TZT, for example, that firmware ends up being flashed onto the Wonder K, and of course it won’t behave correctly 😅

On the next build attempt (using the correct device name), the files get overwritten properly. Flashing after that installs the correct firmware, which I think is why everything worked afterward.

@odudex
Copy link
Member

odudex commented Nov 22, 2025

I think this is not the way to go for a more consistent Screensaver #760.
IMO it should be called by system timer, just like "auto shutdown", and its code should be self contained in a single file, not spread across multiple files.
We should be able to disable it in a few situations, like QR scanning and animated QR codes, and re-enable when finished.

@tadeubas
Copy link
Member Author

I asked in #760 which situations should trigger the screensaver, but the issue only mentions "being active only in some menu screens". This PR covers all menu screens, so we might need to refine the criteria later. Ideally, #760 should clarify exactly where the screensaver should or shouldn’t appear.

This PR improves the screensaver behavior, and I think @kdmukai as "a user" can provide more insight based on how it felt to use this PR compared to the current state, and whether it should appear on additional screens.

@kdmukai
Copy link

kdmukai commented Nov 22, 2025

My hands-on testing was brief. I set the timeout to 1min and so far only monitored the initial menu screen. So not much input for me to contribute at the moment.

@tadeubas
Copy link
Member Author

tadeubas commented Nov 22, 2025

Even if this PR isn't the final solution, it improves readability and brings the code more in line with pylint by shortening functions and moving the infobox drawing into its own helper. It adds very little code and doesn't change any logic, so I think we can merge it now and continue iterating later.

From what I've seen, no one reported screensaver issues before infoboxes were introduced. After we chose to suppress the screensaver whenever an infobox was visible, users started interpreting that behavior as a malfunction. This PR fixes that.

Comment on lines +163 to +167
def _print_infobox():
self.ctx.display.clear()
return self.ctx.display.draw_hcentered_text(
info, info_box=True, highlight_prefix=":"
)
Copy link
Member

Choose a reason for hiding this comment

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

Why not define it as a private method in the class instead a anon function?

Copy link
Member Author

Choose a reason for hiding this comment

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

I defined it inside the function because it’s an implementation detail, not a reusable behavior of the class. Its scope is explicit: it cannot be called from anywhere else.

Comment on lines +82 to +94
def _print_infobox():
self.ctx.display.clear()
self.ctx.display.draw_hcentered_text(
info_text,
offset_y=FONT_HEIGHT,
info_box=True,
)
self.ctx.display.draw_hcentered_text(
self.ctx.wallet.key.fingerprint_hex_str(pretty=True),
offset_y=FONT_HEIGHT,
color=theme.highlight_color,
bg_color=theme.info_bg_color,
)
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Comment on lines +314 to +324
def _print_infobox():
self.ctx.display.clear()
n_lines = self.ctx.display.draw_hcentered_text(
rolls_str, info_box=True, max_lines=max_lines
)
self.ctx.display.draw_hcentered_text(
t("Rolls:"),
color=theme.highlight_color,
bg_color=theme.info_bg_color,
)
return n_lines
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Comment on lines +162 to +184
def _print_infobox():
self.ctx.display.clear()
failures = len([x for x in self.results if not x[1]])
total = len(self.results)
return self.ctx.display.draw_hcentered_text(
"\n".join(
[
x
for x in [
t("Test Suite Results"),
t("success rate:")
+ " {}%".format(int((total - failures) / (total) * 100)),
(
t("failed:") + " {}/{}".format(failures, total)
if failures
else None
),
]
if x is not None
]
if x is not None
]
),
info_box=True,
)
),
info_box=True,
)
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Comment on lines +291 to +312
def _print_infobox():
self.ctx.display.clear()
num_lines = self.ctx.display.draw_hcentered_text(
wallet_info, info_box=True
)

# draw fingerprint with highlight color
self.ctx.display.draw_hcentered_text(
key.fingerprint_hex_str(True),
color=theme.highlight_color,
bg_color=theme.info_bg_color,
)

# draw network with highlight color
self.ctx.display.draw_hcentered_text(
network_name,
DEFAULT_PADDING + FONT_HEIGHT,
color=Utils.get_network_color(network_name),
bg_color=theme.info_bg_color,
)

return num_lines
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Comment on lines +464 to +468
def _print_infobox():
self.ctx.display.clear()
self.ctx.display.draw_hcentered_text(
t("Res. - Format"), FONT_HEIGHT, info_box=True
)
Copy link
Member

Choose a reason for hiding this comment

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

Same Here

Comment on lines +200 to +213
def _print_infobox():
self.ctx.display.clear()
n_lines = self.ctx.display.draw_hcentered_text(
wallet_info, info_box=True
)

# draw network with highlight color
self.ctx.display.draw_hcentered_text(
network_name,
color=Utils.get_network_color(network_name),
bg_color=theme.info_bg_color,
)

return n_lines
Copy link
Member

Choose a reason for hiding this comment

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

Same here

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.

4 participants