Fix disable dynamic PDOs support
authorLaurent Bessard
Mon, 11 Jun 2012 02:25:57 +0200
changeset 2064 810013fe8c1b
parent 2063 c9a1c5bb51cd
child 2065 71678bd14f43
Fix disable dynamic PDOs support
ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/coupler@EthercatSlave/confnode.xml
ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/higen@EthercatCIA402Slave/confnode.xml
ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/inputs@EthercatSlave/confnode.xml
ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/outputs@EthercatSlave/confnode.xml
ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/coupler@EthercatSlave/confnode.xml
ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/inputs@EthercatSlave/confnode.xml
ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/outputs@EthercatSlave/confnode.xml
ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/confnode.xml
etherlab/etherlab.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/coupler@EthercatSlave/confnode.xml	Mon Jun 11 02:25:57 2012 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SlaveParams/>
--- a/ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/higen@EthercatCIA402Slave/confnode.xml	Mon Jun 11 01:21:26 2012 +0200
+++ b/ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/higen@EthercatCIA402Slave/confnode.xml	Mon Jun 11 02:25:57 2012 +0200
@@ -1,2 +1,2 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<CIA402SlaveParams RatioNumerator="65536" RatioDenominator="360" PositionOffset="0"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<CIA402SlaveParams DynamicPDOs="false" RatioNumerator="65536" RatioDenominator="360" PositionOffset="0"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/inputs@EthercatSlave/confnode.xml	Mon Jun 11 02:25:57 2012 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SlaveParams/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ethercat_tests/wago_higen/ethercat@etherlab/master@EthercatNode/outputs@EthercatSlave/confnode.xml	Mon Jun 11 02:25:57 2012 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SlaveParams/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/coupler@EthercatSlave/confnode.xml	Mon Jun 11 02:25:57 2012 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SlaveParams/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/inputs@EthercatSlave/confnode.xml	Mon Jun 11 02:25:57 2012 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SlaveParams/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/outputs@EthercatSlave/confnode.xml	Mon Jun 11 02:25:57 2012 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SlaveParams/>
--- a/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/confnode.xml	Mon Jun 11 01:21:26 2012 +0200
+++ b/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/confnode.xml	Mon Jun 11 02:25:57 2012 +0200
@@ -1,2 +1,2 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<CIA402SlaveParams RatioNumerator="65536" RatioDenominator="180" PositionOffset="0"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<CIA402SlaveParams DynamicPDOs="false" RatioNumerator="65536" RatioDenominator="180" PositionOffset="0"/>
--- a/etherlab/etherlab.py	Mon Jun 11 01:21:26 2012 +0200
+++ b/etherlab/etherlab.py	Mon Jun 11 02:25:57 2012 +0200
@@ -287,7 +287,7 @@
             
             params = self.CTNParams[1].getElementInfos(self.CTNParams[0])
             for param in params["children"]:
-                if param["value"] is not None:
+                if param["value"] is not None and param["name"] != "DynamicPDOs":
                     param_infos = {
                         "location": location_str,
                         "param_name": param["name"],
@@ -655,8 +655,13 @@
         slaves = self.GetSlaves()
         for slave_pos in slaves:
             slave = self.GetSlave(slave_pos)
+            slave_node = self.GetChildByIECLocation([slave_pos])
+            if slave_node.CTNParams is not None:
+                slave_infos = slave_node.CTNParams[1]
+            else:
+                slave_infos = None
             if slave is not None:
-                self.FileGenerator.DeclareSlave(slave_pos, slave.getInfo().getAutoIncAddr(), slave.getType())
+                self.FileGenerator.DeclareSlave(slave_pos, slave.getInfo().getAutoIncAddr(), slave.getType(), slave_infos)
         
         for location in locations:
             loc = location["LOC"][len(current_location):]
@@ -817,8 +822,8 @@
     def __del__(self):
         self.Controler = None            
 
-    def DeclareSlave(self, slave_index, slave_alias, slave):
-        self.Slaves.append((slave_index, slave_alias, slave))
+    def DeclareSlave(self, slave_index, slave_alias, slave, slave_infos):
+        self.Slaves.append((slave_index, slave_alias, slave, slave_infos))
 
     def DeclareVariable(self, slave_index, index, subindex, iec_type, dir, name):
         slave_variables = self.UsedVariables.setdefault(slave_index, {})
@@ -860,7 +865,7 @@
         
         self.Slaves.sort()
         alias = {}
-        for (slave_idx, slave_alias, type_infos) in self.Slaves:
+        for (slave_idx, slave_alias, type_infos, slave_infos) in self.Slaves:
             if alias.get(slave_alias) is not None:
                 alias[slave_alias] += 1
             else:
@@ -1019,7 +1024,7 @@
                                      "entries_number": len(entries_infos),
                                      "fixed": pdo.getFixed() == True})
                     
-                    if etherlab_node_infos.getDynamicPDOs():
+                    if slave_infos is None or slave_infos.getDynamicPDOs():
                         dynamic_pdos = {}
                         dynamic_pdos_number = 0
                         for category, min_index, max_index in [("Inputs", 0x1600, 0x1800),