Skip to content

Commit

Permalink
BF: Sleep after threshold change needs to be longer than time to mess…
Browse files Browse the repository at this point in the history
…age back
  • Loading branch information
todd committed Jul 18, 2024
1 parent 8ba8717 commit e1f4891
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion psychopy_bbtk/tpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import serial
import re
import sys
import time

# possible values for self.channel
channelCodes = {
Expand Down Expand Up @@ -106,7 +107,9 @@ def _setThreshold(self, threshold, channel):
self.parent.setMode(0)
# send command to set threshold
self.parent.sendMessage(f"AAO{channel+1} {int(threshold)}")
self.parent.pause()
# force a sleep for diode to settle
time.sleep(0.1)
# get 0 or 1 according to light level
resp = self.parent.awaitResponse(timeout=0.1)
# with this threshold, is the photodiode returning True?
measurement = None
Expand Down

0 comments on commit e1f4891

Please sign in to comment.