Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature Request] Setting a maximum and minimum output #4

Closed
Elijahg opened this issue May 25, 2018 · 4 comments
Closed

[Feature Request] Setting a maximum and minimum output #4

Elijahg opened this issue May 25, 2018 · 4 comments
Assignees

Comments

@Elijahg
Copy link

Elijahg commented May 25, 2018

Hello!

Thanks for your excellent library, I'm using it to control a boost regulator, and I'd like to make a feature request - The PWM to the FET needs to be constrained between 30 and 180, and doing so without your library being "aware" causes it to seemingly rise above 180 internally. This means when the feedback drops below the setpoint, the output takes a long time to drop back down from whatever it is internally to less than 180. Similarly to the upper end, the library takes a long time to begin increasing the output, since it has to go from 0-30 before anything appears to happen.

With a built-in constrain function, the values would be clamped internally so this wouldn't be a problem.

Thanks
-Elijah

@mike-matera
Copy link
Owner

Hello!

You're so very welcome. Thanks for the request. I've created a branch and a corresponding PR. Would you please test out the code in the branch here:

https://github.com/mike-matera/FastPID/tree/limits-update

The change adds the setOutputRange(min, max) function. If that works for you I'll merge it ASAP.

@mike-matera mike-matera self-assigned this May 25, 2018
@goosenphil
Copy link

Hi Mike, for interested contributors, could you please explain how the testing is done? I can see there is a set of testing programs in the test folder which emulates the Arduino, I think it could use some documentation, even if it is just a Markdown file inside the test folder explaining how to perform the testing and an high level overview of how the emulation/testing works.

@mike-matera
Copy link
Owner

That's a good idea. There's still a lot in flux there. I use that folder to verify my code and there's (hopefully) no need for other people to use it. I would like to document it, though.

The way I was hoping you could test is by downloading the update branch and installing it into your sketch. However, it's such a simple change that I think I'm just going to merge it. The change adds bool setOutputRange(int16_t min, int16_t max) that limits outputs. In a few hours you should be able to update the library via the Arduino library manager. Check it out and see what you think.

@goosenphil
Copy link

I'm still very interested in how the testing systems works, I've never seen any Arduino/embedded library do this before.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants