etherlab/EthercatCFileGenerator.py
changeset 2379 015b724c30a5
parent 2378 7aa47c09f8f5
child 2381 1c40e3976cc2
equal deleted inserted replaced
2378:7aa47c09f8f5 2379:015b724c30a5
   394                             entry_declaration["mapped"] = True
   394                             entry_declaration["mapped"] = True
   395 
   395 
   396                             entry_type = entry.getDataType().getcontent()
   396                             entry_type = entry.getDataType().getcontent()
   397                             if entry_infos["var_type"] != entry_type:
   397                             if entry_infos["var_type"] != entry_type:
   398                                 message = _("Wrong type for location \"%s\"!") % entry_infos["var_name"]
   398                                 message = _("Wrong type for location \"%s\"!") % entry_infos["var_name"]
   399                                 if (self.Controler.GetSizeOfType(entry_infos["var_type"]) !=
   399                                 if self.Controler.GetSizeOfType(entry_infos["var_type"]) != \
   400                                     self.Controler.GetSizeOfType(entry_type)):
   400                                    self.Controler.GetSizeOfType(entry_type):
   401                                     raise ValueError(message)
   401                                     raise ValueError(message)
   402                                 else:
   402                                 else:
   403                                     self.Controler.GetCTRoot().logger.write_warning(_("Warning: ") + message + "\n")
   403                                     self.Controler.GetCTRoot().logger.write_warning(_("Warning: ") + message + "\n")
   404 
   404 
   405                             if (entry_infos["dir"] == "I" and pdo_type != "Inputs" or
   405                             if (entry_infos["dir"] == "I" and pdo_type != "Inputs") or \
   406                                 entry_infos["dir"] == "Q" and pdo_type != "Outputs"):
   406                                (entry_infos["dir"] == "Q" and pdo_type != "Outputs"):
   407                                 raise ValueError(_("Wrong direction for location \"%s\"!") % entry_infos["var_name"])
   407                                 raise ValueError(_("Wrong direction for location \"%s\"!") % entry_infos["var_name"])
   408 
   408 
   409                             ConfigureVariable(entry_infos, str_completion)
   409                             ConfigureVariable(entry_infos, str_completion)
   410 
   410 
   411                         elif pdo_type == "Outputs" and entry.getDataType() is not None and device_coe is not None:
   411                         elif pdo_type == "Outputs" and entry.getDataType() is not None and device_coe is not None:
   481                                                         entry_declaration["infos"])))
   481                                                         entry_declaration["infos"])))
   482                             entry_declaration["mapped"] = True
   482                             entry_declaration["mapped"] = True
   483 
   483 
   484                             if entry_infos["var_type"] != entry["Type"]:
   484                             if entry_infos["var_type"] != entry["Type"]:
   485                                 message = _("Wrong type for location \"%s\"!") % entry_infos["var_name"]
   485                                 message = _("Wrong type for location \"%s\"!") % entry_infos["var_name"]
   486                                 if (self.Controler.GetSizeOfType(entry_infos["var_type"]) !=
   486                                 if self.Controler.GetSizeOfType(entry_infos["var_type"]) != \
   487                                     self.Controler.GetSizeOfType(entry["Type"])):
   487                                    self.Controler.GetSizeOfType(entry["Type"]):
   488                                     raise ValueError(message)
   488                                     raise ValueError(message)
   489                                 else:
   489                                 else:
   490                                     self.Controler.GetCTRoot().logger.write_warning(message + "\n")
   490                                     self.Controler.GetCTRoot().logger.write_warning(message + "\n")
   491 
   491 
   492                             if entry_infos["dir"] == "I" and entry["PDOMapping"] in ["T", "RT"]:
   492                             if entry_infos["dir"] == "I" and entry["PDOMapping"] in ["T", "RT"]: