plugins/canfestival/config_utils.py
changeset 26 7bc11b005c8b
parent 24 585d5b387b6a
child 27 1db681d34579
equal deleted inserted replaced
25:fa7503684c28 26:7bc11b005c8b
   137             ListCobIDAvailable.remove(newcobid)
   137             ListCobIDAvailable.remove(newcobid)
   138             return newcobid
   138             return newcobid
   139     return ListCobIDAvailable.pop(0)
   139     return ListCobIDAvailable.pop(0)
   140         
   140         
   141         
   141         
   142 def GenerateConciseDCF(locations, current_location, nodelist):
   142 def GenerateConciseDCF(locations, current_location, nodelist, sync_TPDOs):
   143     """
   143     """
   144     Fills a CanFestival network editor model, with DCF with requested PDO mappings.
   144     Fills a CanFestival network editor model, with DCF with requested PDO mappings.
   145     @param locations: List of complete variables locations \
   145     @param locations: List of complete variables locations \
   146         [{"IEC_TYPE" : the IEC type (i.e. "INT", "STRING", ...)
   146         [{"IEC_TYPE" : the IEC type (i.e. "INT", "STRING", ...)
   147         "NAME" : name of the variable (generally "__IW0_1_2" style)
   147         "NAME" : name of the variable (generally "__IW0_1_2" style)
   400                             new_index = True
   400                             new_index = True
   401                         nbsubentries = masternode.GetEntry(mapvariableidx, 0x00)
   401                         nbsubentries = masternode.GetEntry(mapvariableidx, 0x00)
   402                 
   402                 
   403                 if mapvariableidx < 0x6000:
   403                 if mapvariableidx < 0x6000:
   404                     if DictLocations[variable[1]]["bit"] != None:
   404                     if DictLocations[variable[1]]["bit"] != None:
   405                         subindexname = "_" + str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"]) + "_" + str(DictLocations[variable[1]]["bit"])
   405                         subindexname = str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"]) + "_" + str(DictLocations[variable[1]]["bit"])
   406                     else:
   406                     else:
   407                         subindexname = "_" + str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"])
   407                         subindexname = str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"])
   408                     if not new_index:
   408                     if not new_index:
   409                         manager.AddSubentriesToCurrent(mapvariableidx, 1, masternode)
   409                         manager.AddSubentriesToCurrent(mapvariableidx, 1, masternode)
   410                         nbsubentries += 1
   410                         nbsubentries += 1
   411                     masternode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"name" : subindexname})
   411                     masternode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"name" : subindexname})
   412                     masternode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"type" : typeidx})
   412                     masternode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"type" : typeidx})