canfestival/canfestival.py
changeset 1765 ccf59c1f0b45
parent 1751 c28db6f7616b
child 1767 c74815729afd
equal deleted inserted replaced
1764:d5df428640ff 1765:ccf59c1f0b45
   229         slave.SetNodeName("OD_%s" % prefix)
   229         slave.SetNodeName("OD_%s" % prefix)
   230         # allow access to local OD from Slave PLC
   230         # allow access to local OD from Slave PLC
   231         pointers = config_utils.LocalODPointers(locations, current_location, slave)
   231         pointers = config_utils.LocalODPointers(locations, current_location, slave)
   232         res = gen_cfile.GenerateFile(Gen_OD_path, slave, pointers)
   232         res = gen_cfile.GenerateFile(Gen_OD_path, slave, pointers)
   233         if res:
   233         if res:
   234             raise Exception, res
   234             raise Exception(res)
   235         res = eds_utils.GenerateEDSFile(os.path.join(buildpath, "Slave_%s.eds" % prefix), slave)
   235         res = eds_utils.GenerateEDSFile(os.path.join(buildpath, "Slave_%s.eds" % prefix), slave)
   236         if res:
   236         if res:
   237             raise Exception, res
   237             raise Exception(res)
   238         return [(Gen_OD_path, local_canfestival_config.getCFLAGS(CanFestivalPath))], "", False
   238         return [(Gen_OD_path, local_canfestival_config.getCFLAGS(CanFestivalPath))], "", False
   239 
   239 
   240     def LoadPrevious(self):
   240     def LoadPrevious(self):
   241         self.LoadCurrentPrevious()
   241         self.LoadCurrentPrevious()
   242 
   242 
   446         Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix)
   446         Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix)
   447         # Create a new copy of the model with DCF loaded with PDO mappings for desired location
   447         # Create a new copy of the model with DCF loaded with PDO mappings for desired location
   448         try:
   448         try:
   449             master, pointers = config_utils.GenerateConciseDCF(locations, current_location, self, self.CanFestivalNode.getSync_TPDOs(), "OD_%s" % prefix)
   449             master, pointers = config_utils.GenerateConciseDCF(locations, current_location, self, self.CanFestivalNode.getSync_TPDOs(), "OD_%s" % prefix)
   450         except config_utils.PDOmappingException, e:
   450         except config_utils.PDOmappingException, e:
   451             raise Exception, e.message
   451             raise Exception(e.message)
   452         # Do generate C file.
   452         # Do generate C file.
   453         res = gen_cfile.GenerateFile(Gen_OD_path, master, pointers)
   453         res = gen_cfile.GenerateFile(Gen_OD_path, master, pointers)
   454         if res:
   454         if res:
   455             raise Exception, res
   455             raise Exception(res)
   456 
   456 
   457         file = open(os.path.join(buildpath, "MasterGenerated.od"), "w")
   457         file = open(os.path.join(buildpath, "MasterGenerated.od"), "w")
   458         dump(master, file)
   458         dump(master, file)
   459         file.close()
   459         file.close()
   460 
   460