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

Merge branch 'develop'

Patches master to version v0.4-rc.12
parents ed521e41 894a093d
No related branches found
No related tags found
No related merge requests found
......@@ -1148,7 +1148,7 @@ classdef Motor < MaskedHandle & dynamicprops
error('Motor::releaseBrake: No physical motor connected to Port %s',...
port2str('Motor', motor.port));
elseif motor.currentSpeed~=0
error('Motor::releaseBrake: Can''t releaseBrake brake because Motor is moving');
error('Motor::releaseBrake: Can''t release brake because Motor is moving');
end
if motor.speedRegulation
......@@ -1257,15 +1257,34 @@ classdef Motor < MaskedHandle & dynamicprops
end
function resetPhysicalMotor(motor)
%
% Do nothing if their is either no connection or no motor connected to port
if ~motor.connectedToBrick || ~motor.physicalMotorConnected
return;
end
% If motor is *busily* running, stop it. That avoids suicidal stuff like:
% b = EV3(); b.connect('usb');
% b.motorA.start();
% b.disconnect(); -> Motor still running and cannot directly be stopped anymore
if motor.isRunning
motor.stop();
end
% Reset tacho values
motor.resetTachoCount();
motor.internalReset();
motor.setBrake(0);
%motor.stop();
% setBrake (correctly) throws an error if currentSpeed ~= 0. In this case, it
% has already been checked if motor is busily running. At this point, the only
% things that provoke a currentSpeed~=0 are coasting into a stop or a user manually
% spinning the motor. In both cases, there is no active brake set which means that
% setBrake(0) unnecessary either way. Therefore, if setBrake throws an error, it
% can be safely ignored.
try
motor.setBrake(0);
catch ME
% Safely ignore this...
end
end
end
end
......@@ -527,8 +527,12 @@ classdef Sensor < MaskedHandle
return
end
sensor.mode = DeviceMode(sensor.type, uint8(0));
sensor.reset;
try
sensor.mode = DeviceMode(sensor.type, uint8(0));
sensor.reset;
catch ME
% For now: ignore...
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment