Skip to content
Snippets Groups Projects
Commit 27788d41 authored by Maximilian Schnabel's avatar Maximilian Schnabel
Browse files

preemptively disconnect other existing EV3 objects

parent 6fca0231
No related branches found
No related tags found
2 merge requests!7Keep going if mountpoint exists (persistent),!6Docs NXT compatibility
......@@ -171,7 +171,16 @@ classdef EV3 < MaskedHandle
% brick.connect('usb', 'beep', 'on', );
%
% See also ISCONNECTED / :attr:`isConnected`
% save variables of base directory in vars
vars = evalin('base', 'whos');
for k = 1:length(vars)
% if another EV3 object exists, preemptively disconnect it to prevent connection error
if strcmp(vars(k).class, 'EV3')
evalin('base', [vars(k).name '.disconnect()'])
end
end
if ev3.isConnected
if isCommInterfaceValid(ev3.commInterface)
% Warning lead to confusion of students. Since brick connection is still working
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment