Commit 89954301 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Compute enabled/reversed flags in Manager for out->in links

parent 77aa0480
......@@ -1165,12 +1165,56 @@ void Manager::doBuildChains (void) {
}
/// handle special direct mappings
for (LinkAnalogOutputToAnalogInput * link : arrayRange (m_linksAnalogOutputToAnalogInput)) {
link->update_enabled (true); // TODO : handle disabled node at one/both of the ends
link->update_reversed (false); // TODO : handle passive node at one/both of the ends
bool enabled = true;
bool reversed = false;
if (AnalogOutput * output = qobject_cast<AnalogOutput *> (link->get_source ())) {
if (Node * node = nodeForIO.value (output)) {
if (inactiveNodes.contains (node)) {
enabled = false;
}
if (passiveNodes.contains (node)) {
reversed = true;
}
}
}
if (AnalogInput * input = qobject_cast<AnalogInput *> (link->get_source ())) {
if (Node * node = nodeForIO.value (input)) {
if (inactiveNodes.contains (node)) {
enabled = false;
}
if (passiveNodes.contains (node)) {
reversed = true;
}
}
}
link->update_enabled (enabled);
link->update_reversed (reversed);
}
for (LinkDigitalOutputToDigitalInput * link : arrayRange (m_linksDigitalOutputToDigitalInput)) {
link->update_enabled (true); // TODO : handle disabled node at one/both of the ends
link->update_reversed (false); // TODO : handle passive node at one/both of the ends
bool enabled = true;
bool reversed = false;
if (DigitalOutput * output = qobject_cast<DigitalOutput *> (link->get_source ())) {
if (Node * node = nodeForIO.value (output)) {
if (inactiveNodes.contains (node)) {
enabled = false;
}
if (passiveNodes.contains (node)) {
reversed = true;
}
}
}
if (DigitalInput * input = qobject_cast<DigitalInput *> (link->get_source ())) {
if (Node * node = nodeForIO.value (input)) {
if (inactiveNodes.contains (node)) {
enabled = false;
}
if (passiveNodes.contains (node)) {
reversed = true;
}
}
}
link->update_enabled (enabled);
link->update_reversed (reversed);
}
/// clear old chains
qDeleteAll (analogSensorChains);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment