Skip to content
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

don't set stepper freq if it's already OK #13

Merged
merged 2 commits into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ deploy:
tags: true

install:
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme pytest
- pip install --force-reinstall pylint==1.9.2
- pip install circuitpython-build-tools Sphinx sphinx-rtd-theme pytest

script:
- py.test
Expand Down
3 changes: 2 additions & 1 deletion adafruit_motor/stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def __init__(self, ain1, ain2, bin1, bin2, *, microsteps=16):

# set a safe pwm freq for each output
for i in range(4):
self._coil[i].frequency = 2000
if self._coil[i].frequency < 1500:
self._coil[i].frequency = 2000

self._current_microstep = 0
if microsteps < 2:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class Coil:
def __init__(self):
self._duty_cycle = 0

@property
def frequency(self):
return 1500

@property
def duty_cycle(self):
return self._duty_cycle
Expand Down