Skip to content

Commit

Permalink
Not sure if this is the correct fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrof committed Mar 13, 2024
1 parent d6bdaf8 commit caf9714
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions libEDSsharp/CanOpenXDD.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
This file is part of libEDSsharp.
libEDSsharp is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -639,8 +639,8 @@ public ISO15745ProfileContainer convert(EDSsharp eds)
NetworkManagement.CANopenGeneralFeatures.bootUpSlave = eds.di.SimpleBootUpSlave;
//NetworkManagment.CANopenGeneralFeatures.dynamicChannels = eds.di.DynamicChannelsSupported; //fix me count of dynamic channels not handled yet eds only has bool
NetworkManagement.CANopenGeneralFeatures.granularity = eds.di.Granularity;
NetworkManagement.CANopenGeneralFeatures.groupMessaging = eds.di.GroupMessaging;

NetworkManagement.CANopenGeneralFeatures.groupMessaging = eds.di.GroupMessaging;

NetworkManagement.CANopenGeneralFeatures.ngMaster = eds.di.NG_Master;
NetworkManagement.CANopenGeneralFeatures.ngSlave = eds.di.NG_Slave;
NetworkManagement.CANopenGeneralFeatures.NrOfNG_MonitoredNodes = eds.di.NrOfNG_MonitoredNodes;
Expand Down Expand Up @@ -918,9 +918,9 @@ public EDSsharp convert(ISO15745ProfileContainer container)
}

eds.di.NG_Master = NetworkManagment.CANopenGeneralFeatures.ngMaster;
eds.di.NG_Slave = NetworkManagment.CANopenGeneralFeatures.ngSlave;
eds.di.NrOfNG_MonitoredNodes = NetworkManagment.CANopenGeneralFeatures.NrOfNG_MonitoredNodes;

eds.di.NG_Slave = NetworkManagment.CANopenGeneralFeatures.ngSlave;
eds.di.NrOfNG_MonitoredNodes = NetworkManagment.CANopenGeneralFeatures.NrOfNG_MonitoredNodes;

eds.di.NrOfRXPDO = NetworkManagment.CANopenGeneralFeatures.nrOfRxPDO;
eds.di.NrOfTXPDO = NetworkManagment.CANopenGeneralFeatures.nrOfTxPDO;

Expand Down Expand Up @@ -1118,7 +1118,7 @@ public EDSsharp convert(ISO15745ProfileContainer container)

subentry.uniqueID = subobj.uniqueIDRef;

entry.subobjects.Add(subobj.subIndex[0], subentry);
entry.subobjects.Add(subobj.subIndex[1], subentry);

This comment has been minimized.

Copy link
@nimrof

nimrof Mar 14, 2024

Author Collaborator

this change i really want others to take a look at

This comment has been minimized.

Copy link
@CANopenNode

CANopenNode Mar 14, 2024

Owner

@trojanobelix, maybe you remember something: 973eeb68

This comment has been minimized.

Copy link
@trojanobelix

trojanobelix Mar 14, 2024

Collaborator

Yes, that was the fix for #29.
The comment above the line was: "FIXME WTF is going on here?" (not mine)

Strange.

Seems to be dependent on the XDD file.
You would have to compare that from #29 again with the

entry.subobjects.Add(subobj.subIndex[1], subentry); Version

to find out exactly where the problem lies.
When I changed this, it seemed logical to me.

This comment has been minimized.

Copy link
@nimrof

nimrof Mar 14, 2024

Author Collaborator

When i load the file from #29 the subindex is in [0] and there is no [1], but in the unit test there is 0 & 1 and the subindex is in 1

So this hack works
entry.subobjects.Add(subobj.subIndex[subobj.subIndex.Length - 1], subentry);

This comment has been minimized.

Copy link
@CANopenNode

CANopenNode Mar 14, 2024

Owner

CANopen has two standards for XDD, both implemented here. This file is for older, I'm not using it and don't know, how well it works. It may be marked as obsolete.

This comment has been minimized.

Copy link
@nimrof

nimrof Mar 14, 2024

Author Collaborator

CANopen has two standards for XDD, both implemented here. This file is for older, I'm not using it and don't know, how well it works. It may be marked as obsolete.

Sounds like a good idea, there are a few fixme comments in the file, some are just about verbose code, but there are also some not-implemented stuff too.

Could we accept the hack for now?

Looks like the problem comes from inside the generated code.
ApplicationLayers in the convert function has the invalid/strange subindex value.

I dont want to touch the generated code, but can always generated the generated code again with newer generators and see if that fixes the problem, but maybe at a later time

This comment has been minimized.

Copy link
@trojanobelix

trojanobelix Mar 14, 2024

Collaborator

In sum it looks good to me. Let's give it a try.


}
}
Expand Down Expand Up @@ -3832,8 +3832,8 @@ public partial class ProfileBody_CommunicationNetwork_CANopenNetworkManagementCA
private ushort nrOfTxPDOField;

private bool ngMasterField;
private bool ngSlaveField;
private ushort NrOfNG_MonitoredNodesField;
private bool ngSlaveField;
private ushort NrOfNG_MonitoredNodesField;
private bool bootUpSlaveField;

private bool layerSettingServiceSlaveField;
Expand Down Expand Up @@ -4001,18 +4001,18 @@ public bool ngMaster
{
this.ngMasterField = value;
}
}

}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(typeof(ushort), "0")]
public ushort NrOfNG_MonitoredNodes
public ushort NrOfNG_MonitoredNodes
{
get
get
{
return this.NrOfNG_MonitoredNodesField;
}
set
set
{
this.NrOfNG_MonitoredNodesField = value;
}
Expand Down

1 comment on commit caf9714

@trojanobelix
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In sum it looks good to me. Let's give it a try.

Please sign in to comment.