Skip to content

Commit 9f5048d

Browse files
committed
Merge branch 'bugfix' into feature
2 parents bb60e06 + ccff3f4 commit 9f5048d

File tree

10 files changed

+257
-217
lines changed

10 files changed

+257
-217
lines changed

EDSEditorGUI/DeviceInfoView.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ void AddOnChangeHandlerToInputControls(ControlCollection ctrl)
108108
{
109109
foreach (Control subctrl in ctrl)
110110
{
111-
if (subctrl is TextBox)
112-
((TextBox)subctrl).TextChanged +=
113-
new EventHandler(InputControls_OnChange);
114-
else if (subctrl is CheckBox)
111+
//if (subctrl is TextBox)
112+
// ((TextBox)subctrl).TextChanged +=
113+
// new EventHandler(InputControls_OnChange);
114+
//else
115+
if (subctrl is CheckBox)
115116
((CheckBox)subctrl).CheckedChanged +=
116117
new EventHandler(InputControls_OnChange);
117118
else

EDSEditorGUI/DeviceView.resx

Lines changed: 175 additions & 175 deletions
Large diffs are not rendered by default.

EDSEditorGUI/Form1.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,17 @@ private void newToolStripMenuItem_Click(object sender, EventArgs e)
658658

659659
network.Add(eds);
660660
}
661-
661+
private void TabControl1_Selected(Object sender, TabControlEventArgs e)
662+
{
663+
if(tabControl1.SelectedIndex == 0)
664+
{
665+
DeviceView dv = (DeviceView)tabControl1.SelectedTab.Controls[0];
666+
dv.dispatch_updateOD();
667+
dv.dispatch_updatePDOinfo();
668+
dv.eds.UpdatePDOcount();
669+
dv.dispatch_updatedevice();
670+
}
671+
}
662672
private void tabControl1_ControlsChanged(object sender, ControlEventArgs e)
663673
{
664674
enablesavemenus(tabControl1.TabCount > 0);

EDSEditorGUI/Properties/Settings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tests/Tests.csproj

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\xunit.runner.visualstudio.2.4.2\build\net452\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.4.2\build\net452\xunit.runner.visualstudio.props')" />
4-
<Import Project="..\packages\xunit.runner.console.2.4.1\build\xunit.runner.console.props" Condition="Exists('..\packages\xunit.runner.console.2.4.1\build\xunit.runner.console.props')" />
5-
<Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" />
3+
<Import Project="..\packages\xunit.runner.console.2.4.2\build\xunit.runner.console.props" Condition="Exists('..\packages\xunit.runner.console.2.4.2\build\xunit.runner.console.props')" />
4+
<Import Project="..\packages\xunit.runner.visualstudio.2.4.5\build\net462\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.4.5\build\net462\xunit.runner.visualstudio.props')" />
5+
<Import Project="..\packages\xunit.core.2.4.2\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.4.2\build\xunit.core.props')" />
66
<PropertyGroup>
77
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
88
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -45,14 +45,14 @@
4545
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
4646
<HintPath>..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll</HintPath>
4747
</Reference>
48-
<Reference Include="xunit.assert, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
49-
<HintPath>..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
48+
<Reference Include="xunit.assert, Version=2.4.2.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
49+
<HintPath>..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll</HintPath>
5050
</Reference>
51-
<Reference Include="xunit.core, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
52-
<HintPath>..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll</HintPath>
51+
<Reference Include="xunit.core, Version=2.4.2.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
52+
<HintPath>..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll</HintPath>
5353
</Reference>
54-
<Reference Include="xunit.execution.desktop, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
55-
<HintPath>..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll</HintPath>
54+
<Reference Include="xunit.execution.desktop, Version=2.4.2.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
55+
<HintPath>..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll</HintPath>
5656
</Reference>
5757
</ItemGroup>
5858
<Choose>
@@ -81,7 +81,8 @@
8181
<None Include="packages.config" />
8282
</ItemGroup>
8383
<ItemGroup>
84-
<Analyzer Include="..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
84+
<Analyzer Include="..\packages\xunit.analyzers.1.1.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
85+
<Analyzer Include="..\packages\xunit.analyzers.1.1.0\analyzers\dotnet\cs\xunit.analyzers.fixes.dll" />
8586
</ItemGroup>
8687
<Choose>
8788
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
@@ -107,12 +108,12 @@
107108
<PropertyGroup>
108109
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
109110
</PropertyGroup>
110-
<Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.props'))" />
111-
<Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.targets'))" />
112-
<Error Condition="!Exists('..\packages\xunit.runner.console.2.4.1\build\xunit.runner.console.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.console.2.4.1\build\xunit.runner.console.props'))" />
113-
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.4.2\build\net452\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.4.2\build\net452\xunit.runner.visualstudio.props'))" />
111+
<Error Condition="!Exists('..\packages\xunit.core.2.4.2\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.2\build\xunit.core.props'))" />
112+
<Error Condition="!Exists('..\packages\xunit.core.2.4.2\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.2\build\xunit.core.targets'))" />
113+
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.4.5\build\net462\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.4.5\build\net462\xunit.runner.visualstudio.props'))" />
114+
<Error Condition="!Exists('..\packages\xunit.runner.console.2.4.2\build\xunit.runner.console.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.console.2.4.2\build\xunit.runner.console.props'))" />
114115
</Target>
115-
<Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" />
116+
<Import Project="..\packages\xunit.core.2.4.2\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.4.2\build\xunit.core.targets')" />
116117
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
117118
Other similar extension points exist, see Microsoft.Common.targets.
118119
<Target Name="BeforeBuild">

Tests/packages.config

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="xunit" version="2.4.1" targetFramework="net452" />
3+
<package id="xunit" version="2.4.2" targetFramework="net48" />
44
<package id="xunit.abstractions" version="2.0.3" targetFramework="net452" />
5-
<package id="xunit.analyzers" version="0.10.0" targetFramework="net452" />
6-
<package id="xunit.assert" version="2.4.1" targetFramework="net452" />
7-
<package id="xunit.core" version="2.4.1" targetFramework="net452" />
8-
<package id="xunit.extensibility.core" version="2.4.1" targetFramework="net452" />
9-
<package id="xunit.extensibility.execution" version="2.4.1" targetFramework="net452" />
10-
<package id="xunit.runner.console" version="2.4.1" targetFramework="net452" developmentDependency="true" requireReinstallation="true" />
11-
<package id="xunit.runner.visualstudio" version="2.4.2" targetFramework="net452" developmentDependency="true" />
5+
<package id="xunit.analyzers" version="1.1.0" targetFramework="net48" />
6+
<package id="xunit.assert" version="2.4.2" targetFramework="net48" />
7+
<package id="xunit.core" version="2.4.2" targetFramework="net48" />
8+
<package id="xunit.extensibility.core" version="2.4.2" targetFramework="net48" />
9+
<package id="xunit.extensibility.execution" version="2.4.2" targetFramework="net48" />
10+
<package id="xunit.runner.console" version="2.4.2" targetFramework="net48" developmentDependency="true" />
11+
<package id="xunit.runner.visualstudio" version="2.4.5" targetFramework="net48" developmentDependency="true" />
1212
</packages>

libEDSsharp/CanOpenNodeExporter_V4.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public class CanOpenNodeExporter_V4 : IExporter
5757
UInt16 CNT_TPDO = 0;
5858
UInt16 CNT_GFC = 0;
5959
UInt16 CNT_SRDO = 0;
60+
UInt16 CNT_STORAGE = 0;
61+
UInt16 CNT_EM_PROD = 0;
62+
UInt16 CNT_SYNC_PROD = 0;
63+
UInt16 CNT_HB_PROD = 0;
6064

6165
/// <summary>
6266
/// export the current data set in the CanOpen Node format V4
@@ -126,6 +130,14 @@ private void Prepare(EDSsharp eds)
126130
CNT_GFC++;
127131
if (od.Index>=0x1301 && od.Index<0x1380)
128132
CNT_SRDO++;
133+
if (od.Index==0x1010)
134+
CNT_STORAGE++;
135+
if (od.Index==0x1014)
136+
CNT_EM_PROD++;
137+
if (od.Index==0x1006)
138+
CNT_SYNC_PROD++;
139+
if (od.Index == 0x1006)
140+
CNT_HB_PROD++;
129141
string indexH = $"{od.Index:X4}";
130142
string cName = Make_cname(od.parameter_name);
131143
string varName = $"{indexH}_{cName}";
@@ -196,6 +208,10 @@ private void Prepare(EDSsharp eds)
196208
ODCnt.Add("TPDO", CNT_TPDO);
197209
ODCnt.Add("GFC", CNT_GFC);
198210
ODCnt.Add("SRDO", CNT_SRDO);
211+
ODCnt.Add("STORAGE", CNT_STORAGE);
212+
ODCnt.Add("EM_PROD", CNT_EM_PROD);
213+
ODCnt.Add("SYNC_PROD", CNT_SYNC_PROD);
214+
ODCnt.Add("HB_PROD", CNT_HB_PROD);
199215
}
200216
}
201217

@@ -559,6 +575,10 @@ OD config structure
559575
(config).ENTRY_H1381 = {(eds.ods.ContainsKey(0x1381) ? odname + "_ENTRY_H1381" : "NULL")};\
560576
(config).ENTRY_H13FE = {(eds.ods.ContainsKey(0x13FE) ? odname + "_ENTRY_H13FE" : "NULL")};\
561577
(config).ENTRY_H13FF = {(eds.ods.ContainsKey(0x13FF) ? odname + "_ENTRY_H13FF" : "NULL")};\
578+
(config).CNT_GFC = {(ODCnt.ContainsKey("STORAGE") ? odname + "_CNT_STORAGE" : "0")};\
579+
(config).CNT_GFC = {(ODCnt.ContainsKey("EM_PROD") ? odname + "_EM_PROD" : "0")};\
580+
(config).CNT_GFC = {(ODCnt.ContainsKey("SYNC_PROD") ? odname + "_SYNC_PROD" : "0")};\
581+
(config).CNT_GFC = {(ODCnt.ContainsKey("HB_PROD") ? odname + "_HB_PROD" : "0")};\
562582
(config).CNT_LSS_SLV = 0;\
563583
(config).CNT_LSS_MST = 0;\
564584
(config).CNT_GTWA = 0;\

