--- a/etherlab/EthercatCFileGenerator.py Fri Apr 26 23:23:09 2013 +0200
+++ b/etherlab/EthercatCFileGenerator.py Mon Apr 29 11:03:06 2013 +0200
@@ -322,6 +322,11 @@
if slave_variables.get((index, subindex), None) is not None:
pdo_mapping_match["matching"] += 1
+ if pdo.getFixed() == True:
+ pdo_mapping_match["matching"] += \
+ module_extra_params["max_pdo_size"] - \
+ pdo_mapping_match["count"]
+
elif pdo.getMandatory():
selected_pdos.append(pdo_index)
@@ -332,7 +337,9 @@
if exclusion_scope[0]["matching"] > 0:
selected_pdos.append(exclusion_scope[0]["index"])
start_excluding_index = 1
- excluded_pdos.extend([pdo["index"] for pdo in exclusion_scope[start_excluding_index:] if PdoAssign or not pdo["assigned"]])
+ excluded_pdos.extend([pdo["index"]
+ for pdo in exclusion_scope[start_excluding_index:]
+ if PdoAssign or not pdo["assigned"]])
for pdo, pdo_type in ([(pdo, "Inputs") for pdo in device.getTxPdo()] +
[(pdo, "Outputs") for pdo in device.getRxPdo()]):
@@ -475,7 +482,7 @@
if len(dynamic_pdos[pdo_type]["pdos"]) > 0:
pdo = dynamic_pdos[pdo_type]["pdos"][0]
- else:
+ elif module_extra_params["add_pdo"]:
while dynamic_pdos[pdo_type]["current_index"] in pdos_index:
dynamic_pdos[pdo_type]["current_index"] += 1
if dynamic_pdos[pdo_type]["current_index"] >= dynamic_pdos[pdo_type]["max_index"]:
@@ -493,6 +500,8 @@
dynamic_pdos[pdo_type]["sync_manager"]["pdos_number"] += 1
dynamic_pdos[pdo_type]["sync_manager"]["pdos"].append(pdo)
dynamic_pdos[pdo_type]["pdos"].append(pdo)
+ else:
+ break
pdo["entries"].append(" {0x%(index).4x, 0x%(subindex).2x, %(bitlen)d}, /* %(name)s */" % entry_infos)
if entry_infos["bitlen"] < module_extra_params["pdo_alignment"]:
@@ -500,7 +509,7 @@
module_extra_params["pdo_alignment"] - entry_infos["bitlen"]))
pdo["entries_number"] += 1
- if pdo["entries_number"] == 255:
+ if pdo["entries_number"] == module_extra_params["max_pdo_size"]:
dynamic_pdos[pdo_type]["pdos"].pop(0)
pdo_offset = 0