Commit 77aa0480 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Better handling of special output->input links in UI

parent 01eebb29
......@@ -661,7 +661,7 @@ static ObjectHelp routineOnCanOpenSdoReadReply {
};
static ObjectHelp abstractLink {
"AbstractLink", "BasicObject", { "LinkPhysicalValueToAnalogSensor", "LinkAnalogSensorToAnalogInput", "LinkDigitalSensorToDigitalInput", "LinkAnalogOutputToAnalogActuator", "LinkDigitalOutputToDigitalActuator", "LinkAnalogActuatorToPhysicalValue" }, { }, "abstract class",
"AbstractLink", "BasicObject", { "LinkPhysicalValueToAnalogSensor", "LinkAnalogSensorToAnalogInput", "LinkDigitalSensorToDigitalInput", "LinkAnalogOutputToAnalogActuator", "LinkDigitalOutputToDigitalActuator", "LinkAnalogActuatorToPhysicalValue", "LinkAnalogOutputToAnalogInput", "LinkDigitalOutputToDigitalInput" }, { }, "abstract class",
{
new PropertyHelp {
"valid", "bool", "readonly", false,
......@@ -806,6 +806,42 @@ static ObjectHelp linkAnalogActuatorToPhysicalValue {
"A link applying the speed induced by an analog sensor to a physical world value."
};
static ObjectHelp linkDigitalOutputToDigitalInput {
"LinkDigitalOutputToDigitalInput", "AbstractLink", { }, { }, "instantiable",
{
new PropertyHelp {
"output", "DigitalOutput", "readonly", false,
"Set by the link if the source object is a digital output."
},
new PropertyHelp {
"input", "DigitalInput", "readonly", false,
"Set by the link if the target object is a digital input."
},
},
{ },
{ },
{ },
"A link mapping a digital input state from a digital output state."
};
static ObjectHelp linkAnalogOutputToAnalogInput {
"LinkAnalogOutputToAnalogInput", "AbstractLink", { }, { }, "instantiable",
{
new PropertyHelp {
"output", "AnalogOutput", "readonly", false,
"Set by the link if the source object is an analog output."
},
new PropertyHelp {
"input", "AnalogInput", "readonly", false,
"Set by the link if the target object is an analog input."
},
},
{ },
{ },
{ },
"A link mapping an analog input value from an analog output level."
};
static ObjectHelp physicalValue {
"PhysicalValue", "BasicObject", { }, { }, "instantiable",
{
......@@ -2712,6 +2748,8 @@ void Help::initMap (void) {
registerHelp (linkAnalogOutputToAnalogActuator);
registerHelp (linkDigitalOutputToDigitalActuator);
registerHelp (linkAnalogActuatorToPhysicalValue);
registerHelp (linkAnalogOutputToAnalogInput);
registerHelp (linkDigitalOutputToDigitalInput);
registerHelp (physicalValue);
registerHelp (physicalPoint);
registerHelp (physicalSize);
......@@ -2811,6 +2849,8 @@ void Help::initIndex (void) {
new HelpPage { 2, "LinkAnalogOutputToAnalogActuator" },
new HelpPage { 2, "LinkDigitalOutputToDigitalActuator" },
new HelpPage { 2, "LinkAnalogActuatorToPhysicalValue" },
new HelpPage { 2, "LinkAnalogOutputToAnalogInput" },
new HelpPage { 2, "LinkDigitalOutputToDigitalInput" },
new HelpPage { 1, "AbstractTransformer" },
new HelpPage { 2, "AffineTransformer" },
new HelpPage { 2, "CustomTransformer" },
......
......@@ -1163,6 +1163,15 @@ void Manager::doBuildChains (void) {
chain->linkActuatorToValue->update_enabled (false);
}
}
/// 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
}
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
}
/// clear old chains
qDeleteAll (analogSensorChains);
qDeleteAll (digitalSensorChains);
......
......@@ -142,6 +142,8 @@ void SharedObject::registerQmlTypes (QQmlEngine * qmlEngine) {
qmlRegisterType<LinkDigitalOutputToDigitalActuator> (uri, maj, min, "LinkDigitalOutputToDigitalActuator");
qmlRegisterType<LinkDigitalSensorToDigitalInput> (uri, maj, min, "LinkDigitalSensorToDigitalInput");
qmlRegisterType<LinkPhysicalValueToAnalogSensor> (uri, maj, min, "LinkPhysicalValueToAnalogSensor");
qmlRegisterType<LinkAnalogOutputToAnalogInput> (uri, maj, min, "LinkAnalogOutputToAnalogInput");
qmlRegisterType<LinkDigitalOutputToDigitalInput> (uri, maj, min, "LinkDigitalOutputToDigitalInput");
qmlRegisterType<CanBus> (uri, maj, min, "CanBus");
qmlRegisterType<NetworkDefinition> (uri, maj, min, "NetworkDefinition");
qmlRegisterType<NodesList> (uri, maj, min, "NodesList");
......
......@@ -97,7 +97,7 @@ AbstractDialogDetailsIO {
TextLabel {
id: lblLinkedSensor;
text: qsTr ("Linked sensor :");
text: qsTr ("Linked to :");
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
......@@ -125,8 +125,15 @@ AbstractDialogDetailsIO {
clickable: (ain && ain.link && ain.link.source);
anchors.baseline: lblLinkedSensor.baseline;
onClicked: {
highlightSensor = null;
highlightSensor = ain.link.source;
if (ain.link.source.family === ObjectFamily.SENSOR) {
highlightSensor = null;
highlightSensor = ain.link.source;
}
else if (ain.link.source.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = ain.link.source;
}
else { }
}
}
}
......
......@@ -97,7 +97,7 @@ AbstractDialogDetailsIO {
TextLabel {
id: lblLinkedActuator;
text: qsTr ("Linked actuator :");
text: qsTr ("Linked to :");
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
......@@ -125,8 +125,15 @@ AbstractDialogDetailsIO {
clickable: (aout && aout.link && aout.link.target);
anchors.baseline: lblLinkedActuator.baseline;
onClicked: {
highlightActuator = null;
highlightActuator = aout.link.target;
if (aout.link.source.family === ObjectFamily.ACTUATOR) {
highlightActuator = null;
highlightActuator = aout.link.target;
}
else if (aout.link.source.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = aout.link.target;
}
else { }
}
}
}
......
......@@ -29,7 +29,7 @@ AbstractDialogDetailsIO {
TextLabel {
id: lblLinkedSensor;
text: qsTr ("Linked sensor :");
text: qsTr ("Linked to :");
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
......@@ -57,8 +57,15 @@ AbstractDialogDetailsIO {
clickable: (din && din.link && din.link.source);
anchors.baseline: lblLinkedSensor.baseline;
onClicked: {
highlightSensor = null;
highlightSensor = din.link.source;
if (din.link.source.family === ObjectFamily.SENSOR) {
highlightSensor = null;
highlightSensor = din.link.source;
}
else if (din.link.source.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = din.link.source;
}
else { }
}
}
}
......
......@@ -29,7 +29,7 @@ AbstractDialogDetailsIO {
TextLabel {
id: lblLinkedActuator;
text: qsTr ("Linked actuator :");
text: qsTr ("Linked to :");
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
......@@ -57,8 +57,15 @@ AbstractDialogDetailsIO {
clickable: (dout && dout.link && dout.link.target);
anchors.baseline: lblLinkedActuator.baseline;
onClicked: {
highlightActuator = null;
highlightActuator = dout.link.target;
if (dout.link.source.family === ObjectFamily.ACTUATOR) {
highlightActuator = null;
highlightActuator = dout.link.target;
}
else if (dout.link.source.family === ObjectFamily.IO) {
highlightIO = null;
highlightIO = dout.link.target;
}
else { }
}
}
}
......
......@@ -4,7 +4,7 @@ import QtCAN.CanTestBench 2.0;
NetworkDefinition {
uid: "TEST";
title: "Test network definition 1 (robotic arm)";
dumpObjectsOnInit: false;
dumpObjectsOnInit: true;
benchmarkSimulatorTick: false;
benchmarkCanFramesTiming: false;
canBusList: [
......@@ -337,14 +337,19 @@ NetworkDefinition {
uid: "EXT";
title: "Extension";
DigitalInput { uid: "DIN1"; }
DigitalInput { uid: "DIN1"; id: extDin1; }
DigitalInput { uid: "DIN2"; }
DigitalInput { uid: "DIN3"; }
DigitalInput { uid: "DIN4"; }
DigitalOutput { uid: "DOUT1"; }
DigitalInput { uid: "DIN4"; }
DigitalOutput { uid: "DOUT1"; id: extDout1; }
DigitalOutput { uid: "DOUT2"; }
DigitalOutput { uid: "DOUT3"; }
DigitalOutput { uid: "DOUT4"; }
LinkDigitalOutputToDigitalInput { // manual link
source: extDout1;
target: extDin1;
}
}
}
}
......
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