pkerspe / ESP-FlexyStepper

This library is used to control one or more stepper motors from an ESP32 device. It is based on the FlexyStepper library by S.Reifel but provides some additional functionality
MIT License
150 stars 32 forks source link

New : getters for acceleration and desceleration #38

Closed ameisso closed 8 months ago

pkerspe commented 8 months ago

Not sure if the name of the functions is correctly reflecting the returned values. Do you intend to provide getters for the actual de/acceleration value in real time or for the user requested acceleration and deceleration values? Current indicates something realtime, e.g. if the stepper is in acceleration ramp, it should return a positive value. If stepper is at rest or at max requested velocity, it would 0, in all other cases an acceleration value up to the user define acceleration speed value. Have a look a getCurrentPosition for example, that returns a value that is only static when the stepper is not moving, in all other cases it will return the current (as in real time) position. So it seems like what you want to do is provide a function that simply returns the values that the user has set before using setAccelaration*() So it should be called something like getConfiguredAccelration or something like that. GetCurrentAcceleration would need to return a "calculated" or state dependent value.

ameisso commented 8 months ago

Hello,

thanks for your feedback My goal is to have the setted values of acceleration/deceleration so I don't have to store them elsewhere thus creating an oportunity to make mistakes.

I'm ok with the "getConfiguredAccelration" proposition, and will submit a commit

Best