Skip to content

Commit

Permalink
Merge pull request #67 from tekktrik/pwmout-fix
Browse files Browse the repository at this point in the history
Allow for transformed PWMOut-based error
  • Loading branch information
tekktrik committed Jan 10, 2023
2 parents f02e320 + bdf122d commit f2edb76
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions adafruit_motor/stepper.py
Expand Up @@ -113,8 +113,15 @@ def __init__(
# set a safe pwm freq for each output
self._coil = (ain2, bin1, ain1, bin2)
for i in range(4):
if self._coil[i].frequency < 1500:
self._coil[i].frequency = 2000
if (
self._coil[i].frequency < 1500
and not self._coil[i].variable_frequency
):
raise ValueError(
"PWMOut outputs must either be set to at least "
"1500 Hz or allow variable frequency."
)
self._coil[i].frequency = 2000
if microsteps < 2:
raise ValueError("Microsteps must be at least 2")
if microsteps % 2 == 1:
Expand Down

0 comments on commit f2edb76

Please sign in to comment.