Skip to content

Commit 3559d01

Browse files
authored
Merge pull request #13 from dhalbert/stepper-freq
don't set stepper freq if it's already OK
2 parents e0b709f + f3d8e05 commit 3559d01

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ deploy:
2323
tags: true
2424

2525
install:
26-
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme pytest
26+
- pip install --force-reinstall pylint==1.9.2
27+
- pip install circuitpython-build-tools Sphinx sphinx-rtd-theme pytest
2728

2829
script:
2930
- py.test

adafruit_motor/stepper.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def __init__(self, ain1, ain2, bin1, bin2, *, microsteps=16):
7575

7676
# set a safe pwm freq for each output
7777
for i in range(4):
78-
self._coil[i].frequency = 2000
78+
if self._coil[i].frequency < 1500:
79+
self._coil[i].frequency = 2000
7980

8081
self._current_microstep = 0
8182
if microsteps < 2:

tests/test_stepper.py

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ class Coil:
1414
def __init__(self):
1515
self._duty_cycle = 0
1616

17+
@property
18+
def frequency(self):
19+
return 1500
20+
1721
@property
1822
def duty_cycle(self):
1923
return self._duty_cycle

0 commit comments

Comments
 (0)