Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ev3-toolbox-matlab
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mindstorms
ev3-toolbox-matlab
Commits
00fd0580
Commit
00fd0580
authored
8 years ago
by
Tim Stadtmann
Browse files
Options
Downloads
Plain Diff
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/Motor.m
+23
-4
23 additions, 4 deletions
source/Motor.m
source/Sensor.m
+6
-2
6 additions, 2 deletions
source/Sensor.m
with
29 additions
and
6 deletions
source/Motor.m
+
23
−
4
View file @
00fd0580
...
...
@@ -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 release
Brake
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
This diff is collapsed.
Click to expand it.
source/Sensor.m
+
6
−
2
View file @
00fd0580
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment