Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Meshwa428
Copy link
Owner

No description provided.

The App::loop() contained large, brittle if-statements to manage hardware resources (e.g., WiFi), violating the Open/Closed Principle. This was inefficient and required modifying the core loop for every new feature.

This commit refactors resource management to a declarative, polymorphic system:

1. A 'ResourceRequirement' bitmask enum is introduced in a new Resource.h.
2. The IMenu and Service base classes now have a virtual 'getResourceRequirements()' function.
3. Menus and Services now override this function to declare their hardware needs only when they are active.
4. The ServiceManager aggregates requirements from all active services.

The App::loop() is now clean, efficient, and agnostic to the needs of individual components. Adding new features with resource dependencies no longer requires modifying the core application loop.
@Meshwa428 Meshwa428 merged commit 737aad3 into main Nov 2, 2025
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