Commit d05332ea authored by Jesse Heckman's avatar Jesse Heckman

fix lsl bug

parent 03a22ee5
......@@ -78,7 +78,7 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
mxevent = max(ev);
sel = ismember(ev,mxevent);
mxdelay = max([de(sel) ceil(1000*cfg.nsamples./cfg.RZ6Fs) ]);
mxdelay = max([de(sel) ceil(1000*cfg.nsamples./cfg.RZ6Fs)]);
cfg.RZ6_1.SetTagVal('eventWait',mxevent+1);
cfg.RZ6_1.SetTagVal('delayWait',mxdelay);
......
......@@ -27,7 +27,7 @@ function pb_vEndExp
%% Let's run some LEDs instead
leds = ledcontroller_pi('dcn-led06','dcn-led07');
leds = ledcontroller_pi('dcn-led09','dcn-led10','dcn-led06','dcn-led07');
pb_lightshow(leds);
%% Mop up
......
......@@ -217,7 +217,7 @@ function signal = readVest(line)
% reads VS signal from the expfile
types = {'none','sine','noise','turn','vor'};
n = str2num(erase(sscanf(line,'%s',2),sscanf(line,'%s',1)));
n = str2num(erase(sscanf(line,'%s',2),sscanf(line,'%s',1)));
type = types{n};
signal.type = type;
......
......@@ -14,23 +14,24 @@ function pb_lightshow(leds)
ir = 50;
ig = ir;
seq1 = [0:2:9 fliplr(16:2:24)];
seq2 = [1:2:9 fliplr(17:2:24)];
% Sequence needs updating due to new SLC distribution
seq1 = [0:2:9 fliplr(16:2:63)];
seq2 = [1:2:9 fliplr(17:2:63)];
for i=1:n
if mod(i,2) == 0
s(i).set(seq1,'r');
for iC = 1:n
if mod(iC,2) == 0
s(iC).set(seq1,'r');
else
s(i).set(seq2,'g');
s(iC).set(seq2,'g');
end
s(i).intensity('r', ir);
s(i).intensity('g', ig);
s(iC).intensity('r', ir);
s(iC).intensity('g', ig);
end
leds.write(s);
for i=1:n
leds.trigger;
for iC = 1:n
leds.trigger;
pause(0.35);
end
delete(s);
......
......@@ -7,9 +7,11 @@ function [ses,str] = pb_runLSL(varargin)
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
% check if all streams are necesary
de = pb_keyval('de', varargin, true);
pl = pb_keyval('pl', varargin, true);
gz = pb_keyval('gz', varargin, false);
pl = pb_keyval('pl', varargin, false);
gz = pb_keyval('gz', varargin, true);
pd = pb_keyval('pd', varargin, false);
ot = pb_keyval('ot', varargin, true);
......
......@@ -7,9 +7,7 @@ function pb_MUX(RP,Device,Channel)
% PBToolbox (2019): JJH: j.heckman@donders.ru.nl
if nargin<3
Channel = 0;
end
if nargin<3; Channel = 0; end
RP.SetTagVal('DeviceSelect',Device-1); % select the device
if Channel % activate a channel
......
function [ses,str] = pb_runLSL2(varargin)
% PB_RUNLSL2
%
% PB_RUNLSL2(varargin) creates a LSL session for VC.
%
% See also PB_VRUNEXP
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
de = pb_keyval('de', varargin, true);
pl = pb_keyval('pl', varargin, true);
gz = pb_keyval('gz', varargin, false);
pd = pb_keyval('pd', varargin, false);
ot = pb_keyval('ot', varargin, true);
tmp = {};
streams = {'type=''Digital Events @ lslder01'' and name=''Digital Events 0''', ...
'type=''Pupil Capture @ pupil-desktop'' and name=''Pupil Python Representation - Eye 0''', ...
'type=''Pupil Capture @ pupil-desktop'' and name=''Gaze Python Representation''', ...
'type=''Pupil Capture @ pupil-desktop'' and name=''Pupil Primitive Data - Eye 0''', ...
'type=''OptiTrack Mocap @ DCN-OT01'' and name=''Rigid Bodies'''};
if de; tmp(end+1) = streams(1); end
if pl; tmp(end+1) = streams(2); end
if gz; tmp(end+1) = streams(3); end
if pd; tmp(end+1) = streams(4); end
if ot; tmp(end+1) = streams(5); end
streams = tmp;
ses = lsl_session();
ls = length(streams);
str = lsl_istream.empty(0,ls);
clear tmp;
for iStrm = 1:ls
% Find, select and make streams for LSL.
tmp = strrep(streams(iStrm),'type=''','');
tmp = tmp{1}(1:find(tmp{1} == '@',1)-2);
info = lsl_resolver(streams{iStrm});
l = info.list();
if isempty(l); error('No streams found'); end
str(iStrm) = lsl_istream(info{1});
ses.add_stream(str(iStrm));
end
c = 1;
if de; addlistener(str(c),'DataAvailable', @listener); c = c+1; end
if pl; addlistener(str(c),'DataAvailable', @listener); c = c+1; end
if gz; addlistener(str(c),'DataAvailable', @listener); c = c+1; end
if pd; addlistener(str(c),'DataAvailable', @listener); c = c+1; end
if ot; addlistener(str(c),'DataAvailable', @listener); end
end
function listener(~, event)
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2018) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment