Hi Jeff,
You can set up to 8 individual thresholds. They don't have to be negative, and the events they generate are in the order listed, for instance, for
R.Thresholds = [10 20 30 40 50 60 70 80];
crossing 10 would generate a RotaryEncoder1_1 event,
crossing 20 would genereate a RotaryEncoder1_2 event, etc.
Once a threshold is crossed, it is disabled until explicitly re-enabled.
You can re-enable all thresholds at once by having the state machine send command 'E' to the rotary encoder module:
sma = AddState(sma, 'Name', 'MyState', ...
'Timer', 0,...
'StateChangeConditions', {'Tup', 'MyNextState'},...
'OutputActions', {'RotaryEncoder1', 'E'});
So for your application, you'd set R.Thresholds to include both sets of thresholds you described.
Your first state would enable all thresholds.
You'd set your 'WaitForTrialStart' state to return to the first state if thresholds 1 or 2 were crossed (events for thresholds 3 and 4 would be captured, but would not influence the flow of states).
After the animal successfully waits for trial start, you'd go through a state that reset the thresholds before continuing the trial.
You'd then set your 'WaitForChoice' state to handle only thresholds 3 and 4.
Please let me know if this helps!
-Josh