-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGRFSaccadeState.m
More file actions
57 lines (49 loc) · 1.35 KB
/
GRFSaccadeState.m
File metadata and controls
57 lines (49 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// GRFSaccadeState.m
// Experiment
//
// Copyright (c) 2006. All rights reserved.
//
#import "GRFSaccadeState.h"
#import "GRFUtilities.h"
#import "GRFDigitalOut.h"
@implementation GRFSaccadeState
- (void)stateAction {
[[task dataDoc] putEvent:@"saccade"];
// [digitalOut outputEvent:kSaccadeDigitOutCode withData:(kSaccadeDigitOutCode+1)];
[digitalOut outputEventName:@"saccade" withData:0.0];
expireTime = [LLSystemUtil timeFromNow:[[task defaults] integerForKey:GRFSaccadeTimeMSKey]];
}
- (NSString *)name {
return @"GRFSaccade";
}
- (LLState *)nextState;
{
if ([task mode] == kTaskIdle) {
eotCode = kMyEOTQuit;
return [[task stateSystem] stateNamed:@"Endtrial"];
}
if (eotCode == kMyEOTBroke) { // got here by leaving fixWindow early (from stimulate)
if ([GRFUtilities inWindow:respWindow]) {
eotCode = kMyEOTEarlyToValid;
return [[task stateSystem] stateNamed:@"Endtrial"];
}
if ([LLSystemUtil timeIsPast:expireTime]) {
eotCode = kMyEOTBroke;
brokeDuringStim = YES;
return [[task stateSystem] stateNamed:@"Endtrial"];
}
}
else {
if ([GRFUtilities inWindow:respWindow]) {
eotCode = kMyEOTCorrect;
return [[task stateSystem] stateNamed:@"Endtrial"];
}
if ([LLSystemUtil timeIsPast:expireTime]) {
eotCode = kMyEOTMissed;
return [[task stateSystem] stateNamed:@"Endtrial"];
}
}
return nil;
}
@end