Skip to content

Commit

Permalink
Fixes #43 When adding new subindex for arrays/recs might as well inhe…
Browse files Browse the repository at this point in the history
…rit the parents properties as a sensible default. In some cases this does nothing, in others it can be overridden, but having it set is the start of a plan to eliminate the UNKNOWN and other missing child properties, these should always be present.
  • Loading branch information
robincornelius committed Dec 19, 2016
1 parent e7bbfc3 commit 14f0695
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions EDSTest/DeviceODView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -819,13 +819,13 @@ private void addSubItemToolStripMenuItem_Click(object sender, EventArgs e)
{
ODentry od = (ODentry)selecteditemsub.Tag;

DataType dt = DataType.UNKNOWN;

if (od.parent.objecttype == ObjectType.ARRAY)
{
ODentry newsub = new ODentry();
newsub.parent = od.parent;
newsub.datatype = DataType.UNKNOWN;
newsub.datatype = od.parent.datatype;
newsub.accesstype = od.parent.accesstype;
newsub.PDOtype = od.parent.PDOtype;
newsub.index = od.index;
newsub.objecttype = ObjectType.VAR;
newsub.subindex = (UInt16)od.parent.subobjects.Count;
Expand All @@ -841,7 +841,7 @@ private void addSubItemToolStripMenuItem_Click(object sender, EventArgs e)

if (od.parent.objecttype == ObjectType.REC)
{
dt = od.datatype;
DataType dt = od.datatype;

NewIndex ni = new NewIndex(eds, dt, od.parent.objecttype, od.parent);

Expand All @@ -850,6 +850,8 @@ private void addSubItemToolStripMenuItem_Click(object sender, EventArgs e)
ODentry newsub = new ODentry();
newsub.parent = od.parent;
newsub.datatype = ni.dt;
newsub.accesstype = od.parent.accesstype;
newsub.PDOtype = od.parent.PDOtype;
newsub.index = od.index;
newsub.objecttype = ObjectType.VAR;
newsub.subindex = (UInt16)od.parent.subobjects.Count;
Expand Down

0 comments on commit 14f0695

Please sign in to comment.