added sync option
authoretisserant
Tue, 11 Sep 2007 08:00:28 +0200
changeset 26 7bc11b005c8b
parent 25 fa7503684c28
child 27 1db681d34579
added sync option
plugins/canfestival/canfestival.py
plugins/canfestival/config_utils.py
--- a/plugins/canfestival/canfestival.py	Mon Sep 10 18:19:53 2007 +0200
+++ b/plugins/canfestival/canfestival.py	Tue Sep 11 08:00:28 2007 +0200
@@ -20,6 +20,7 @@
       <xsd:element name="CanFestivalNode">
         <xsd:complexType>
           <xsd:attribute name="CAN_Device" type="xsd:string" use="required" />
+          <xsd:attribute name="Sync_TPDOs" type="xsd:boolean" use="required" default="true"/>
         </xsd:complexType>
       </xsd:element>
     </xsd:schema>
@@ -76,7 +77,7 @@
         prefix = "_".join(map(lambda x:str(x), current_location))
         Gen_OD_path = os.path.join(buildpath, prefix + "_OD.c" )
         # Create a new copy of the model with DCF loaded with PDO mappings for desired location
-        master = config_utils.GenerateConciseDCF(locations, current_location, self)
+        master = config_utils.GenerateConciseDCF(locations, current_location, self, self.CanFestivalNode.getSync_TPDOs())
         res = gen_cfile.GenerateFile(Gen_OD_path, master)
         if res :
             raise Exception, res
--- a/plugins/canfestival/config_utils.py	Mon Sep 10 18:19:53 2007 +0200
+++ b/plugins/canfestival/config_utils.py	Tue Sep 11 08:00:28 2007 +0200
@@ -139,7 +139,7 @@
     return ListCobIDAvailable.pop(0)
         
         
-def GenerateConciseDCF(locations, current_location, nodelist):
+def GenerateConciseDCF(locations, current_location, nodelist, sync_TPDOs):
     """
     Fills a CanFestival network editor model, with DCF with requested PDO mappings.
     @param locations: List of complete variables locations \
@@ -402,9 +402,9 @@
                 
                 if mapvariableidx < 0x6000:
                     if DictLocations[variable[1]]["bit"] != None:
-                        subindexname = "_" + str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"]) + "_" + str(DictLocations[variable[1]]["bit"])
+                        subindexname = str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"]) + "_" + str(DictLocations[variable[1]]["bit"])
                     else:
-                        subindexname = "_" + str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"])
+                        subindexname = str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"])
                     if not new_index:
                         manager.AddSubentriesToCurrent(mapvariableidx, 1, masternode)
                         nbsubentries += 1