Fixed motor registers

This commit is contained in:
Konstantin Lampalzer 2021-09-05 11:37:16 +01:00
parent a2425c7010
commit bdb7d687bb

View file

@ -34,16 +34,16 @@ class Motor(object):
if port == 1:
Spi.write(Register.MOTOR_1_PWM_H, 2, pwm)
Spi.write(Register.MOTOR_1_CTRL, 1, int(mode))
Spi.write(Register.PWM_1_CTRL, 1, int(mode))
elif port == 2:
Spi.write(Register.MOTOR_2_PWM_H, 2, pwm)
Spi.write(Register.MOTOR_2_CTRL, 1, int(mode))
Spi.write(Register.PWM_2_CTRL, 1, int(mode))
elif port == 3:
Spi.write(Register.MOTOR_3_PWM_H, 2, pwm)
Spi.write(Register.MOTOR_3_CTRL, 1, int(mode))
Spi.write(Register.PWM_3_CTRL, 1, int(mode))
elif port == 4:
Spi.write(Register.MOTOR_4_PWM_H, 2, pwm)
Spi.write(Register.MOTOR_4_CTRL, 1, int(mode))
Spi.write(Register.PWM_4_CTRL, 1, int(mode))
@staticmethod
def power(port: int, percent: float):