Has anyone come up with a friendli-ish way of temporarily disabling use of the parallel port component during script development where it will be needed for deployment but where the test machine does not have a parallel port?
At the moment the script just crashes if the host machine doesn’t have a p-port but deleting/readding it - often in a number of places is a pain.
What would be nice is a checkbox in Experiment settings to enable/disable any calls to the parallel port (in a similar manner to how the Escape key is enabled.
I’m having to just use inline code all the time instead of the parallel port component which then makes it harder for non-programmers to work with.
I’m guessing it wouldn’t be tricky to implement - if a suitable checkbox is set (say immediately under the ‘parallel ports’ field in General preferences) then just don’t compile any of the related parallel code into the ‘lastrun’ file so it wouldn’t slow down operation at all.
If this is the case then could it be added to a ‘Todo’ list please?
Anyone else think this might be a useful refinement to Builder?
This isn’t possible at present, although I can see it would be useful. Not sure how to do it cleanly and in a way that people don’t accidentally run their study while not collecting important triggers.
For now, I guess you need to use a Code Component (rather than the i/o component) with something like this. The idea is to emulate a parallel port on request (using the experiment info dialog in experiment settings) and provide a real one if not.:
if expInfo['emulateTriggers']:
class PortEmulator(object):
def __init__(self, address=None):
pass
def setData(self, data=None):
logging.warn("Sent data to non-existent PPort:{}".format(data))
pport = PortEmulator()
else:
pport = ParallelPort(address='0x0378')
Then you can use pport by making calls to on each frame sections (or begin/end routine sections) as needed: