Skip to content

Commit 5be27ef

Browse files
committed
Increment number in object name when adding new objects
1 parent b4aaa21 commit 5be27ef

File tree

11 files changed

+7139
-13
lines changed

11 files changed

+7139
-13
lines changed

EDSEditorGUI/DeviceInfoView.Designer.cs

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

EDSEditorGUI/DeviceInfoView.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
2323
using System.IO;
2424
using System.Runtime.CompilerServices;
2525
using System.Drawing;
26+
using System.Linq;
2627

2728
namespace ODEditor
2829
{
@@ -44,6 +45,7 @@ public void populatedeviceinfo()
4445
textBox_productnumber.Text = eds.di.ProductNumber;
4546
textBox_vendorname.Text = eds.di.VendorName;
4647
textBox_vendornumber.Text = eds.di.VendorNumber;
48+
textBox_revisionnumber.Text = eds.di.RevisionNumber;
4749

4850
textBox_fileversion.Text = eds.fi.FileVersion;
4951
textBox_di_description.Text = eds.fi.Description;
@@ -140,6 +142,7 @@ private void update_devfile_info()
140142
eds.di.ProductNumber = textBox_productnumber.Text;
141143
eds.di.VendorName = textBox_vendorname.Text;
142144
eds.di.VendorNumber = textBox_vendornumber.Text;
145+
eds.di.RevisionNumber = textBox_revisionnumber.Text;
143146

144147
eds.fi.FileVersion = textBox_fileversion.Text;
145148
eds.fi.Description = textBox_di_description.Text;

EDSEditorGUI/DeviceODView.Designer.cs

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

EDSEditorGUI/DeviceODView.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ public void PopulateObjectLists(EDSsharp eds_target)
220220
});
221221

222222
lvi.Tag = od;
223+
if ((index == 0x100C) || (index == 0x100D))
224+
{
225+
od.prop.CO_disabled = !eds.di.NG_Slave;
226+
}
223227
if (selectedObject != null && index == selectedObject.Index)
224228
lvi.Selected = true;
225229
if (od.prop.CO_disabled == true)

libEDSsharp/CanOpenNodeExporter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ This file was automatically generated by CANopenEditor {0}
475475
file.WriteLine(string.Format(" VendorNumber: {0}", eds.di.VendorNumber));
476476
file.WriteLine(string.Format(" ProductName: {0}", eds.di.ProductName));
477477
file.WriteLine(string.Format(" ProductNumber: {0}", eds.di.ProductNumber));
478+
file.WriteLine(string.Format(" RevisionNumber: {0}", eds.di.RevisionNumber));
479+
// file.WriteLine(string.Format(" OrderCode: {0}", eds.di.)); FixMe: Missing OrderCode
478480
file.WriteLine("*******************************************************************************/");
479481
file.WriteLine("");
480482
}

libEDSsharp/CanOpenNodeExporter_V4.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ private void Prepare(EDSsharp eds)
168168

169169
// Verify objects, if they have set correct "CO_countLabel", according to Object Dictionary Requirements By CANopenNode V4.
170170
// https://github.com/CANopenNode/CANopenNode/blob/master/doc/objectDictionary.md
171+
171172
VerifyCountLabel(od, 0x1000, 0x1000, "NMT");
172173
VerifyCountLabel(od, 0x1001, 0x1001, "EM");
173174
VerifyCountLabel(od, 0x1005, 0x1005, "SYNC");
@@ -198,7 +199,10 @@ private void VerifyCountLabel(ODentry od, ushort indexL, ushort indexH, string c
198199
{
199200
if (od.Index >= indexL && od.Index <= indexH && od.prop.CO_countLabel != countLabel)
200201
{
201-
Warnings.AddWarning($"Error in 0x{od.Index:X4}: 'Count Label' must be '{countLabel}'", Warnings.warning_class.WARNING_BUILD);
202+
Warnings.AddWarning($"Error in 0x{od.Index:X4}: missing 'Count Label' '{countLabel}', was added", Warnings.warning_class.WARNING_BUILD);
203+
od.prop.CO_countLabel = countLabel;
204+
205+
// ToDo Add "dirty" to indicate unsaved changes
202206
}
203207
}
204208

@@ -448,7 +452,7 @@ This file was automatically generated by CANopenEditor {0}
448452
gitVersion, odname,
449453
Path.GetFileName(eds.projectFilename), eds.fi.FileVersion,
450454
eds.fi.CreationDateTime, eds.fi.CreatedBy, eds.fi.ModificationDateTime, eds.fi.ModifiedBy,
451-
eds.di.VendorName, eds.di.VendorNumber, eds.di.ProductName, eds.di.ProductNumber,
455+
eds.di.VendorName, eds.di.VendorNumber, eds.di.ProductName, eds.di.ProductNumber, eds.di.RevisionNumber,
452456
eds.fi.Description));
453457

