Skip to content

Commit 7f93c2a

Browse files
authored
Merge pull request #22 from ladyada/master
small lint and fix for #19
2 parents dd30672 + 6f0def5 commit 7f93c2a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

adafruit_motor/stepper.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ def _update_coils(self, *, microstepping=False):
107107
for i in range(4):
108108
self._coil[i].duty_cycle = duty_cycles[i]
109109

110+
def release(self):
111+
"""Releases all the coils so the motor can free spin, also won't use any power"""
112+
# De-energize coils:
113+
for i in range(4):
114+
self._coil[i].duty_cycle = 0
115+
110116
def onestep(self, *, direction=FORWARD, style=SINGLE):
111117
"""Performs one step of a particular style. The actual rotation amount will vary by style.
112118
`SINGLE` and `DOUBLE` will normal cause a full step rotation. `INTERLEAVE` will normally
@@ -142,7 +148,7 @@ def onestep(self, *, direction=FORWARD, style=SINGLE):
142148
if ((style == SINGLE and current_interleave % 2 == 1) or
143149
(style == DOUBLE and current_interleave % 2 == 0)):
144150
step_size = half_step
145-
elif style == SINGLE or style == DOUBLE:
151+
elif style in (SINGLE, DOUBLE):
146152
step_size = full_step
147153

148154
if direction == FORWARD:

0 commit comments

Comments
 (0)