libEDSsharp/PDOHelper.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public void buildmappingsfromlists()
311311
config.objecttype = ObjectType.RECORD;
312312

313313
ODentry sub = new ODentry("max sub-index", (ushort)slot.ConfigurationIndex, 0);
314-
sub.defaultvalue = "6";
314+
sub.defaultvalue = slot.isTXPDO()? "6" : "5";// max supported sub index TPDO=6, RPDO=5 according DS301
315315
sub.datatype = DataType.UNSIGNED8;
316316
sub.accesstype = EDSsharp.AccessType.ro;
317317
config.addsubobject(0x00,sub);
@@ -328,10 +328,10 @@ public void buildmappingsfromlists()
328328
config.prop.CO_countLabel = "TPDO";
329329

330330
sub = new ODentry("COB-ID used by TPDO", (ushort)slot.ConfigurationIndex, 1);
331-
sub.datatype = DataType.UNSIGNED32;
332-
sub.defaultvalue = slot.COB.ToHexString();
331+
sub.datatype = DataType.UNSIGNED32;
333332
if (slot.nodeidpresent)
334-
sub.defaultvalue += " + $NODEID";
333+
sub.defaultvalue = "$NODEID + "; // DSP306: "The $NODEID must appear at the beginning of the expression. Otherwise the line is interpreted as without a formula.
334+
sub.defaultvalue += slot.COB.ToHexString();
335335
sub.accesstype = EDSsharp.AccessType.rw;
336336
config.addsubobject(0x01, sub);
337337

@@ -373,17 +373,23 @@ public void buildmappingsfromlists()
373373

374374
sub = new ODentry("COB-ID used by RPDO", (ushort)slot.ConfigurationIndex, 1);
375375
sub.datatype = DataType.UNSIGNED32;
376-
sub.defaultvalue = slot.COB.ToHexString();
377376
if (slot.nodeidpresent)
378-
sub.defaultvalue += " + $NODEID";
377+
sub.defaultvalue = "$NODEID + "; // DSP306: "The $NODEID must appear at the beginning of the expression. Otherwise the line is interpreted as without a formula.
378+
sub.defaultvalue += slot.COB.ToHexString();
379379
sub.accesstype = EDSsharp.AccessType.rw;
380380
config.addsubobject(0x01, sub);
381381

