Skip to content

Commit c7d93dc

Browse files
committed
Added continuous "on" button to pulse pal plugin canvas
I added a "continuous" button to each output channel on the pulse pal plugin canvas so that users can set the pulse pal's "continuous" triggering state to either "on" or "off". I added this because when the user fires up the open ephys pulse pal plugin, all of the options predict a finite pulse train. If the "continuous" state has previously been set to "on" another way, the open ephys plugin options cannot turn it off, and the user may wonder why their pulse train continues indefinitely. The continuous on/off trigger state is also nice to have for debugging experimental setups.
1 parent f744889 commit c7d93dc

4 files changed

Lines changed: 37 additions & 2 deletions

File tree

Source/Plugins/PulsePalOutput/PulsePalOutput.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ PulsePalOutput::PulsePalOutput()
6565
m_linkTriggerChannel1 = vector<int>(PULSEPALCHANNELS, 0);
6666
m_linkTriggerChannel2 = vector<int>(PULSEPALCHANNELS, 0);
6767
m_triggerMode = vector<int>(PULSEPALCHANNELS, 0);
68+
m_continuous = vector<int>(PULSEPALCHANNELS, 0);
6869

6970
for (int i = 0; i < PULSEPALCHANNELS; ++i)
7071
{
@@ -194,6 +195,7 @@ bool PulsePalOutput::updatePulsePal(int chan)
194195
pulsePal.setTrigger1Link(actual_chan, m_linkTriggerChannel1[chan]);
195196
pulsePal.setTrigger2Link(actual_chan, m_linkTriggerChannel2[chan]);
196197
pulsePal.setTriggerMode(actual_chan, m_triggerMode[chan]);
198+
pulsePal.setContinuousLoop(actual_chan, m_continuous[chan]);
197199
return true;
198200
}
199201
else
@@ -278,6 +280,11 @@ int PulsePalOutput::getTriggerMode(int chan) const
278280
return m_triggerMode[chan];
279281
}
280282

283+
int PulsePalOutput::getContinuous(int chan) const
284+
{
285+
return m_continuous[chan];
286+
}
287+
281288
uint32_t PulsePalOutput::getPulsePalVersion() const
282289
{
283290
return pulsePalVersion;
@@ -361,6 +368,11 @@ void PulsePalOutput::setTriggerMode(int chan, int mode)
361368
m_triggerMode[chan] = mode;
362369
}
363370

371+
void PulsePalOutput::setContinuous(int chan, int continued)
372+
{
373+
m_continuous[chan] = continued;
374+
}
375+
364376
void PulsePalOutput::setTTLsettings(int chan)
365377
{
366378
m_isBiphasic[chan] = 0;
@@ -443,6 +455,7 @@ void PulsePalOutput::saveCustomParametersToXml(XmlElement *parentElement)
443455
chan->setAttribute("link2trigger1", m_linkTriggerChannel1[i]);
444456
chan->setAttribute("link2trigger2", m_linkTriggerChannel2[i]);
445457
chan->setAttribute("triggermode", m_triggerMode[i]);
458+
chan->setAttribute("continuous", m_continuous[i]);
446459
mainNode->addChildElement(chan);
447460
}
448461
}
@@ -473,6 +486,7 @@ void PulsePalOutput::loadCustomParametersFromXml ()
473486
int link21 = chan->getIntAttribute("link2trigger1");
474487
int link22 = chan->getIntAttribute("link2trigger2");
475488
int trigger = chan->getIntAttribute("triggermode");
489+
int contd = chan->getIntAttribute("continuous");
476490
m_isBiphasic[id] = biphasic;
477491
m_phase1Duration[id] = phase1;
478492
m_phase2Duration[id] = phase2;
@@ -488,6 +502,7 @@ void PulsePalOutput::loadCustomParametersFromXml ()
488502
m_linkTriggerChannel1[id] = link21;
489503
m_linkTriggerChannel2[id] = link22;
490504
m_triggerMode[id] = trigger;
505+
m_continuous[id] = contd;
491506
}
492507
}
493508
}

