|
1 | 1 | % Eyelink already initialized! |
2 | | -% Running experiment on a 'EYELINK CL 4.56 ' tracker. |
3 | | -% Error in function Open: Usage error |
4 | | -% Could not find *any* audio hardware on your system - or at least not with the provided deviceid, if any! |
5 | | -% Error in function FillRect: Invalid Window (or Texture) Index provided: It doesn't correspond to an open window or texture. |
| 2 | +% Running experiment on a 'EYELINK CL 4.56 ' tracker. |
| 3 | +% Error in function Open: Usage error |
| 4 | +% Could not find *any* audio hardware on your system - or at least not with |
| 5 | +% the provided deviceid, if any! |
| 6 | +% Error in function FillRect: Invalid Window (or Texture) Index provided: |
| 7 | +% It doesn't correspond to an open window or texture. |
6 | 8 | % Did you close it accidentally via Screen('Close') or Screen('CloseAll') ? |
7 | | -% EYELINK: WARNING! PsychEyelinkCallRuntime() Failed to call eyelink runtime callback function PsychEyelinkDispatchCallback [rc = 1]! |
8 | | -% EYELINK: WARNING! Make sure that function is on your Matlab/Octave path and properly initialized. |
9 | | -% EYELINK: WARNING! May also be an error during execution of that function. Type ple at command prompt for error messages. |
10 | | -% EYELINK: WARNING! Auto-Disabling all callbacks to the runtime environment for safety reasons. |
11 | | -% Eyelink: In PsychEyelink_get_input_key(): Error condition detected: Trying to send TERMINATE_KEY abort keycode! |
12 | | - |
13 | | -% Eyelink: In PsychEyelink_get_input_key(): Error condition detected: Trying to send TERMINATE_KEY abort keycode! |
14 | | -% Error in function FillRect: Invalid Window (or Texture) Index provided: It doesn't correspond to an open window or texture. |
| 9 | +% EYELINK: WARNING! PsychEyelinkCallRuntime() Failed to call eyelink runtime |
| 10 | +% callback function PsychEyelinkDispatchCallback [rc = 1]! |
| 11 | +% EYELINK: WARNING! Make sure that function is on your Matlab/Octave path and |
| 12 | +% properly initialized. |
| 13 | +% EYELINK: WARNING! May also be an error during execution of that function. |
| 14 | +% Type ple at command prompt for error messages. |
| 15 | +% EYELINK: WARNING! Auto-Disabling all callbacks to the runtime environment |
| 16 | +% for safety reasons. |
| 17 | +% Eyelink: In PsychEyelink_get_input_key(): Error condition detected: Trying |
| 18 | +% to send TERMINATE_KEY abort keycode! |
| 19 | +% Eyelink: In PsychEyelink_get_input_key(): Error condition detected: Trying |
| 20 | +% to send TERMINATE_KEY abort keycode! |
| 21 | +% Error in function FillRect: Invalid Window (or Texture) Index provided: |
| 22 | +% It doesn't correspond to an open window or texture. |
15 | 23 | % Did you close it accidentally via Screen('Close') or Screen('CloseAll') ? |
16 | 24 | % Error using Screen |
17 | 25 | % Usage: |
18 | 26 | % |
19 | 27 | % Screen('FillRect', windowPtr [,color] [,rect] ) |
20 | 28 | % |
21 | 29 | % Error in eyeTracker (line 150) |
22 | | -% Screen('FillRect', cfg.screen.win, [0 0 0]); |
| 30 | +% Screen('FillRect', cfg.screen.win, [0 0 0]); |
23 | 31 | % |
24 | 32 | % Error in visualLocTanslational (line 52) |
25 | | -% [el] = eyeTracker('Calibration', cfg); |
| 33 | +% [el] = eyeTracker('Calibration', cfg); |
| 34 | + |
26 | 35 |
|
27 | 36 | function [el, edfFile] = eyeTracker(input, cfg, varargin) |
28 | 37 | % [el, edfFile] = eyeTracker(input, cfg, varargin) |
29 | 38 | % |
| 39 | + % Mosto of the comments with explanation (e.g. 'STEP #') come from `EyelinkEventExample.m` |
| 40 | + % |
30 | 41 | % Optional useful functions to implement in future: |
31 | 42 | % |
32 | 43 | % - oldlevel = Eyelink(‘Verbosity’ [,level]); |
|
77 | 88 | if ELinit ~= 0 |
78 | 89 | fprintf('Eyelink is not initialized, aborted.\n'); |
79 | 90 | Eyelink('Shutdown'); |
80 | | - Screen('CloseAll'); |
81 | | - return |
| 91 | + CleanUp() |
82 | 92 | end |
83 | 93 |
|
84 | 94 | % Make sure EL is still connected: returns 1 if connected, -1 if dummy-connected, |
|
87 | 97 | if ELconnection ~= 1 |
88 | 98 | fprintf('Eyelink is not connected, aborted.\n'); |
89 | 99 | Eyelink('Shutdown'); |
90 | | - Screen('CloseAll'); |
91 | | - return |
| 100 | + CleanUp() |
92 | 101 | end |
93 | 102 |
|
94 | 103 | % Last check that the EL is up to work |
95 | 104 | if ~EyelinkInit(0, 1) |
96 | 105 | fprintf('Eyelink Init aborted.\n'); |
97 | | - return |
| 106 | + CleanUp() |
98 | 107 | end |
99 | 108 |
|
100 | 109 | % Open the edf file to write the data |
|
120 | 129 | Eyelink('command', 'screen_pixel_coords = %ld %ld %ld %ld', 0, 0, 0, 0); |
121 | 130 | Eyelink('message', 'DISPLAY_COORDS %ld %ld %ld %ld', 0, 0, 0, 0); |
122 | 131 |
|
123 | | - if cfg.eyeTracker.defaultCalibration |
124 | | - |
125 | | - end |
126 | | - |
127 | | - % Set default calibration parameters |
128 | 132 | % set calibration type. |
129 | 133 | Eyelink('command', 'calibration_type = HV5'); |
130 | 134 |
|
131 | | - % you must send this command with value NO for custom calibration |
132 | | - % you must also reset it to YES for subsequent experiments |
133 | | - Eyelink('command', 'generate_default_targets = YES'); |
| 135 | + if cfg.eyeTracker.defaultCalibration |
134 | 136 |
|
135 | | - % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % |
136 | | -% |
137 | | -% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % |
138 | | -% % CUSTOM CALIBRATION |
139 | | -% % (SET MANUALLY THE DOTS COORDINATES, HERE FOR 6 DOTS) |
140 | | -% Eyelink('command', 'calibration_type = HV5'); |
141 | | -% % you must send this command with value NO for custom calibration |
142 | | -% % you must also reset it to YES for subsequent experiments |
143 | | -% Eyelink('command', 'generate_default_targets = NO'); |
144 | | -% |
145 | | -% % calibration and validation target locations |
146 | | -% [width, height]=Screen('WindowSize', screenNumber); |
147 | | -% Eyelink('command','calibration_samples = 6'); |
148 | | -% Eyelink('command','calibration_sequence = 0,1,2,3,4,5'); |
149 | | -% Eyelink('command','calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',... |
150 | | -% 640,512, ... %width/2,height/2 |
151 | | -% 640,102, ... %width/2,height*0.1 |
152 | | -% 640,614, ... %width/2,height*0.6 |
153 | | -% 128,341, ... %width*0.1,height*1/3 |
154 | | -% 1152,341 ); %width-width*0.1,height*1/3 |
155 | | -% |
156 | | -% Eyelink('command','validation_samples = 5'); |
157 | | -% Eyelink('command','validation_sequence = 0,1,2,3,4,5'); |
158 | | -% Eyelink('command','validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',... |
159 | | -% 640,512, ... %width/2,height/2 |
160 | | -% 640,102, ... %width/2,height*0.1 |
161 | | -% 640,614, ... %width/2,height*0.6 |
162 | | -% 128,341, ... %width*0.1,height*1/3 |
163 | | -% 1152,341 ); %width-width*0.1,height*1/3 |
164 | | -% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % |
| 137 | + % Set default calibration parameters |
| 138 | + |
| 139 | + |
| 140 | + % you must send this command with value NO for custom calibration |
| 141 | + % you must also reset it to YES for subsequent experiments |
| 142 | + Eyelink('command', 'generate_default_targets = YES'); |
| 143 | + |
| 144 | + else |
| 145 | + % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % |
| 146 | + % CUSTOM CALIBRATION |
| 147 | + % (SET MANUALLY THE DOTS COORDINATES, HERE FOR 6 DOTS) |
| 148 | + |
| 149 | + % you must send this command with value NO for custom calibration |
| 150 | + % you must also reset it to YES for subsequent experiments |
| 151 | + Eyelink('command', 'generate_default_targets = NO'); |
| 152 | + |
| 153 | + % calibration and validation target locations |
| 154 | + [width, height]=Screen('WindowSize', screenNumber); |
| 155 | + Eyelink('command','calibration_samples = 6'); |
| 156 | + Eyelink('command','calibration_sequence = 0,1,2,3,4,5'); |
| 157 | + Eyelink('command','calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',... |
| 158 | + 640,512, ... %width/2,height/2 |
| 159 | + 640,102, ... %width/2,height*0.1 |
| 160 | + 640,614, ... %width/2,height*0.6 |
| 161 | + 128,341, ... %width*0.1,height*1/3 |
| 162 | + 1152,341 ); %width-width*0.1,height*1/3 |
| 163 | + |
| 164 | + Eyelink('command','validation_samples = 5'); |
| 165 | + Eyelink('command','validation_sequence = 0,1,2,3,4,5'); |
| 166 | + Eyelink('command','validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',... |
| 167 | + 640,512, ... %width/2,height/2 |
| 168 | + 640,102, ... %width/2,height*0.1 |
| 169 | + 640,614, ... %width/2,height*0.6 |
| 170 | + 128,341, ... %width*0.1,height*1/3 |
| 171 | + 1152,341 ); %width-width*0.1,height*1/3 |
| 172 | + % % % % % % % % % % % % % % % % % % % % % % % % % % % % % |
| 173 | + |
| 174 | + end |
165 | 175 |
|
166 | 176 | % % set parser (conservative saccade thresholds) |
167 | 177 | % Eyelink('command', 'saccade_velocity_threshold = 35'); |
|
0 commit comments