454458
file.WriteLine(string.Format(@"
@@ -625,7 +629,7 @@ This file was automatically generated by CANopenEditor {0}
625629
gitVersion, odname,
626630
Path.GetFileName(eds.projectFilename), eds.fi.FileVersion,
627631
eds.fi.CreationDateTime, eds.fi.CreatedBy, eds.fi.ModificationDateTime, eds.fi.ModifiedBy,
628-
eds.di.VendorName, eds.di.VendorNumber, eds.di.ProductName, eds.di.ProductNumber,
632+
eds.di.VendorName, eds.di.VendorNumber, eds.di.ProductName, eds.di.ProductNumber, eds.di.RevisionNumber,
629633
eds.fi.Description));
630634

631635
file.WriteLine(string.Format(@"

libEDSsharp/CanOpenXDD.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ public ISO15745ProfileContainer convert(EDSsharp eds)
310310

311311
//device.DeviceIdentity.specificationRevision.value =
312312
device.DeviceIdentity.specificationRevision = new specificationRevision();
313+
device.DeviceIdentity.specificationRevision.Value = eds.di.RevisionNumber;
313314
device.DeviceIdentity.specificationRevision.readOnly = true;
314315

315316
device.DeviceIdentity.instanceName = new instanceName();
@@ -1160,6 +1161,7 @@ public EDSsharp convert(ISO15745ProfileContainer container)
11601161
eds.di.ProductNumber = obj.DeviceIdentity.productID.Value;
11611162
eds.di.VendorName = obj.DeviceIdentity.vendorName.Value;
11621163
eds.di.VendorNumber = obj.DeviceIdentity.vendorID.Value;
1164+
eds.di.RevisionNumber = obj.DeviceIdentity.specificationRevision.Value;
11631165

11641166
foreach (object o in obj.DeviceIdentity.productText.Items)
11651167
{

libEDSsharp/CanOpenXDD_1_1.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev
962962
body_device.DeviceIdentity = new DeviceIdentity();
963963
body_device.DeviceIdentity.vendorName = new vendorName { Value = eds.di.VendorName };
964964
body_device.DeviceIdentity.vendorID = new vendorID { Value = eds.di.VendorNumber };
965+
body_device.DeviceIdentity.specificationRevision = new specificationRevision { Value = eds.di.RevisionNumber };
965966
body_device.DeviceIdentity.productName = new productName { Value = eds.di.ProductName };
966967
body_device.DeviceIdentity.productID = new productID { Value = eds.di.ProductNumber };
967968
if (eds.fi.Description != null && eds.fi.Description != "")
@@ -1264,6 +1265,8 @@ private EDSsharp Convert(ISO15745ProfileContainer container)
12641265
eds.di.VendorName = body_device.DeviceIdentity.vendorName.Value ?? "";
12651266
if (body_device.DeviceIdentity.vendorID != null)
12661267
eds.di.VendorNumber = body_device.DeviceIdentity.vendorID.Value ?? "";
1268+
if (body_device.DeviceIdentity.specificationRevision != null)
1269+
eds.di.RevisionNumber = body_device.DeviceIdentity.specificationRevision.Value ?? "";
12671270
if (body_device.DeviceIdentity.productName != null)
12681271
eds.di.ProductName = body_device.DeviceIdentity.productName.Value ?? "";
12691272
if (body_device.DeviceIdentity.productID != null)

libEDSsharp/DocumentationGenMarkup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Device Information
104104
| LSS Master | {8,-30} |
105105
| NG Slave | {9,-30} |
106106
| NG Master | {10,-30} |
107-
", eds.di.VendorName, eds.di.VendorNumber, eds.di.ProductName, eds.di.ProductNumber,
107+
", eds.di.VendorName, eds.di.VendorNumber, eds.di.ProductName, eds.di.ProductNumber, eds.di.RevisionNumber,
108108
eds.di.Granularity, eds.di.NrOfRXPDO.ToString(), eds.di.NrOfTXPDO.ToString(),
109109
eds.di.LSS_Supported, eds.di.LSS_Master, eds.di.NG_Slave, eds.di.NG_Master));
110110

0 commit comments

Comments
 (0)