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

Class constructor issues (IO functions) #3526

Open
putzlicht opened this issue Oct 25, 2024 · 0 comments
Open

Class constructor issues (IO functions) #3526

putzlicht opened this issue Oct 25, 2024 · 0 comments

Comments

@putzlicht
Copy link

putzlicht commented Oct 25, 2024

Hello,

i'm using ONE firmware for a bunch of different boards. Some have a display connected, some not.
Because of initialising the display pins in the class constructor i have some unwanted behavior on boards with
no displays. Some boards have pwm dimmers connected where others have a display for example.
After a reset they are flashing at 100 percent in this case.
It should be possible in c++ to create a nullptr class instance and doing the initialization later in the setup function for example.
But i had no success trying this.
So my workaround for this problem is to remove all IO functions from the constructor and put them in the init() function
right after if (_booted).
Is there a more elegant way to solve this?

Best
Martin

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

No branches or pull requests

1 participant