Skip to content
Snippets Groups Projects
Commit 3980140a authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Fix issues #27 and #28

parent bfc8a1de
Branches
Tags
No related merge requests found
......@@ -452,31 +452,38 @@ classdef Motor < MaskedHandle & dynamicprops
end
end
% Keep 'slave'-motor synchronized
syncMotor.speedRegulation = false;
syncMotor.limitValue= motor.limitValue;
syncMotor.brakeMode = motor.brakeMode;
syncMotor.power = motor.power;
% Save old states
motor.saveState();
syncMotor.saveState();
% Cache old values to make it possible to reset them on syncedStop
% Note: the existence of 'slave' is also used to determine whether motor is
% running synchronized or not, see get.isSynced()
motor.addProperty(syncMotor, 'slave', true);
syncMotor.addProperty(motor, 'master', true);
motor.saveState();
syncMotor.saveState();
% Disable immediate sending of new power values
motor.state.sendPowerOnSet = false;
syncMotor.state.sendPowerOnSet = false;
% Keep 'slave'-motor synchronized
syncMotor.speedRegulation = false;
syncMotor.limitValue= motor.limitValue;
syncMotor.brakeMode = motor.brakeMode;
syncMotor.power = motor.power;
% Synchronous running is a 'busy'-operation
motor.state.startedNotBusy = false;
syncMotor.state.startedNotBusy = false;
if strcmpi(motor.limitMode, 'Tacho')
motor.commInterface.outputStepSync(0, motor.port+syncMotor.port, ...
motor.power, turnRatio, ...
motor.limitValue, motor.brakeMode_);
if motor.debug
fprintf(['(DEBUG) SyncMotor::syncedStart: Called outputStepSync on ' ,...
fprintf(['(DEBUG) Motor::syncedStart: Called outputStepSync on ' ,...
'Ports %s and %s.\n'], port2str('Motor', motor.port), port2str('Motor', syncMotor.port));
end
elseif strcmpi(motor.limitMode, 'Time')
......@@ -484,7 +491,7 @@ classdef Motor < MaskedHandle & dynamicprops
motor.power, turnRatio, ...
motor.limitValue, motor.brakeMode_);
if motor.debug
fprintf('(DEBUG) SyncMotor::start: Called outputStepSync on Ports %s and %s.\n',...
fprintf('(DEBUG) Motor::start: Called outputStepSync on Ports %s and %s.\n',...
port2str('Motor', motor.port), port2str('Motor', syncMotor.port));
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment