Skip to content

fix: resolved the issue of layer1 flickering when scrolling down #395

Merged
guowei0105 merged 2 commits intoOneKeyHQ:mainfrom
guowei0105:new-boot
Nov 17, 2025
Merged

fix: resolved the issue of layer1 flickering when scrolling down #395
guowei0105 merged 2 commits intoOneKeyHQ:mainfrom
guowei0105:new-boot

Conversation

@guowei0105
Copy link
Copy Markdown
Contributor

@guowei0105 guowei0105 commented Nov 17, 2025

…irst time after booting up

Summary by CodeRabbit

  • Bug Fixes

    • Corrected background layer reconfiguration during hide transitions to prevent stale state and display glitches.
  • Refactor

    • Reworked background/layer management into an instance-based manager for clearer state handling and simpler call sites.
  • Documentation

    • Added a brief docstring for the background JPEG loader for improved clarity.

@guowei0105 guowei0105 requested a review from a team as a code owner November 17, 2025 11:38
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 17, 2025

Walkthrough

Adds LTDC layer-1 reconfiguration when hiding Layer2 in the LCD driver and refactors homescreen Layer2 handling into a new Layer2Manager instance with related constants and instance-based APIs; also adds a docstring before a display function declaration.

Changes

Cohort / File(s) Summary
LCD driver layer reconfiguration
core/embed/extmod/modtrezorui/mipi_lcd.c
When target y <= -lcd_params.vres, builds and applies a LTDC_LAYERCONFIG for layer 1 (x0=0, x1=hres, y0=-vres, y1=vres, pixel_format, address=LAYER2_MEMORY_BASE) before disabling the layer and issuing a vertical-blank reload.
Homescreen Layer2 manager refactor
core/src/trezor/lvglui/scrs/homescreen.py
Adds Layer2Manager class, constants (LAYER2_VISIBLE_Y, LAYER2_HIDDEN_Y, LAYER2_ANIM_TIME_MS, LAYER2_ANIM_DELAY_MS), converts classmethods/static access to instance methods (ensure_background, reset_background_cache, preload_background, set_visibility, cleanup_timers, schedule_once), and creates global l2_manager = Layer2Manager(display). Updates call sites to use l2_manager.
Header docstring addition
core/embed/extmod/modtrezorui/modtrezorui-display.h
Adds a short Python-style docstring block immediately before cover_background_load_jpeg declaration; no signature or behavior changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review migration of all call sites in core/src/trezor/lvglui/scrs/homescreen.py to ensure state is correctly handled by the new l2_manager instance.
  • Verify LTDC layer reconfiguration in core/embed/extmod/modtrezorui/mipi_lcd.c for correct bounds/addresses and no visual artifacts.
  • modtrezorui-display.h docstring is trivial.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.54% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: resolving layer1 flickering during scrolling by reconfiguring LTDC layer 1 before hiding it.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ee0da40 and 7ecb484.

⛔ Files ignored due to path filters (1)
  • core/mocks/generated/trezorui.pyi is excluded by !**/generated/**
📒 Files selected for processing (1)
  • core/embed/extmod/modtrezorui/modtrezorui-display.h (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • core/embed/extmod/modtrezorui/modtrezorui-display.h
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Gen check
  • GitHub Check: Defs check
  • GitHub Check: Style check

Comment @coderabbitai help to get the list of available commands and usage tips.

@revan-zhang
Copy link
Copy Markdown
Contributor

revan-zhang commented Nov 17, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
core/src/trezor/lvglui/scrs/homescreen.py (1)

154-185: Catching bare Exception hides real errors.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1cc58a3 and ee0da40.

⛔ Files ignored due to path filters (1)
  • core/mocks/generated/trezorui.pyi is excluded by !**/generated/**
📒 Files selected for processing (2)
  • core/embed/extmod/modtrezorui/mipi_lcd.c (1 hunks)
  • core/src/trezor/lvglui/scrs/homescreen.py (13 hunks)
🧰 Additional context used
🪛 Ruff (0.14.4)
core/src/trezor/lvglui/scrs/homescreen.py

666-666: Do not catch blind exception: Exception

(BLE001)


1277-1277: Do not catch blind exception: Exception

(BLE001)

🔇 Additional comments (1)
core/embed/extmod/modtrezorui/mipi_lcd.c (1)

1196-1197: Verify negative window coordinate validity.

Line 1196 sets config.y0 = -((int32_t)lcd_params.vres) (negative value). When this gets assigned to the STM32 HAL's WindowY0 (uint32_t), it converts to a very large positive number via two's complement. Confirm STM32H745 LTDC hardware accepts negative-derived coordinates or if this should use unsigned positive values instead.

[web]
Do STM32H745 LTDC layer window coordinates (WHPCR/WVPCR registers) support or require non-negative values?


</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

424778940z
424778940z previously approved these changes Nov 17, 2025
Lu1zz
Lu1zz previously approved these changes Nov 17, 2025
@guowei0105 guowei0105 dismissed stale reviews from Lu1zz and 424778940z via 7ecb484 November 17, 2025 11:55
@guowei0105 guowei0105 merged commit d05b0bb into OneKeyHQ:main Nov 17, 2025
9 checks passed
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