DasCheck.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. function [Hit Time] = DasCheck
  2. global Par
  3. persistent PC %cached previous eye position
  4. persistent LObj %cached handel to plot object
  5. % persistent SObj %cached handel to plot object
  6. % persistent Tick %every tick update noise plot
  7. % Now that LPStat is a MEX file, it's 0-based instead of 1-based
  8. Hit = LPStat(1); %Hit yes or no
  9. Time = LPStat(0); %time
  10. POS = dasgetposition();
  11. P = POS.*Par.ZOOM; %average position over window initialized in DasIni
  12. % eye position to global to allow logging
  13. Par.CurrEyePos = [POS(1) POS(2)];
  14. if ishandle(LObj)
  15. addpoints(LObj,[PC(1) P(1)],[PC(2) P(2)]);
  16. if strcmp(Par.tracker_version, 'tracker_dark')
  17. set(LObj,'Color','w')
  18. end
  19. else
  20. LObj = animatedline( [P(1) P(1)], [P(2) P(2)], 'MaximumNumPoints',100);
  21. if strcmp(Par.tracker_version, 'tracker_dark')
  22. set(LObj,'Color','w')
  23. end
  24. end
  25. % if isempty(Tick) || Tick > Time
  26. % Tick = Time;
  27. % end
  28. % if Time - Tick > 200 && Par.NoiseUpdate %update every 200 ms
  29. % P = dasgetnoise();
  30. % %2* standard error of noise in x & y direction
  31. % SDx = ([-P(1) 0 P(1) 0 -P(1)] + Par.OFFx)* Par.ZOOM;
  32. % SDy = ([0 P(2) 0 -P(2) 0]+ Par.OFFy)* Par.ZOOM;
  33. % if isempty(SObj) || ~ishandle(SObj)
  34. % SObj = line( 'XData', SDx, 'YData', SDy, 'color', 'g', 'EraseMode','none');
  35. %
  36. % else
  37. % set(SObj, 'XData', SDx, 'YData', SDy)
  38. %
  39. % end
  40. % Tick = Time;
  41. % end
  42. drawnow %update screen
  43. % cache the following values
  44. PC = P;