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

isRunning is now also true if motor runs w/o limit

The implementation is based on a new flag, 'startedNotBusy', which
is set to true if single motor is started w/o limit.
parent 88f22201
Branches
Tags
No related merge requests found
......@@ -98,6 +98,7 @@ classdef Motor < MaskedHandle & dynamicprops
connectedToBrick = false; % Connection to physical Brick?
init = true; % Indicates 'init-phase' (True as long as constructor is running)
startedNotBusy = false; % Set to true if motor started w/o tacholimit and unsynced
sendPowerOnSet = false; % If true, OUTPUT_POWER is sent when setting power
% Bitfield representing which opCodes should be sent on Motor.start()
......@@ -201,6 +202,7 @@ classdef Motor < MaskedHandle & dynamicprops
if motor.debug
fprintf('(DEBUG) Motor::start: Called outputStart on Port %s\n', port2str('Motor', motor.port));
end
motor.startedNotBusy = true;
else
limit = motor.limitValue - (motor.smoothStart + motor.smoothStop);
if limit < 0
......@@ -270,6 +272,8 @@ classdef Motor < MaskedHandle & dynamicprops
if motor.debug
fprintf('(DEBUG) Motor::stop: Called outputStop on Port %s\n', port2str('Motor', motor.port));
end
motor.startedNotBusy = false;
end
function syncedStart(motor, syncMotor, varargin)
......@@ -842,9 +846,15 @@ classdef Motor < MaskedHandle & dynamicprops
function running = get.isRunning(motor)
running = 0;
if motor.connectedToBrick
running = motor.getBusyFlag();
busyFlag = motor.getBusyFlag();
else
busyFlag = 0;
end
assert(~(motor.startedNotBusy && busyFlag));
running = motor.startedNotBusy || busyFlag;
end
function synced = get.isSynced(motor)
......@@ -1053,6 +1063,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
end
methods (Access = {?EV3})
function connect(motor,commInterface)
%connect Connects Motor-object to physical brick.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment