Skip to content

Commit

Permalink
Simplify if emulator branching in base
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaraneen committed Dec 24, 2020
1 parent 4c215eb commit f1d0702
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions pybpodapi/bpod/bpod_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,23 +272,18 @@ def run_state_machine(self, sma):

self.trial_timestamps = [] # Store the trial timestamps in case bpod is using live_timestamps

if self._emulator is None:
self._bpodcom_run_state_machine()

if self._new_sma_sent and self._emulator is None:
if self._bpodcom_state_machine_installation_status():
self._new_sma_sent = False
else:
raise BpodErrorException('Error: The last state machine sent was not acknowledged by the Bpod device.', self)
elif self._emulator:
self._emulator.set_state_machine(sma)

if self._emulator:
self._emulator.set_state_machine(sma)
self._emulator.initialize()
self._emulator.mirror_state(sma.current_state)
# TODO: Do the BpodSystem.RefreshGUI equivalent
self.trial_start_timestamp = self._emulator.matrix_start_time
else:
self._bpodcom_run_state_machine()
if self._bpodcom_state_machine_installation_status():
self._new_sma_sent = False
else:
raise BpodErrorException('Error: The last state machine sent was not acknowledged by the Bpod device.', self)
self.trial_start_timestamp = self._bpodcom_get_trial_timestamp_start()

if self.bpod_start_timestamp is None:
Expand Down

0 comments on commit f1d0702

Please sign in to comment.