Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the global_timer CANCEL bug; allowing TRIGGERING and CANCELING more than one timers #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions pybpodapi/state_machine/state_machine_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,21 @@ def add_state(
output_code
== self.hardware.channels.events_positions.globalTimerTrigger
):
self.global_timers.triggers_matrix[state_name_idx] = 2 ** (
output_value - 1
)
# self.global_timers.triggers_matrix[state_name_idx] = 2 ** (
# output_value - 1 )

# output_value here could be a decimal integer representing (more than one) bits to TRIGGER
# E.g.: 3 = '11' = trigger timers 1 & 2
self.global_timers.triggers_matrix[state_name_idx] = output_value

if output_code == self.hardware.channels.events_positions.globalTimerCancel:
self.global_timers.cancels_matrix[output_value - 1] = 1

# self.global_timers.cancels_matrix[output_value - 1] = 1 # This doesn't work

# output_value here could be a decimal integer representing (more than one) bits to CANCEL
# E.g.: 3 = '11' = cancel timers 1 & 2
self.global_timers.cancels_matrix[state_name_idx] = output_value


self.output_matrix[state_name_idx].append((output_code, output_value))

Expand Down