raiden00pl commented on PR #10902:
URL: https://github.com/apache/nuttx/pull/10902#issuecomment-1761023331
The idea behind `motor.h` was to create a universal interface for various
types of motors so I think it's better to modify it to fit better for stepper
motors. You can just add another configuration option for motor interface:
```
config MOTOR_UPPER_HAVE_STEPS
bool "Have steps control"
default n
```
then extend `struct motor_params_s` with:
```
#ifdef CONFIG_MOTOR_UPPER_HAVE_STEPS
uint32_t steps;
int16_t steps_speed;
uint16_t microstep;
#endif
```
Currently `motor.h` uses floats which is not ideal for chips without FPU and
I would like to add support for fixedmath someday. But if you need only step
control, you can just set `CONFIG_MOTOR_UPPER_HAVE_STEPS` and all float values
should be not included. It's possible to control stepper motor also with the
FOC algorithm, in this case the concept of 'steps' makes no sense.
Using `motor.h`, the stepper motor driver can later implement control
methods other than step if needed and having the same interface, we can more
easily change the type of motor used (better modularity).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]