leducp commented on PR #10902: URL: https://github.com/apache/nuttx/pull/10902#issuecomment-1761196576
> > I understand the idea but I feel that it became a kind of god object anti pattern... > > The whole motor interface works with a different mindset like start and stop. Moreover, what if one need to control a stepper and a bldc? Both interface will be mixed in the code no? > > If you want control stepper motor with PWM peripheral, for example to use `CONFIG_PWM_PULSECOUNT` functionality then you need start and stop. In your case you are directly controlling the GPIO, but the same can be achieved with PWM if your chip can precisely generate pulses or you just want to control the motor shaft speed. > I don't understand why you'll need start/stop with pulse count? Is this not precisely an option that let you ask a job with X pulses and the system will stop on is own? > When you have different types of motors to control, then the motor 'lower-half' logic can just ignore parameters that are not needed (e.g. stepper motor in step mode doesn't care about 'float position;'). This probably requires some modifications to the "upper-half" motor driver, but the interface itself will not be a problem here. > > You say it's mixing interfaces and anti pattern, I say it's creating a generic motor solution. Depends on how you look at the problem :) > Yes I understand this point, but my point is: stepper is its own kind of beast and the whole motor interface is cumbersome/heavy for the basic usage of a stepper : moving X steps in one direction. What is the point to have a generic interface to match all possible aspects if the user application is heavier and need to be adapted when changing the control mode? (by adding steps in integer in this interface). -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org