Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If someone creates a Display, they should call SetupUI themselves. #312

Open
darkautism opened this issue Mar 8, 2025 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@darkautism
Copy link
Contributor

Is your feature request related to a problem?

In main/display/lcd_display.h:25, SetupUI is declared as a virtual type and is likely intended to be overridden to customize the look and feel. However, according to https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctors, virtual methods are not called during object construction. This means the overridden method will never be executed in this context.

Describe the solution you'd like.

If SetupUI is moved to the public section, each board will need to call it explicitly. On the other hand, if it remains protected, we must find an alternative method to achieve the desired functionality.

Describe alternatives you've considered.

It's uncertain whether these changes would disrupt the original logic.

Additional context.

No response

@darkautism darkautism added the enhancement New feature or request label Mar 8, 2025
@78
Copy link
Owner

78 commented Mar 8, 2025

That is indeed true.
The SetupUI function in the descendant classes has never been functional. At present, all the CustomDisplay classes set up their UI elements within the constructor functions. Consequently, it would be advisable to remove the virtual keyword from the method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants