Skip to content

Commit 4a50113

Browse files
committed
Allow for transformed PWMOut-based error
1 parent f02e320 commit 4a50113

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

adafruit_motor/stepper.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,13 @@ def __init__(
113113
# set a safe pwm freq for each output
114114
self._coil = (ain2, bin1, ain1, bin2)
115115
for i in range(4):
116-
if self._coil[i].frequency < 1500:
116+
if self._coil[i].frequency < 1500 and self._coil[i].variable_frequency:
117117
self._coil[i].frequency = 2000
118+
else:
119+
raise RuntimeError(
120+
"PWMOut outputs must either be set to at least "
121+
"1500 Hz or allow variable frequency."
122+
)
118123
if microsteps < 2:
119124
raise ValueError("Microsteps must be at least 2")
120125
if microsteps % 2 == 1:

0 commit comments

Comments
 (0)