How to Achieve Consistent CFF (Critical Flicker Fusion) Presentation on a 240Hz Screen?

There are thing that could be improved in your script and approach, but for up to 30 minutes of my time in delving into this more, you’ll have to buy paid support help PsychPaidSupportAndServices.

Three free pieces of advice:

  • If you want to have the best chance of reliable, precisely timed presentation in general, but especially for higher refresh rates like 240 Hz or for multi-display setups, switch to a recommended Linux variant with recommended graphics hardware.
  • If you absolutely must use Microsoft Windows for this (probably the worst choice), do not use dual-display/multi-display setups, where Windows is especially fragile wrt. timing, only a computer with a single display monitor connected and active. No HiDPI displays either.
  • Text drawing is a relatively expensive operation, which can take milliseconds, so avoiding that, or being clever about it, gives more headroom for situations like yours, where you only have 4 msecs available for all processing in a frame.

Even with these tips, MS-Windows may not cut it.

Good luck.