Skip to content

Commit

Permalink
110 xdd v1.0: exporting sets wrong type on highest sub index supported (
Browse files Browse the repository at this point in the history
#111)

* created test to catch & reproduce the bug
* bugfix
  • Loading branch information
nimrof authored Apr 27, 2024
1 parent 56b7f08 commit 652f671
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Tests/XDDImportExportTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public void TestImportExportArray()
if (od.subobjects[1].PDOtype != PDOMappingType.optional)
throw new Exception("TPDOMappingType.optional not set in EDS for ARRAY");

Assert.True(od.subobjects[0].datatype == DataType.UNSIGNED8, "array subindex 0 datatype is changed");


}
Expand Down
2 changes: 1 addition & 1 deletion libEDSsharp/CanOpenXDD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public ISO15745ProfileContainer convert(EDSsharp eds)

AppLayer.CANopenObjectList.CANopenObject[count].CANopenSubObject[subcount].edseditor_extension_notifyonchange = subod.prop.CO_flagsPDO;

if (od.objecttype == ObjectType.ARRAY)
if (od.objecttype == ObjectType.ARRAY && count != 0)
bytes = BitConverter.GetBytes((UInt16)od.datatype);
else
bytes = BitConverter.GetBytes((UInt16)subod.datatype);
Expand Down

0 comments on commit 652f671

Please sign in to comment.