--- a/etherlab/etherlab.py Wed May 23 16:30:41 2012 +0200
+++ b/etherlab/etherlab.py Sun Jun 10 20:16:17 2012 +0200
@@ -159,7 +159,7 @@
("ControlWord", 0x6040, 0x00, "UINT", "Q"),
("TargetPosition", 0x607a, 0x00, "DINT", "Q"),
-# ("ModesOfOperation", 0x06060, 0x00, "SINT", "Q"),
+ ("ModesOfOperation", 0x06060, 0x00, "SINT", "Q"), ("StatusWord", 0x6041, 0x00, "UINT", "I"),
("ModesOfOperationDisplay", 0x06061, 0x00, "SINT", "I"),
("ActualPosition", 0x6064, 0x00, "DINT", "I"),
@@ -179,9 +179,36 @@
EditorType = CIA402NodeEditor
+ {"bitmap" : "CIA402AxisRef", + "name" : _("Axis Ref"), + "tooltip" : _("Initiate Drag'n drop of Axis ref located variable"), + "method" : "_getCIA402AxisRef"}, return os.path.join(CONFNODEFOLDER, "images", "CIA402Slave.png")
+ def GetDeviceLocationTree(self, slave_pos, current_location, device_name): + axis_name = self.CTNName() + vars = [{"name": "%s Axis Ref" % (axis_name), + "type": LOCATION_VAR_INPUT, + "IEC_type": "AXIS_REF", + "location": "%IW%s.0" % (".".join(map(str, current_location))), + vars.extend(_EthercatSlaveCTN.GetDeviceLocationTree(self, slave_pos, current_location, device_name)) + def _getCIA402AxisRef(self): + data = wx.TextDataObject(str(("%IW%s.0" % ".".join(map(str, self.GetCurrentLocation())), + "location", "AXIS_REF", self.CTNName(), ""))) + dragSource = wx.DropSource(self.GetCTRoot().AppFrame) + dragSource.SetData(data) + dragSource.DoDragDrop() def CTNGenerate_C(self, buildpath, locations):
@@ -307,6 +334,7 @@
<xsd:attribute name="MasterNumber" type="xsd:integer" use="optional" default="0"/>
<xsd:attribute name="ConfigurePDOs" type="xsd:boolean" use="optional" default="true"/>
+ <xsd:attribute name="DynamicPDOs" type="xsd:boolean" use="optional" default="true"/> @@ -497,11 +525,10 @@
def GetDeviceLocationTree(self, slave_pos, current_location, device_name):
slave = self.GetSlave(slave_pos)
type_infos = slave.getType()
device = self.GetModuleInfos(type_infos)
@@ -965,85 +992,86 @@
"entries_number": len(entries_infos),
"fixed": pdo.getFixed() == True})
- dynamic_pdos_number = 0
- for category, min_index, max_index in [("Inputs", 0x1600, 0x1800),
- ("Outputs", 0x1a00, 0x1C00)]:
- for sync_manager in sync_managers:
- if sync_manager["name"] == category:
- category_infos = dynamic_pdos.setdefault(category, {})
- category_infos["sync_manager"] = sync_manager
- category_infos["pdos"] = [pdo for pdo in category_infos["sync_manager"]["pdos"]
- if not pdo["fixed"] and pdo["type"] == category]
- category_infos["current_index"] = min_index
- category_infos["max_index"] = max_index
- for (index, subindex), entry_declaration in slave_variables.iteritems():
+ if etherlab_node_infos.getDynamicPDOs(): + dynamic_pdos_number = 0 + for category, min_index, max_index in [("Inputs", 0x1600, 0x1800), + ("Outputs", 0x1a00, 0x1C00)]: + for sync_manager in sync_managers: + if sync_manager["name"] == category: + category_infos = dynamic_pdos.setdefault(category, {}) + category_infos["sync_manager"] = sync_manager + category_infos["pdos"] = [pdo for pdo in category_infos["sync_manager"]["pdos"] + if not pdo["fixed"] and pdo["type"] == category] + category_infos["current_index"] = min_index + category_infos["max_index"] = max_index - if not entry_declaration["mapped"]:
- entry = device_entries.get((index, subindex), None)
- raise ValueError, _("Unknown entry index 0x%4.4x, subindex 0x%2.2x for device %s") % \
- (index, subindex, type_infos["device_type"])
+ for (index, subindex), entry_declaration in slave_variables.iteritems():
- "bitlen": entry["BitSize"],
- entry_infos.update(type_infos)
- entry_infos.update(dict(zip(["var_type", "dir", "var_name", "real_var"], entry_declaration["infos"])))
- entry_declaration["mapped"] = True
- if entry_infos["var_type"] != entry["Type"]:
- message = _("Wrong type for location \"%s\"!") % entry_infos["var_name"]
- if (self.Controler.GetSizeOfType(entry_infos["var_type"]) !=
- self.Controler.GetSizeOfType(entry["Type"])):
- raise ValueError, message
+ if not entry_declaration["mapped"]: + entry = device_entries.get((index, subindex), None) + raise ValueError, _("Unknown entry index 0x%4.4x, subindex 0x%2.2x for device %s") % \ + (index, subindex, type_infos["device_type"]) + "bitlen": entry["BitSize"], + entry_infos.update(type_infos) + entry_infos.update(dict(zip(["var_type", "dir", "var_name", "real_var"], entry_declaration["infos"]))) + entry_declaration["mapped"] = True + if entry_infos["var_type"] != entry["Type"]: + message = _("Wrong type for location \"%s\"!") % entry_infos["var_name"] + if (self.Controler.GetSizeOfType(entry_infos["var_type"]) != + self.Controler.GetSizeOfType(entry["Type"])): + raise ValueError, message + self.Controler.GetCTRoot().logger.write_warning(message + "\n") + if entry_infos["dir"] == "I" and entry["PDOMapping"] in ["T", "RT"]: + elif entry_infos["dir"] == "Q" and entry["PDOMapping"] in ["R", "RT"]: - self.Controler.GetCTRoot().logger.write_warning(message + "\n")
- if entry_infos["dir"] == "I" and entry["PDOMapping"] in ["T", "RT"]:
- elif entry_infos["dir"] == "Q" and entry["PDOMapping"] in ["R", "RT"]:
- raise ValueError, _("Wrong direction for location \"%s\"!") % entry_infos["var_name"]
- if not dynamic_pdos.has_key(pdo_type):
- raise ValueError, _("No Sync manager defined for %s!") % pdo_type
- ConfigureVariable(entry_infos, str_completion)
- if len(dynamic_pdos[pdo_type]["pdos"]) > 0:
- pdo = dynamic_pdos[pdo_type]["pdos"][0]
- while dynamic_pdos[pdo_type]["current_index"] in pdos_index:
- dynamic_pdos[pdo_type]["current_index"] += 1
- if dynamic_pdos[pdo_type]["current_index"] >= dynamic_pdos[pdo_type]["max_index"]:
- raise ValueError, _("No more free PDO index available for %s!") % pdo_type
- pdos_index.append(dynamic_pdos[pdo_type]["current_index"])
+ raise ValueError, _("Wrong direction for location \"%s\"!") % entry_infos["var_name"] + if not dynamic_pdos.has_key(pdo_type): + raise ValueError, _("No Sync manager defined for %s!") % pdo_type + ConfigureVariable(entry_infos, str_completion) - dynamic_pdos_number += 1
- pdo = {"slave": slave_idx,
- "index": dynamic_pdos[pdo_type]["current_index"],
- "name": "Dynamic PDO %d" % dynamic_pdos_number,
- dynamic_pdos[pdo_type]["sync_manager"]["pdos_number"] += 1
- dynamic_pdos[pdo_type]["sync_manager"]["pdos"].append(pdo)
- dynamic_pdos[pdo_type]["pdos"].append(pdo)
- pdo["entries"].append(" {0x%(index).4x, 0x%(subindex).2x, %(bitlen)d}, /* %(name)s */" % entry_infos)
- pdo["entries_number"] += 1
- if pdo["entries_number"] == 255:
- dynamic_pdos[pdo_type]["pdos"].pop(0)
+ if len(dynamic_pdos[pdo_type]["pdos"]) > 0: + pdo = dynamic_pdos[pdo_type]["pdos"][0] + while dynamic_pdos[pdo_type]["current_index"] in pdos_index: + dynamic_pdos[pdo_type]["current_index"] += 1 + if dynamic_pdos[pdo_type]["current_index"] >= dynamic_pdos[pdo_type]["max_index"]: + raise ValueError, _("No more free PDO index available for %s!") % pdo_type + pdos_index.append(dynamic_pdos[pdo_type]["current_index"]) + dynamic_pdos_number += 1 + pdo = {"slave": slave_idx, + "index": dynamic_pdos[pdo_type]["current_index"], + "name": "Dynamic PDO %d" % dynamic_pdos_number, + dynamic_pdos[pdo_type]["sync_manager"]["pdos_number"] += 1 + dynamic_pdos[pdo_type]["sync_manager"]["pdos"].append(pdo) + dynamic_pdos[pdo_type]["pdos"].append(pdo) + pdo["entries"].append(" {0x%(index).4x, 0x%(subindex).2x, %(bitlen)d}, /* %(name)s */" % entry_infos) + pdo["entries_number"] += 1 + if pdo["entries_number"] == 255: + dynamic_pdos[pdo_type]["pdos"].pop(0) --- a/etherlab/images/icons.svg Wed May 23 16:30:41 2012 +0200
+++ b/etherlab/images/icons.svg Sun Jun 10 20:16:17 2012 +0200
@@ -43,9 +43,9 @@
- inkscape:zoom="5.6568542"
- inkscape:cx="366.34384"
- inkscape:cy="861.79751"
+ inkscape:cx="904.45004" + inkscape:cy="452.59174" inkscape:current-layer="svg2"
@@ -58872,6 +58872,305 @@
+ inkscape:collect="always" + xlink:href="#linearGradient15934-1-6" + id="linearGradient15515-4" + gradientUnits="userSpaceOnUse" + id="linearGradient15934-1-6"> + style="stop-color: rgb(77, 77, 77); stop-opacity: 1;" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + inkscape:collect="always" + xlink:href="#linearGradient15945-8-2" + id="linearGradient15517-6" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.996701,-0.0811618,0.0811618,0.996701,-17.9181,36.064)" + id="linearGradient15945-8-2"> + style="stop-color: rgb(179, 179, 179); stop-opacity: 1;" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + inkscape:collect="always" + xlink:href="#linearGradient15934-1-6" + id="linearGradient15519-9" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-6.2575321,5.050595)" + id="linearGradient13082"> + style="stop-color: rgb(77, 77, 77); stop-opacity: 1;" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + inkscape:collect="always" + xlink:href="#linearGradient15934-1-6" + id="linearGradient15521-8" + gradientUnits="userSpaceOnUse" + id="linearGradient13089"> + style="stop-color: rgb(77, 77, 77); stop-opacity: 1;" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + inkscape:collect="always" + xlink:href="#linearGradient15934-1-9-3" + id="linearGradient15523-5" + gradientUnits="userSpaceOnUse" + id="linearGradient15934-1-9-3"> + style="stop-color: rgb(77, 77, 77); stop-opacity: 1;" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + inkscape:collect="always" + xlink:href="#linearGradient15934-1-9-6-5" + id="linearGradient15525-5" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.31018135,0.06837356,-0.06837356,0.31018135,350.04365,90.753719)" + id="linearGradient15934-1-9-6-5"> + style="stop-color: rgb(77, 77, 77); stop-opacity: 1;" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + id="linearGradient3256-3-7"> + style="stop-color:#3d9cde;stop-opacity:1" + style="stop-color:#3d9cde;stop-opacity:0" + id="linearGradient5083-0-2"> + style="stop-color:#df6e6e;stop-opacity:1" + style="stop-color:#df6e6e;stop-opacity:1" + style="stop-color:#fbcaca;stop-opacity:1" + id="linearGradient2345-2-5"> + style="stop-color:#ffffff;stop-opacity:1.0000000;" + style="stop-color:#f0f0f0;stop-opacity:1.0000000;" + id="linearGradient1930-3-5"> + style="stop-color:#ff9870;stop-opacity:1" + style="stop-color:#ffd8c9;stop-opacity:1" + id="linearGradient2355-1-8"> + style="stop-color:#b18e4b;stop-opacity:1" + style="stop-color:#f7dca0;stop-opacity:1" + id="linearGradient3970-8-4"> + style="stop-color:#ffffff;stop-opacity:1" + style="stop-color:#ffffff;stop-opacity:0" + id="linearGradient2560-7-5"> + style="stop-color:#868686;stop-opacity:1" + style="stop-color:#e2e2e2;stop-opacity:1" + id="linearGradient13133"> + style="stop-color:#868686;stop-opacity:1" + style="stop-color:#e2e2e2;stop-opacity:1" + id="linearGradient1884-1-7"> + style="stop-color:#ffffff;stop-opacity:1" + style="stop-color:#ffffff;stop-opacity:0" + id="linearGradient13144"> + style="stop-color:#ffffff;stop-opacity:1" + style="stop-color:#ffffff;stop-opacity:0" + id="linearGradient13151"> + style="stop-color:#ffffff;stop-opacity:1" + style="stop-color:#ffffff;stop-opacity:0" + inkscape:collect="always" + xlink:href="#linearGradient1513-2" + id="linearGradient17570-2" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.08604141,0,0,0.08604141,553.37039,162.12298)" + id="linearGradient1513-2"> + style="stop-color:#ffffff;stop-opacity:1" + style="stop-color:#ffffff;stop-opacity:0" + inkscape:collect="always" + xlink:href="#linearGradient1513-2" + id="linearGradient13669" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.08604141,0,0,0.08604141,553.38144,142.10088)" + inkscape:collect="always" + xlink:href="#linearGradient1513-2" + id="linearGradient13680" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.08604141,0,0,0.08604141,553.38144,142.10088)" + inkscape:collect="always" + xlink:href="#linearGradient1513-2" + id="linearGradient13690" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.08604141,0,0,0.08604141,553.38144,142.10088)" style="font-size:40.12579727px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
@@ -58905,7 +59204,7 @@
- y="120.42097">%%ImportESI ScanNetwork editSlave editCIA402Slave %%</tspan></text>
+ y="120.42097">%%ImportESI ScanNetwork editSlave editCIA402Slave CIA402AxisRef %%</tspan></text> transform="translate(1268.5327,-372.731)"
@@ -60998,4 +61297,131 @@
transform="matrix(0.51386408,0,0,0.51386408,45.954134,148.43892)"
+ transform="translate(183.64271,0.1780684)" + inkscape:label="#rect16270" + style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + transform="matrix(1.8400527,0,0,1.8400527,-545.66816,-193.08435)"> + inkscape:label="Calque 1" + transform="matrix(-0.03037121,0,0,0.03037121,515.46377,170.91105)"> + transform="translate(-48,0)"> + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" + d="m 261.23647,217.28623 175.53201,57.07437 -3.125,208.62261 -170.15701,-72.94937 z" + style="fill:url(#linearGradient15515-4);fill-opacity:1;stroke:none" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" + d="M 257.63822,217.28208 452.87456,201.38389 632.56367,259.59396 436.54848,274.2032 z" + style="fill:url(#linearGradient15517-6);fill-opacity:1;stroke:none" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" + d="m 436.5,273.54968 195.5,-14.25 0.59315,205.70147 -198.84315,17.5 z" + style="fill:#333333;fill-opacity:1;stroke:none" /> + transform="matrix(0.98401111,0.21690648,-0.21690648,0.98401111,54.630578,-109.30701)" + style="color:#000000;fill:url(#linearGradient15519-9);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.72142136px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + d="m 494.71875,185.46875 c -0.35176,0 -0.69473,0.1022 -0.96875,0.28125 -0.10135,0.0662 -0.34443,0.21161 -0.42188,0.28906 l -0.0625,0.0625 c 0.34548,-0.16642 0.5872,-0.19531 0.82813,-0.19531 0.96372,0 1.75,0.78628 1.75,1.75 0,0.5778 -0.28613,1.08868 -0.71875,1.40625 l 0.5625,-0.40625 c 0.0312,-0.0211 0.0641,-0.0395 0.0937,-0.0625 0.41238,-0.31916 0.65625,-0.81319 0.65625,-1.375 0,-0.96372 -0.75503,-1.75 -1.71875,-1.75 z" + inkscape:connector-curvature="0" + sodipodi:nodetypes="scscsscccss" /> + style="color:#000000;fill:url(#linearGradient15521-8);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.72142136px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:cx="500.96298" + sodipodi:cy="182.15448" + sodipodi:rx="1.7449629" + sodipodi:ry="1.7449629" + d="m 502.70795,182.15448 c 0,0.96372 -0.78125,1.74496 -1.74497,1.74496 -0.96371,0 -1.74496,-0.78124 -1.74496,-1.74496 0,-0.96372 0.78125,-1.74496 1.74496,-1.74496 0.96372,0 1.74497,0.78124 1.74497,1.74496 z" + transform="translate(-6.874099,5.4992756)" /> + transform="translate(6.9375,1.125)" + transform="matrix(0.31018135,0.06837356,-0.06837356,0.31018135,347.67882,91.940035)" + d="m 502.70795,182.15448 c 0,0.96372 -0.78125,1.74496 -1.74497,1.74496 -0.96371,0 -1.74496,-0.78124 -1.74496,-1.74496 0,-0.96372 0.78125,-1.74496 1.74496,-1.74496 0.96372,0 1.74497,0.78124 1.74497,1.74496 z" + sodipodi:ry="1.7449629" + sodipodi:rx="1.7449629" + sodipodi:cy="182.15448" + sodipodi:cx="500.96298" + style="color:#000000;fill:url(#linearGradient15523-5);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.72142136px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + inkscape:connector-curvature="0" + style="color:#000000;fill:url(#linearGradient15525-5);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.72142136px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + d="m 492.875,180.96875 c -0.046,0.009 -0.0831,0.0119 -0.125,0.0312 l -0.0625,0.0312 -2.375,1.1875 c 0.11954,-0.0764 0.25679,-0.0954 0.40625,-0.0625 0.29893,0.0659 0.50339,0.35732 0.4375,0.65625 -0.033,0.14946 -0.13046,0.26739 -0.25,0.34375 0.77078,-0.3938 1.58077,-0.78916 2.34375,-1.15625 0.13759,-0.0738 0.24501,-0.21059 0.28125,-0.375 0.0659,-0.29893 -0.13857,-0.59036 -0.4375,-0.65625 -0.0747,-0.0165 -0.14796,-0.0131 -0.21875,0 z" + id="path14397-8-8-5-0" /> + transform="matrix(0.7406245,0,0,0.7406245,-33.973222,31.211141)"> + style="font-size:15.91540909px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#5d9d35;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans Mono" + transform="scale(0.9460798,1.0569933)" + sodipodi:linespacing="125%"><tspan + style="fill:#5d9d35;fill-opacity:1" + x="583.03015">R</tspan></text> + style="font-size:15.91540909px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#5d9d35;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans Mono" + transform="scale(0.9460798,1.0569933)" + sodipodi:linespacing="125%"><tspan + style="fill:#5d9d35;fill-opacity:1" + x="591.87451">E</tspan></text> + style="font-size:15.91540909px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#5d9d35;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans Mono" + transform="scale(0.9460798,1.0569933)" + sodipodi:linespacing="125%"><tspan + style="fill:#5d9d35;fill-opacity:1" + x="599.54919">F</tspan></text> + inkscape:connector-curvature="0" + d="m 552.6048,153.1029 0,3.625 c 0.69372,0.30918 1.41168,0.56749 2.15625,0.8125 l 0,-2.375 1,0 c 0.59618,2e-5 1.02713,0.14748 1.28125,0.40625 0.2541,0.25877 0.40624,0.68116 0.40625,1.28125 -10e-6,0.60015 -0.14726,1.01698 -0.40625,1.28125 -0.0194,0.0198 -0.041,0.0443 -0.0625,0.0625 0.72794,0.17475 1.48059,0.28192 2.21875,0.40625 0.31246,-0.4903 0.46875,-1.12023 0.46875,-1.90625 0,-1.2663 -0.29053,-2.18841 -0.90625,-2.75 -0.61087,-0.56157 -1.65508,-0.84373 -3.0625,-0.84375 l -3.09375,0 z m 8.59375,0 0,5.78125 c 1.19169,0.13165 2.37992,0.23393 3.5,0.25 0.98673,-0.0138 1.94165,-0.0818 2.875,-0.1875 l 0,-1.03125 -4.1875,0 0,-2.65625 4.625,0 0,-2.15625 -6.8125,0 z m 7.34375,0 0,5.71875 c 1.3859,-0.20593 2.73697,-0.50634 4.09375,-0.90625 l -1.9375,0 0,-2.65625 4.6875,0 0,-2.15625 -6.84375,0 z" + style="opacity:0.31627909;fill:url(#linearGradient13690);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:13;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />