Allow negative step count and angle for backward rotation

motor.angle(-90) == motor.angle(90, -1)
motor.step(-500) == motor.step(500, -1)
pull/4/head
Jej 2020-06-11 09:13:28 +00:00 zatwierdzone przez GitHub
rodzic b0d7349b4e
commit 643fb5b91e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -37,6 +37,9 @@ class Stepper:
def step(self, count, direction=1):
"""Rotate count steps. direction = -1 means backwards"""
if count<0:
direction = -1
count = -count
for x in range(count):
for bit in self.mode[::direction]:
self.pin1(bit[0])