pootle / tripipy

Simple python driver for Trinamic tmc5130 connected to Raspberry Pi
The Unlicense
36 stars 14 forks source link

Enable motor output #8

Closed gautamjain closed 4 years ago

gautamjain commented 4 years ago

Currently, motor driver output is always turned on right before moving and then turned off after the move finishes.

This doesn't work well in situations when you want the driver to apply a holding torque even when the motor is at standstill.

Would you be ok if enableOutput() was removed from setspeed(), goto(), etc.? Instead it would have to be explicitly called when needed.

Alternatively, if you prefer leaving chipdrive.py as is, I can create a new 'drive' in a separate file.

pootle commented 4 years ago

That call is really a safety measure - particularly for when testing. The 5130 itself disables output after a period when it stops which is OK in most situations.

If you want to add an option to the constructor for chipdrive - disable_on_stop or similar which goto and the other higher level commands check before calling enableOutput(False) I',m happy to pull that later. That way the it can work either way.

gautamjain commented 4 years ago

Ok that sounds good. I'll work on that.

pootle commented 4 years ago

I'm expecting new kit for a project next week so I'll be doing some more work on this soon - I've pulled the changes ion the meantime