Skip to content

Commit

Permalink
Merge pull request #22 from ladyada/master
Browse files Browse the repository at this point in the history
small lint and fix for #19
  • Loading branch information
siddacious authored Dec 25, 2018
2 parents dd30672 + 6f0def5 commit 7f93c2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion adafruit_motor/stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def _update_coils(self, *, microstepping=False):
for i in range(4):
self._coil[i].duty_cycle = duty_cycles[i]

def release(self):
"""Releases all the coils so the motor can free spin, also won't use any power"""
# De-energize coils:
for i in range(4):
self._coil[i].duty_cycle = 0

def onestep(self, *, direction=FORWARD, style=SINGLE):
"""Performs one step of a particular style. The actual rotation amount will vary by style.
`SINGLE` and `DOUBLE` will normal cause a full step rotation. `INTERLEAVE` will normally
Expand Down Expand Up @@ -142,7 +148,7 @@ def onestep(self, *, direction=FORWARD, style=SINGLE):
if ((style == SINGLE and current_interleave % 2 == 1) or
(style == DOUBLE and current_interleave % 2 == 0)):
step_size = half_step
elif style == SINGLE or style == DOUBLE:
elif style in (SINGLE, DOUBLE):
step_size = full_step

if direction == FORWARD:
Expand Down

0 comments on commit 7f93c2a

Please sign in to comment.