382382
sub = new ODentry("transmission type", (ushort)slot.ConfigurationIndex, 2);
383383
sub.datatype = DataType.UNSIGNED8;
384384
sub.defaultvalue = slot.transmissiontype.ToString();
385385
sub.accesstype = EDSsharp.AccessType.rw;
386-
config.addsubobject(0x02, sub);
386+
config.addsubobject(0x02, sub);
387+
388+
sub = new ODentry("event timer", (ushort)slot.ConfigurationIndex, 5);
389+
sub.datatype = DataType.UNSIGNED16;
390+
sub.defaultvalue = slot.eventtimer.ToString();
391+
sub.accesstype = EDSsharp.AccessType.rw;
392+
config.addsubobject(0x05, sub);
387393
}
388394

389395
eds.ods.Add(slot.ConfigurationIndex,config);

libEDSsharp/eds.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,9 +1304,9 @@ public void AccessSDO(AccessSDO accessSDO, AccessPDO accessPDO)
13041304
break;
13051305
case libEDSsharp.AccessSDO.rw:
13061306
if (accessPDO == libEDSsharp.AccessPDO.r)
1307-
accesstype = EDSsharp.AccessType.rwr;
1308-
else if (accessPDO == libEDSsharp.AccessPDO.t)
13091307
accesstype = EDSsharp.AccessType.rww;
1308+
else if (accessPDO == libEDSsharp.AccessPDO.t)
1309+
accesstype = EDSsharp.AccessType.rwr;
13101310
else
13111311
accesstype = EDSsharp.AccessType.rw;
13121312
break;
@@ -1319,9 +1319,9 @@ public AccessPDO AccessPDO()
13191319
if (accType == EDSsharp.AccessType.UNKNOWN && parent != null && parent.objecttype == ObjectType.ARRAY)
13201320
accType = parent.accesstype;
13211321

1322-
if (PDOtype == PDOMappingType.RPDO || accType == EDSsharp.AccessType.rwr)
1322+
if (PDOtype == PDOMappingType.RPDO || accType == EDSsharp.AccessType.rww)
13231323
return libEDSsharp.AccessPDO.r;
1324-
else if (PDOtype == PDOMappingType.TPDO || accType == EDSsharp.AccessType.rww)
1324+
else if (PDOtype == PDOMappingType.TPDO || accType == EDSsharp.AccessType.rwr)
13251325
return libEDSsharp.AccessPDO.t;
13261326
if (PDOtype == PDOMappingType.optional || PDOtype == PDOMappingType.@default)
13271327
return libEDSsharp.AccessPDO.tr;
@@ -1534,7 +1534,7 @@ public void Write(StreamWriter writer, InfoSection.Filetype ft, Odtype odt= Odty
15341534
DataType dt = datatype;
15351535
if (dt == DataType.UNKNOWN && this.parent != null)
15361536
dt = parent.datatype;
1537-
writer.WriteLine(string.Format("DataType=0x{0:X4}", (int)dt));
1537+
writer.WriteLine(string.Format("DataType=0x{0:X4}", (int)dt));
15381538
writer.WriteLine(string.Format("AccessType={0}", accesstype.ToString()));
15391539

15401540

@@ -2546,7 +2546,7 @@ public void ApplycompactPDO(UInt16 index)
25462546
{
25472547
//Fill in cob ID
25482548
//FIX ME i'm really sure this is not correct, what default values should be used???
2549-
string cob = string.Format("0x180+$NODEID");
2549+
string cob = string.Format("$NODEID + 0x180");
25502550
ODentry subod = new ODentry("COB-ID", index, DataType.UNSIGNED32, cob, AccessType.rw, PDOMappingType.no, ods[index]);
25512551
ods[index].subobjects.Add(0x05, subod);
25522552

libEDSsharp/libEDSsharp.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<DefineConstants>DEBUG;TRACE</DefineConstants>
2222
<ErrorReport>prompt</ErrorReport>
2323
<WarningLevel>4</WarningLevel>
24+
<Prefer32Bit>false</Prefer32Bit>
2425
</PropertyGroup>
2526
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2627
<DebugType>pdbonly</DebugType>
@@ -30,6 +31,7 @@
3031
<ErrorReport>prompt</ErrorReport>
3132
<WarningLevel>4</WarningLevel>
3233
<DocumentationFile>docs\libEDSsharp.xml</DocumentationFile>
34+
<Prefer32Bit>false</Prefer32Bit>
3335
</PropertyGroup>
3436
<ItemGroup>
3537
<Reference Include="System" />

0 commit comments

Comments
 (0)