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

Make pause after sending packets adjustable

... for testing purposes
parent d9f8d412
Branches
Tags
No related merge requests found
......@@ -103,6 +103,8 @@ classdef CommunicationInterface < handle
properties
% Debug
debug;
pauseAfterSend = 0;
end
properties (SetAccess = private)
......@@ -211,6 +213,14 @@ classdef CommunicationInterface < handle
end
end
function set.pauseAfterSend(brick, pauseAfterSend)
if pauseAfterSend < 0
error('Give pauseLength invalid.');
end
brick.pauseAfterSend = pauseAfterSend;
end
function set.debug(brick, debug)
% If debug is set in this layer, also set BrickIO.debug in lower layer
brick.debug = debug;
......@@ -264,8 +274,10 @@ classdef CommunicationInterface < handle
% behaving 'strange'. Sometimes, commands will be executed only with
% a delay, some commands may even be bypassed.
% (Maybe too many commands screw up the brick's internal command queue?..)
% Temporary workaround: Wait 5ms after each sent packet.
pause(0.005);
% Temporary workaround: Wait pauseAfterSend seconds after each sent packet.
if brick.pauseAfterSend > 0
pause(brick.pauseAfterSend);
end
% Verbose output
if brick.debug > 0
......
......@@ -60,6 +60,9 @@ classdef EV3 < MaskedHandle
% - 2: Low-level-Debug turned on - each packet sent and received is printed to the
% console
debug;
% Seconds waited after each send
pauseAfterSend = 0;
end
properties (Dependent) % Parameters to be read directly from physical brick
......@@ -406,6 +409,15 @@ classdef EV3 < MaskedHandle
end
end
function set.pauseAfterSend(ev3, pauseAfterSend)
if pauseAfterSend < 0
error('Give pauseLength invalid.');
end
ev3.pauseAfterSend = pauseAfterSend;
ev3.commInterface.pauseAfterSend = pauseAfterSend; % This does the real job
end
function setProperties(ev3, varargin)
% Set multiple EV3 properties at once using MATLAB's inputParser.
%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment