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

Enhancements to CLI interface #43

Merged
merged 5 commits into from
Dec 5, 2023
Merged

Enhancements to CLI interface #43

merged 5 commits into from
Dec 5, 2023

Conversation

houz
Copy link
Contributor

@houz houz commented Dec 4, 2023

In this PR I added the ability to register user defined functions in the CLI API. Unfortunately I had to introduce a second list of commands in the ESPStepperMotorServer_CLI class, because the internal callbacks are member functions of the class, while external callbacks need to be free functions.

While at it, I also ported the ability to set speed, acceleration and deceleration from the REST API to CLI.

Closes #42.

The built in commands are member functions of the CLI class so
we can't easily mix them with free functions a user might register.
Thus there are two lists now.
It might make sense to add a void *context to the callbacks of
user commands. To be discussed.
This is basically just copy&paste from the REST API.
@pkerspe
Copy link
Owner

pkerspe commented Dec 4, 2023

Hi @houz looks fine to me code-wise, could you please also update the readme in the section "Library API documentation" for the new exposed API functions to register user commands?
And also the new supported parameters in the CLI "Serial command line interface"?

And optional, but nice to have: provide a example ino file in examples folder that shows usage of user provided CLI function

other than that, thanks a lot for you contribution

@houz
Copy link
Contributor Author

houz commented Dec 5, 2023

Done, I pushed the changes to my fork.

@pkerspe pkerspe merged commit e0125c2 into pkerspe:master Dec 5, 2023
1 check passed
@houz
Copy link
Contributor Author

houz commented Dec 5, 2023

Thank you very much for the quick and pleasant experience. :-)

@pkerspe
Copy link
Owner

pkerspe commented Dec 5, 2023

@houz thanks for contributing.

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.

Make it possible to register additional cli commands
2 participants