362 subentry_infos = node.GetSubentryInfos(index, subindex) |
362 subentry_infos = node.GetSubentryInfos(index, subindex) |
363 |
363 |
364 # If a PDO mappable |
364 # If a PDO mappable |
365 if subentry_infos and subentry_infos["pdo"]: |
365 if subentry_infos and subentry_infos["pdo"]: |
366 if sizelocation == "X" and len(loc) > 3: |
366 if sizelocation == "X" and len(loc) > 3: |
367 numbit = loc[4] |
367 numbit = loc[3] |
368 elif sizelocation != "X" and len(loc) > 3: |
368 elif sizelocation != "X" and len(loc) > 3: |
369 raise ValueError, "Cannot set bit offset for non bool '%s' variable (ID:%d,Idx:%x,sIdx:%x))" % (name,nodeid,index,subindex) |
369 raise ValueError, "Cannot set bit offset for non bool '%s' variable (ID:%d,Idx:%x,sIdx:%x))" % (name,nodeid,index,subindex) |
370 else: |
370 else: |
371 numbit = None |
371 numbit = None |
372 |
372 |
373 entryinfos = node.GetSubentryInfos(index, subindex) |
373 entryinfos = node.GetSubentryInfos(index, subindex) |
374 if entryinfos["type"] != COlocationtype: |
374 if location["IEC_TYPE"] != "BOOL" and entryinfos["type"] != COlocationtype: |
375 raise ValueError, "Invalid type \"%s\"-> %d != %d for location\"%s\"" % (location["IEC_TYPE"], COlocationtype, entryinfos["type"] , name) |
375 raise ValueError, "Invalid type \"%s\"-> %d != %d for location\"%s\"" % (location["IEC_TYPE"], COlocationtype, entryinfos["type"] , name) |
376 |
376 |
377 typeinfos = node.GetEntryInfos(COlocationtype) |
377 typeinfos = node.GetEntryInfos(COlocationtype) |
378 self.IECLocations[name] = {"type":COlocationtype, "pdotype":SlavePDOType[direction], |
378 self.IECLocations[name] = {"type":COlocationtype, "pdotype":SlavePDOType[direction], |
379 "nodeid": nodeid, "index": index,"subindex": subindex, |
379 "nodeid": nodeid, "index": index,"subindex": subindex, |
429 #------------------------------------------------------------------------------- |
429 #------------------------------------------------------------------------------- |
430 # Build concise DCF for the others locations |
430 # Build concise DCF for the others locations |
431 #------------------------------------------------------------------------------- |
431 #------------------------------------------------------------------------------- |
432 |
432 |
433 for nodeid, locations in self.LocationsNotMapped.items(): |
433 for nodeid, locations in self.LocationsNotMapped.items(): |
434 node = nodelist.SlaveNodes[nodeid]["Node"] |
434 node = self.NodeList.SlaveNodes[nodeid]["Node"] |
435 |
435 |
436 # Initialize number of params and data to add to node DCF |
436 # Initialize number of params and data to add to node DCF |
437 nbparams = 0 |
437 nbparams = 0 |
438 dataparams = "" |
438 dataparams = "" |
439 |
439 |