Implement scrollable settings menu with dynamic item count #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Refactored the settings screen to support unlimited menu items with automatic scrolling, replacing the previous hardcoded 4-item limitation. This makes it trivial to add new settings options without modifying multiple files.
Problem
The original implementation had several limitations:
Solution
Implemented a scrollable menu system with:
Key Changes
New Data Structure
Created a
SettingsMenuItemstruct to encapsulate menu item properties:Scroll Management
settingsScrollOffsetvariable to track the topmost visible itemSimplified API
Adding a new menu item is now a single line:
Example
The demo configuration includes 7 items to demonstrate scrolling:
Initial view (scroll offset 0):
After scrolling down (scroll offset 2):
Technical Details
Files Modified
source/src/display/settingsScreen.cpp- Menu items and rendering logicsource/src/tasks/displayHandler.cpp- Scroll offset calculationsource/src/tasks/knobHandler.cpp- Removed hardcoded constantsource/include/tasks/displayHandler.h- Exported scroll offsetsource/include/display/screens.h- Exported item count functionBackward Compatibility
✅ Fully backward compatible - existing 4-item configuration works without changes
✅ No visual changes when menu has ≤4 items
✅ All existing functionality preserved
Performance
Documentation
Comprehensive documentation included:
Testing
Benefits
Closes #[issue_number]
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.