Fixed Encoder clear at startup

This commit is contained in:
Konstantin Lampalzer 2021-09-04 15:00:33 +01:00
parent 9e61023e67
commit 3e7df14da8
2 changed files with 11 additions and 4 deletions

View file

@ -57,7 +57,12 @@ class Encoder(object):
raise IndexError("Invalid encoder port specified!")
encoder_start_values[port] = Encoder.read_raw(port)
for i in range(1, MOTOR_COUNT + 1):
encoder_start_values[i] = Encoder.read_raw(i)
@staticmethod
def clear_all():
"""Reset all encoder positions to 0
"""
for i in range(1, MOTOR_COUNT + 1):
encoder_start_values[i] = Encoder.read_raw(i)