Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.8k
Refactored some of the system menus to the new DRY method#8997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:multi-message-Storage
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
This PR refactors multiple system menu implementations in the MenuHandler to use a new DRY (Don't Repeat Yourself) pattern via thecreateStaticBannerOptions template function. The refactoring replaces manual array management and callback logic with a type-safe, template-based approach usingMenuOption<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.
🙏 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