etherlab/EthercatCFileGenerator.py
changeset 2425 68e7da937162
parent 2407 5f2b1bb464a0
child 2437 105c20fdeb19
equal deleted inserted replaced
2424:dc5554f0c12c 2425:68e7da937162
   165             if name != entry_infos["infos"][2]:
   165             if name != entry_infos["infos"][2]:
   166                 if dir == "I":
   166                 if dir == "I":
   167                     entry_infos["infos"][4].append(name)
   167                     entry_infos["infos"][4].append(name)
   168                     return entry_infos["infos"][2]
   168                     return entry_infos["infos"][2]
   169                 else:
   169                 else:
   170                     msg = _("Output variables can't be defined with different locations (%s and %s)") \
   170                     msg = _("Output variables can't be defined with different locations ({a1} and {a2})").\
   171                           % (entry_infos["infos"][2], name)
   171                           format(a1=entry_infos["infos"][2], a2=name)
   172                     raise ValueError(msg)
   172                     raise ValueError(msg)
   173         else:
   173         else:
   174             raise ValueError(_("Definition conflict for location \"%s\"") % name)
   174             raise ValueError(_("Definition conflict for location \"%s\"") % name)
   175 
   175 
   176     def GenerateCFile(self, filepath, location_str, master_number):
   176     def GenerateCFile(self, filepath, location_str, master_number):
   465                     for (index, subindex), entry_declaration in slave_variables.iteritems():
   465                     for (index, subindex), entry_declaration in slave_variables.iteritems():
   466 
   466 
   467                         if not entry_declaration["mapped"]:
   467                         if not entry_declaration["mapped"]:
   468                             entry = device_entries.get((index, subindex), None)
   468                             entry = device_entries.get((index, subindex), None)
   469                             if entry is None:
   469                             if entry is None:
   470                                 msg = _("Unknown entry index 0x%4.4x, subindex 0x%2.2x for device %s") \
   470                                 msg = _("Unknown entry index 0x{a1:.4x}, subindex 0x{a2:.2x} for device {a3}").\
   471                                       % (index, subindex, type_infos["device_type"])
   471                                       format(a1=index, a2=subindex, a3=type_infos["device_type"])
   472                                 raise ValueError(msg)
   472                                 raise ValueError(msg)
   473 
   473 
   474                             entry_infos = {
   474                             entry_infos = {
   475                                 "index": index,
   475                                 "index": index,
   476                                 "subindex": subindex,
   476                                 "subindex": subindex,
   564 
   564 
   565                 str_completion["pdos_configuration_declaration"] += SLAVE_PDOS_CONFIGURATION_DECLARATION % pdos_infos
   565                 str_completion["pdos_configuration_declaration"] += SLAVE_PDOS_CONFIGURATION_DECLARATION % pdos_infos
   566 
   566 
   567             for (index, subindex), entry_declaration in slave_variables.iteritems():
   567             for (index, subindex), entry_declaration in slave_variables.iteritems():
   568                 if not entry_declaration["mapped"]:
   568                 if not entry_declaration["mapped"]:
   569                     message = _("Entry index 0x%4.4x, subindex 0x%2.2x not mapped for device %s") % \
   569                     message = _("Entry index 0x{a1:.4x}, subindex 0x{a2:.2x} not mapped for device {a3}").\
   570                                     (index, subindex, type_infos["device_type"])
   570                               format(a1=index, a2=subindex, a3=type_infos["device_type"])
   571                     self.Controler.GetCTRoot().logger.write_warning(_("Warning: ") + message + "\n")
   571                     self.Controler.GetCTRoot().logger.write_warning(_("Warning: ") + message + "\n")
   572 
   572 
   573         for element in ["used_pdo_entry_offset_variables_declaration",
   573         for element in ["used_pdo_entry_offset_variables_declaration",
   574                         "used_pdo_entry_configuration",
   574                         "used_pdo_entry_configuration",
   575                         "located_variables_declaration",
   575                         "located_variables_declaration",