Skip to content

Commit 1d5bbb7

Browse files
committed
edssharp: add another extension for the EDS file for CountLabel
The count label is required to compile against the CANopenNode v4 library since the definitions are checked by code like the following in CANopen.c #if OD_CNT_NMT != 1 #error OD_CNT_NMT from OD.h not correct! #endif This problem is exhibited when there is no xpd file that has the custom properties and there is only an EDS file available. The StorageLocation is an example of setting the custom property for the CO_storageGroup and this is adding a similar extension for the CO_countLabel. An example eds for NMT 0x1000 is shown below [1000] ParameterName=Device type ObjectType=0x7 ;CountLabel=NMT ;StorageLocation=ROM DataType=0x0007 AccessType=ro DefaultValue=0x00000000 PDOMapping=0 Signed-off-by: Charles Hardin <[email protected]>
1 parent ada7c1b commit 1d5bbb7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

libEDSsharp/CanOpenEDS.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ public void Write(StreamWriter writer, InfoSection.Filetype ft, Odtype odt = Odt
387387
}
388388

389389
writer.WriteLine(string.Format("ObjectType=0x{0:X}", (int)objecttype));
390+
writer.WriteLine(string.Format(";CountLabel={0}", prop.CO_countLabel));
390391
writer.WriteLine(string.Format(";StorageLocation={0}", prop.CO_storageGroup));
391392

392393
if (objecttype == ObjectType.ARRAY)
@@ -521,9 +522,9 @@ public void Parseline(string linex, int no)
521522
}
522523
}
523524
else
524-
//Only allow our own extensions to populate the key/value pair
525525
{
526-
if (key == "StorageLocation" || key == "TPDODetectCos")
526+
//Only allow our own extensions to populate the key/value pair
527+
if (key == "CountLabel" || key == "StorageLocation" || key == "TPDODetectCos")
527528
{
528529
try
529530
{
@@ -618,6 +619,12 @@ public void ParseEDSentry(KeyValuePair<string, Dictionary<string, string>> kvp)
618619
}
619620

620621
//Access Type
622+
623+
if (kvp.Value.ContainsKey("CountLabel"))
624+
{
625+
od.prop.CO_countLabel = kvp.Value["CountLabel"];
626+
}
627+
621628
if (kvp.Value.ContainsKey("StorageLocation"))
622629
{
623630
od.prop.CO_storageGroup = kvp.Value["StorageLocation"];

0 commit comments

Comments
 (0)