Skip to content

Commit 75e43ee

Browse files
committed
Fix Phase Detector trigger channel always returning 0
Phase Detector was setting trigger channel to 0 despite the channel selector interface showing correct channel as selected. Changed the way how `param` value was fetched. Before it was simply converting the `var` value to `int` and then using that as local index. Now, it fetches the `param` value as an `array`, then gets the first value of that `array` (since max selecetable channels is 1) and uses that as local index.
1 parent 1e0f9db commit 75e43ee

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

Plugins/PhaseDetector/PhaseDetector.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,18 @@ void PhaseDetector::parameterValueChanged(Parameter* param)
104104
}
105105
else if (param->getName().equalsIgnoreCase("Channel"))
106106
{
107-
int localIndex = (int)param->getValue();
108-
int globalIndex = getDataStream(param->getStreamId())->getContinuousChannels()[localIndex]->getGlobalIndex();
109-
settings[param->getStreamId()]->triggerChannel = globalIndex;
107+
Array<var>* array = param->getValue().getArray();
108+
109+
if (array->size() > 0)
110+
{
111+
int localIndex = int(array->getFirst());
112+
int globalIndex = getDataStream(param->getStreamId())->getContinuousChannels()[localIndex]->getGlobalIndex();
113+
settings[param->getStreamId()]->triggerChannel = globalIndex;
114+
}
115+
else
116+
{
117+
settings[param->getStreamId()]->triggerChannel = -1;
118+
}
110119
}
111120
else if (param->getName().equalsIgnoreCase("TTL_out"))
112121
{

0 commit comments

Comments
 (0)