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

Fix issue #20

Flag 'sendPowerOnSet' is now correctly set
parent 0fb15802
Branches
Tags
No related merge requests found
......@@ -124,8 +124,8 @@ classdef Motor < handle & dynamicprops
connectedToBrick = false; % Connection to physical Brick?
sendPowerOnNextStart = false; % Indicates whether current power parameter should be sent
% to the Brick right before starting it next time
sendPowerOnSet = true; % Indicates whether power parameter should be sent to the Brick
% immediately after setting it
sendPowerOnSet = false; % Indicates whether power parameter should be sent to the Brick
% immediately after setting it
limitSetToZero = false; % Indicates whether limitValue has been set to zero
% (workaround for a bug, see motor.start, Note 2)
init = true; % Indicates 'init-phase' (True as long as constructor is running)
......@@ -636,12 +636,15 @@ classdef Motor < handle & dynamicprops
if limitValue==0 && motor.limitValue~=0
motor.sendPowerOnNextStart = true;
motor.limitSetToZero = true;
motor.sendPowerOnSet = true;
elseif limitValue~=0 && motor.limitValue==0
motor.sendPowerOnSet = false;
end
end
if limitValue == 0
motor.sendPowerOnSet = true;
else
motor.sendPowerOnSet = false;
end
motor.limitValue= limitValue;
end
......@@ -736,6 +739,7 @@ classdef Motor < handle & dynamicprops
if motor.init
motor.port = p.Results.port;
end
motor.power = p.Results.power;
motor.limitValue= p.Results.limitValue;
motor.limitMode = p.Results.limitMode;
motor.brakeMode = p.Results.brakeMode;
......@@ -744,9 +748,9 @@ classdef Motor < handle & dynamicprops
motor.smoothStart = p.Results.smoothStart;
motor.smoothStop = p.Results.smoothStop;
motor.sendPowerOnSet = false;
motor.power = p.Results.power;
motor.sendPowerOnSet = true;
if motor.limitValue == 0
motor.sendPowerOnSet = true;
end
end
%% Getter
......@@ -825,11 +829,9 @@ classdef Motor < handle & dynamicprops
if ~motor.connectedToBrick
error(['Motor::getTachoCount: Motor-Object not connected to comm handle.',...
'You have to call motor.connect(commInterface) first!']);
elseif ~motor.physicalMotorConnected
error('Motor::getTachoCount: No physical motor connected to Port %s',...
port2str('Motor', motor.port));
end
% assert(motor.physicalMotorConnected==true);
assert(motor.limitValue==0);
if motor.speedRegulation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment