From 421fda7fdc824483338ab5fba135afb58c0e580b Mon Sep 17 00:00:00 2001
From: Tim Stadtmann <tim.stadtmann@rwth-aachen.de>
Date: Mon, 17 Oct 2016 15:42:22 +0200
Subject: [PATCH] Internal tachocnt is reset if motor moved manually

Also, on syncedStart, both motors are now reset.
---
 source/Motor.m | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/source/Motor.m b/source/Motor.m
index 5c94c36..40a8589 100755
--- a/source/Motor.m
+++ b/source/Motor.m
@@ -162,7 +162,7 @@ classdef Motor < MaskedHandle & dynamicprops
             
             % If the motor coasts into its stops, the internal tachocount has to be reset 
             % before each start for it to behave predictable
-            if motor.brakeMode_ == BrakeMode.Coast 
+            if motor.brakeMode_ == BrakeMode.Coast || motor.internalTachoCount ~= 0
                 motor.internalReset();
             end
 
@@ -342,8 +342,9 @@ classdef Motor < MaskedHandle & dynamicprops
             
             % If the motor coasts into its stops, the internal tachocount has to be reset 
             % before each start for it to behave predictable
-            if motor.brakeMode_ == BrakeMode.Coast 
+            if motor.brakeMode_ == BrakeMode.Coast || motor.internalTachoCount ~= 0
                 motor.internalReset();
+                syncMotor.internalReset();
             end
             
             if motor.state.sendOnStart > 0
-- 
GitLab