Refactored some of the system menus to the new DRY method#8997
Closed
thebentern wants to merge 231 commits intodevelopfrom
Closed
Refactored some of the system menus to the new DRY method#8997thebentern wants to merge 231 commits intodevelopfrom
thebentern wants to merge 231 commits intodevelopfrom
Conversation
* Add files via upload * Move files into the right place
Adds triaged and backlog to the list of exempt labels.
…/firmware into multi-message-Storage
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors multiple system menu implementations in the MenuHandler to use a new DRY (Don't Repeat Yourself) pattern via the createStaticBannerOptions template function. The refactoring replaces manual array management and callback logic with a type-safe, template-based approach using MenuOption<T> structures.
Key changes:
- Introduces
ScreenColorstruct and several type aliases (LoraRegionOption,TimezoneOption,CompassOption, etc.) to support strongly-typed menu options - Refactors 9 menu functions to use the new pattern: LoraRegionPicker, ClockFacePicker, TZPicker, positionBaseMenu, nodeNameLengthMenu, compassNorthMenu, GPSToggleMenu, GPSFormatMenu, and TFTColorPickerMenu
- Fixes string literal split issues in the original code (e.g., "MY_" "919" → "MY_919")
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/graphics/draw/MenuHandler.h | Adds ScreenColor struct to encapsulate RGB color values with a useVariant flag, and introduces type aliases for various menu option types to improve type safety |
| src/graphics/draw/MenuHandler.cpp | Refactors 9 menu functions from manual array/callback pattern to the new DRY createStaticBannerOptions pattern, improving maintainability and consistency while fixing string literal formatting issues |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
Closing this for the moment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🙏 Thank you for sending in a pull request, here's some tips to get started!
❌ (Please delete all these tips and replace them with your text) ❌
to say "Hey, I think this idea X should be implemented and I'm starting work on it. My general plan is Y, any feedback
is appreciated." This will allow other devs to potentially save you time by not accidentially duplicating work etc...
because it automatically follows our indentation rules and its auto reformatting will not cause spurious changes to lines.
🤝 Attestations