etherlab/EthercatMaster.py
changeset 2380 b35bce45bc5a
parent 2375 cfa68a06a24d
child 2381 1c40e3976cc2
equal deleted inserted replaced
2379:015b724c30a5 2380:b35bce45bc5a
   428             else:
   428             else:
   429                 var["ReadFrom"] = ""
   429                 var["ReadFrom"] = ""
   430             write_to = variable.getWriteTo()
   430             write_to = variable.getWriteTo()
   431             if write_to is not None:
   431             if write_to is not None:
   432                 var["WriteTo"] = (write_to.getPosition(),
   432                 var["WriteTo"] = (write_to.getPosition(),
   433                                    write_to.getIndex(),
   433                                   write_to.getIndex(),
   434                                    write_to.getSubIndex())
   434                                   write_to.getSubIndex())
   435             else:
   435             else:
   436                 var["WriteTo"] = ""
   436                 var["WriteTo"] = ""
   437             variables.append(var)
   437             variables.append(var)
   438             idx += 1
   438             idx += 1
   439         return variables
   439         return variables
   660                             if var_class == LOCATION_VAR_INPUT:
   660                             if var_class == LOCATION_VAR_INPUT:
   661                                 var_dir = "%I"
   661                                 var_dir = "%I"
   662                             else:
   662                             else:
   663                                 var_dir = "%Q"
   663                                 var_dir = "%Q"
   664 
   664 
   665                             vars.append({"name": "0x%4.4x-0x%2.2x: %s" % (index, subindex, entry["Name"]),
   665                             vars.append({
   666                                          "type": var_class,
   666                                 "name": "0x%4.4x-0x%2.2x: %s" % (index, subindex, entry["Name"]),
   667                                          "size": var_size,
   667                                 "type": var_class,
   668                                          "IEC_type": entry["Type"],
   668                                 "size": var_size,
   669                                          "var_name": "%s_%4.4x_%2.2x" % ("_".join(device_name.split()), index, subindex),
   669                                 "IEC_type": entry["Type"],
   670                                          "location": "%s%s%s" % (var_dir, var_size, ".".join(map(str, current_location +
   670                                 "var_name": "%s_%4.4x_%2.2x" % ("_".join(device_name.split()), index, subindex),
   671                                                                                                     (index, subindex)))),
   671                                 "location": "%s%s%s" % (var_dir, var_size, ".".join(map(str, current_location +
   672                                          "description": "",
   672                                                                                         (index, subindex)))),
   673                                          "children": []})
   673                                 "description": "",
       
   674                                 "children": [],
       
   675                             })
   674 
   676 
   675         return vars
   677         return vars
   676 
   678 
   677     def CTNTestModified(self):
   679     def CTNTestModified(self):
   678         return self.ChangesToSave or not self.ModelIsSaved()
   680         return self.ChangesToSave or not self.ModelIsSaved()