Skip to content

Commit acbdbcf

Browse files
TPDOdetectCOS should be saved with subobjects and enabled for REC objects. This is a CanOpenNode specific feature and only effects VAR, entire arrays or individual rec sub objects. As such it needs to be saved with all subobjects and only applied to individual entries for REC not array
1 parent 7d11a6d commit acbdbcf

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

‎EDSTest/DeviceODView.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,13 @@ public void validateanddisplaydata()
264264
comboBox_memory.Enabled = false;
265265
checkBox_COS.Enabled = false;
266266
checkBox_enabled.Enabled = false;
267-
checkBox_COS.Checked = od.parent.TPDODetectCos;
267+
268268
checkBox_enabled.Checked = !od.parent.Disabled;
269269

270270
if (od.parent.objecttype == ObjectType.ARRAY && od.subindex != 0)
271271
{
272272
textBox_defaultvalue.Enabled = true;
273+
checkBox_COS.Checked = od.parent.TPDODetectCos;
273274

274275
}
275276

‎EDSTest/Form1.Designer.cs‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎libEDSsharp/Bridge.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public Device convert(EDSsharp eds)
8888
sub.DefaultValue = subod.defaultvalue;
8989
sub.PDOmapping = subod.PDOtype.ToString();
9090
sub.SubIndex = String.Format("{0:x2}",subod.subindex);
91+
sub.TPDOdetectCOS = subod.TPDODetectCos.ToString().ToLower();
9192
coo.CANopenSubObject.Add(sub);
9293

9394
}
@@ -330,6 +331,17 @@ public EDSsharp convert(Device dev)
330331

331332
subentry.objecttype = ObjectType.VAR;
332333

334+
if(coosub.TPDOdetectCOS!=null)
335+
{
336+
subentry.TPDODetectCos = coosub.TPDOdetectCOS == "true";
337+
}
338+
else
339+
{
340+
if(coo.TPDOdetectCOS!=null)
341+
subentry.TPDODetectCos = coo.TPDOdetectCOS == "true";
342+
}
343+
344+
333345
entry.subobjects.Add(subentry.subindex,subentry);
334346

335347
}

‎libEDSsharp/CanOpenXML.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ public class CANopenSubObject {
175175
public string PDOmapping { get; set; }
176176
[XmlAttribute(AttributeName="defaultValue")]
177177
public string DefaultValue { get; set; }
178-
}
178+
[XmlAttribute(AttributeName = "TPDOdetectCOS")]
179+
public string TPDOdetectCOS { get; set; }
180+
}
179181

180182
[XmlRoot(ElementName="CANopenObjectList")]
181183
public class CANopenObjectList {

0 commit comments

Comments
 (0)