mattjlewis / diozero

Java Device I/O library that is portable across Single Board Computers and microcontrollers. Tested with Raspberry Pi, Odroid C2, BeagleBone Black, Next Thing CHIP, Asus Tinker Board and Arduinos / Pico. Supports GPIO, I2C, SPI as well as Serial communication. Also known to work with Udoo Quad.
https://www.diozero.com
MIT License
261 stars 59 forks source link

Refactor StepperMotors for broader usage #147

Closed EAGrahamJr closed 1 year ago

EAGrahamJr commented 1 year ago

Based on the Adafruit stepper code, it appears that some class of steppers can use PWM-style inputs and "micro-step" by changing the duty-cycle. It is yet to be determined if the sandpit implementation of said Stepeprs will work with this notion.

EAGrahamJr commented 1 year ago

The PWM code is for additional micro-stepping using PWM outputs. The base code referenced above is allowing for micro-stepping by only calling a single coil activation, instead of the 4 required for a full step.

So this is basically a "two-fer":

EAGrahamJr commented 1 year ago

Change the title of the issue and it's focus: basically, I completely misunderstood some of the differences between drivers and steppers, so the original implementation failed to hold up to usage with expansion boards. The basic stepper motor needs to be refactored to remove any pretense of being able to accurately time movements and only handle "step in this direction" level of commands. The SilentStepStick implementation (aside from re-naming) is still valid.