Keisuke Sehara
/
STM32_Whisking
fast-feedback virtual target task code on STM Nucleo
Diff: states.cpp
- Revision:
- 30:5f975f572ffb
- Parent:
- 29:1fb060aab1f8
- Child:
- 31:b320ca61a8c0
--- a/states.cpp Mon Oct 01 14:54:37 2018 +0000 +++ b/states.cpp Mon Oct 01 15:16:04 2018 +0000 @@ -58,7 +58,9 @@ void Monitor::setup() { LOGSTATE(Monitor) - rewardOut.run(); + if (trial.flag.rewarded == true) { + rewardOut.run(); + } lickIn.attach(&automaton::jump<Monitor,WithResp>); scheduler::set(ms_to_us(task.resp_dur_ms.value), &automaton::jump<Monitor,NoResp>); } @@ -160,8 +162,11 @@ lickIn.detach(); // if any gateIn.detach(); // if any - if ( trial.flag.cued && (task.mode.value != Condition) ) { - // reward will be there only when the cue was there + if (task.mode.value == Condition) { + if (!trial.flag.rewarded) { + rewardOut.start(); + } + } else if (trial.flag.cued) { rewardOut.start(); } @@ -196,4 +201,12 @@ void TestReward::teardown() { // do nothing -} \ No newline at end of file +} + +void ClearTrialIndex::setup() { + trial.index = 1; +} + +void ClearTrialIndex::teardown() { + // do nothing +}