Skip to content

small lint and fix for https://github.com/adafruit/Adafruit_CircuitPython_Motor/issues/19 #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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