Source/Plugins/PulsePalOutput/PulsePalOutput.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class PulsePalOutput : public GenericProcessor
121121
int getLinkTriggerChannel1(int chan) const;
122122
int getLinkTriggerChannel2(int chan) const;
123123
int getTriggerMode(int chan) const;
124+
int getContinuous(int chan) const;
124125
void setIsBiphasic(int chan, bool isBiphasic);
125126
void setNegFirst(int chan, bool negFirst);
126127
void setPhase1Duration(int chan, float phaseDuration);
@@ -136,7 +137,8 @@ class PulsePalOutput : public GenericProcessor
136137
void setTrainDelay(int chan, float trainDelay);
137138
void setLinkTriggerChannel1(int chan, int link);
138139
void setLinkTriggerChannel2(int chan, int link);
139-
void setTriggerMode(int chan, int mode);
140+
void setTriggerMode(int chan, int mode);
141+
void setContinuous(int chan, int continued);
140142
/**
141143
* @brief setTTLsettings sets channel chan to TTL settings
142144
* @param chan: channel number (0-1-2-3)
@@ -190,6 +192,7 @@ class PulsePalOutput : public GenericProcessor
190192
vector<int> m_linkTriggerChannel1;
191193
vector<int> m_linkTriggerChannel2;
192194
vector<int> m_triggerMode;
195+
vector<int> m_continuous;
193196
// Pulse Pal instance and version
194197
PulsePal pulsePal;
195198
uint32_t pulsePalVersion;

Source/Plugins/PulsePalOutput/PulsePalOutputCanvas.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ void PulsePalOutputCanvas::resized()
122122
link2tr2Button[i]->setBounds(0.12*getWidth() + 0.25*i*getWidth(), 0.83*getHeight(), 0.11*getWidth(), 0.03*getHeight());
123123
biphasicButton[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.87*getHeight(), 0.11*getWidth(), 0.03*getHeight());
124124
burstButton[i]->setBounds(0.12*getWidth() + 0.25*i*getWidth(), 0.87*getHeight(), 0.11*getWidth(), 0.03*getHeight());
125-
ttlButton[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.91*getHeight(), 0.22*getWidth(), 0.06*getHeight());
125+
ttlButton[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.91*getHeight(), 0.11*getWidth(), 0.06*getHeight());
126+
continuousButton[i]->setBounds(0.12*getWidth() + 0.25*i*getWidth(), 0.91*getHeight(), 0.11*getWidth(), 0.06*getHeight());
126127
}
127128

128129
refresh();
@@ -220,6 +221,13 @@ void PulsePalOutputCanvas::buttonClicked(Button* button)
220221
burstButton[i]->setToggleState(false, dontSendNotification);
221222
}
222223
}
224+
else if (button == continuousButton[i])
225+
{
226+
if (button->getToggleState() == true)
227+
processor->setContinuous(i, 1);
228+
else if (button->getToggleState() == false)
229+
processor->setContinuous(i, 0);
230+
}
223231
if (!processor->checkParameterConsistency(i))
224232
{
225233
CoreServices::sendStatusMessage("Inconsistent parameters: set train duration first");
@@ -446,6 +454,14 @@ void PulsePalOutputCanvas::initButtons()
446454
ttlButton[i] = ttl;
447455
addAndMakeVisible(ttlButton[i]);
448456

457+
ScopedPointer<UtilityButton> continuous = new UtilityButton("continuous", Font("Small Text", 20, Font::plain));;
458+
continuous->setRadius(3.0f);
459+
continuous->addListener(this);
460+
continuous->setClickingTogglesState(true);
461+
continuousButton[i] = continuous;
462+
addAndMakeVisible(continuousButton[i]);
463+
464+
449465
ScopedPointer<ComboBox> mode = new ComboBox();
450466
mode->addListener(this);
451467
for (int i = 0; i < 3; i++)

Source/Plugins/PulsePalOutput/PulsePalOutputCanvas.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class PulsePalOutputCanvas : public Visualizer,
9090
ScopedPointer<UtilityButton> ttlButton[PULSEPALCHANNELS];
9191
ScopedPointer<UtilityButton> link2tr1Button[PULSEPALCHANNELS];
9292
ScopedPointer<UtilityButton> link2tr2Button[PULSEPALCHANNELS];
93+
ScopedPointer<UtilityButton> continuousButton[PULSEPALCHANNELS];
9394
ScopedPointer<ComboBox> triggerMode[PULSEPALCHANNELS];
9495

9596
ScopedPointer<Label> channelLabel[PULSEPALCHANNELS];

0 commit comments

Comments
 (0)