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

@ -58,6 +58,11 @@ class Encoder(object):
encoder_start_values[port] = Encoder.read_raw(port)
@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)

View file

@ -3,6 +3,7 @@ __version__ = "0.1.5-1"
import compLib.LogstashLogging
import compLib.Spi
import compLib.Reset
import compLib.Encoder
import logging
import apt
@ -20,3 +21,4 @@ except Exception as e:
compLib.Reset.Reset.reset_bot()
compLib.Spi.Spi.health_check()
compLib.Spi.Spi.start_health_check_loop()
compLib.Encoder.Encoder.clear_all()