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

init devices with attach() function and not via constructor #286

Merged
merged 3 commits into from
Nov 23, 2023

Conversation

elral
Copy link
Collaborator

@elral elral commented Nov 22, 2023

Description of changes

For the devices AnalogIn and Buttons an attach() function ia added where all required init paramaters are transferred. These init parameters were part of the constructor.
Now calling the constructor will only set that the device is not initialized.

The calling of the constructor is since PR #253 also done to calculate the required memory for all devices of one type and to reserve it. As no init parameters are available at this point the standard paramaters were taken and e.g. pin 1 for the output and analogIn device was set output / input.

The required changes for outputs are part of PR #285.

For the InputShifter the default value in the constructor is deleted. Not required here as it gets set also in the attach() function.

For the servo device the not required constructor was deleted.

For the stepper the default parameters in the attach() function are deleted to be the same as the other devices.

Fixes #284

@elral elral requested a review from DocMoebiuz as a code owner November 22, 2023 08:45
Copy link

Firmware for this pull request:
Firmware.zip

Copy link

Firmware for this pull request:
Firmware.zip

Copy link
Collaborator

@DocMoebiuz DocMoebiuz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elral Great find
@neilenns Thanks for the review

@DocMoebiuz DocMoebiuz merged commit 91c7e1e into MobiFlight:main Nov 23, 2023
1 check passed
@DocMoebiuz DocMoebiuz added beta-bug bug Something isn't working labels Nov 23, 2023
@elral elral deleted the attach_function branch November 23, 2023 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-bug bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pin 1 gets set as output or input when a button/analogIn is defined
3 participants