Skip to content

Bug Fix: Add debouncing to GUI navigation to prevent LVGL memory fragmentation#115

Merged
KlausMu merged 1 commit into
OMOTE-Community:mainfrom
Stuckya:fix/gui-navigation-debounce
Sep 27, 2025
Merged

Bug Fix: Add debouncing to GUI navigation to prevent LVGL memory fragmentation#115
KlausMu merged 1 commit into
OMOTE-Community:mainfrom
Stuckya:fix/gui-navigation-debounce

Conversation

@Stuckya
Copy link
Copy Markdown
Contributor

@Stuckya Stuckya commented Sep 20, 2025

I was encountering intermittent crashes when my kids were using the remote. This led me to debugging the crashes and I uncovered 3 issues along the way. This was the 3rd issue.

Problem:

LVGL memory fragmentation crashes during rapid GUI navigation, causing heap corruption in remove_free_block and lv_style_set_prop_internal.

Root Cause:

  • Rapid button pressing of GUI navigation keys (ex: KEY_RIGHTscene_gui_next()) caused excessive LVGL object creation/deletion cycles.
  • Memory allocator (TLSF) became fragmented under stress, leading to invalid memory access.

Proposed Fix:

  1. Added 100ms of debouncing to GUI navigation commands (scene_gui_next, scene_gui_prev).
  2. Created isGuiNavigationDebounced() helper function to improve readability and encapsulate logic which prevents rapid scene changes.
  3. Overall, this fix reduces stress on LVGL memory allocator during fast button pressing that would otherwise result in rapid scene changes.

… Reduces stress on LVGL memory allocator during fast button mashing.
@KlausMu KlausMu merged commit d724ba9 into OMOTE-Community:main Sep 27, 2025
4 of 5 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.

2 participants