Skip to content

Commit

Permalink
unambiguous softcodes - whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
bimac committed Jul 6, 2023
1 parent b62e7f7 commit dc23cc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions iblrig/base_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import iblrig
import iblrig.path_helper
from iblutil.util import Bunch, setup_logger
from iblrig.hardware import Bpod, MyRotaryEncoder, sound_device_factory
from iblrig.hardware import Bpod, MyRotaryEncoder, sound_device_factory, SOFTCODE
import iblrig.frame2TTL as frame2TTL
import iblrig.sound as sound
import iblrig.spacer
Expand Down Expand Up @@ -629,14 +629,13 @@ def softcode_handler(code):
Soft codes should work with resasonable latency considering our limiting
factor is the refresh rate of the screen which should be 16.667ms @ a framerate of 60Hz
"""
print(code)
if code == 0:
if code == SOFTCODE.STOP_SOUND:
self.sound['sd'].stop()
elif code == 1:
elif code == SOFTCODE.PLAY_TONE:
self.sound['sd'].play(self.sound['GO_TONE'], self.sound['samplerate'])
elif code == 2:
elif code == SOFTCODE.PLAY_NOISE:
self.sound['sd'].play(self.sound['WHITE_NOISE'], self.sound['samplerate'])
elif code == 3:
elif code == SOFTCODE.TRIGGER_CAMERA:
self.trigger_bonsai_cameras()
self.bpod.softcode_handler_function = softcode_handler

Expand Down
4 changes: 2 additions & 2 deletions iblrig_tasks/_iblrig_tasks_neuroModulatorChoiceWorld/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import iblrig.misc
from iblrig.base_choice_world import BiasedChoiceWorldSession

from iblrig.hardware import SOFTCODE

log = logging.getLogger("iblrig")

Expand Down Expand Up @@ -59,7 +59,7 @@ def get_state_machine_trial(self, i):
state_name="trial_start",
state_timer=0,
state_change_conditions={"Port1In": "delay_initiation"},
output_actions=[("SoftCode", 3), ("BNC1", 255)],
output_actions=[("SoftCode", SOFTCODE.TRIGGER_CAMERA), ("BNC1", 255)],
) # start camera
sma.add_state(
state_name="delay_initiation",
Expand Down

0 comments on commit dc23cc0

Please sign in to comment.