Skip to content

Commit

Permalink
Add a trap in the PDO update to ensure that if an object that is PDo …
Browse files Browse the repository at this point in the history
…mapped gets changed this is caught and not used to generate bad PDO data for export.

See bug #56

I am not declaring this a total fix as it should be able to sort itself out. However to do this is requiring more and more "fudging" this is because the PDO generation code needs removing from the GUI and placing in libedssharp where it can look after itself. So i'm adding this trap in the GUI to warn the user there is an issue. To fix the issue from a user perspective, just click on the drop down PDO mapping combo on the TX/RX pdo tab and it will force a rebuild of the PDO mapping.
  • Loading branch information
robincornelius committed Feb 3, 2017
1 parent f2ac5b0 commit cef25bd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions EDSTest/DevicePDOView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,28 @@ void updatePDOTXslot(ODentry od , int row)
UInt16 pdoindex = (UInt16)((data >> 16) & 0x0000FFFF);
byte pdosub = (byte)((data >> 8) & 0x000000FF);

//sanity check the real OD against the mapping parameters section

bool mappingfail = true;
if(eds.ods.ContainsKey(pdoindex) && (pdosub==0 || eds.ods[pdoindex].containssubindex(pdosub)))
{
ODentry maptarget;
if (pdosub == 0)
maptarget = eds.ods[pdoindex];
else
maptarget = eds.ods[pdoindex].getsubobject(pdosub);

if (maptarget.Disabled == false && datasize == (8*maptarget.sizeofdatatype()))
{
mappingfail = false;
}

if (mappingfail == true)
{
MessageBox.Show(String.Format("PDO mapping failed for object 0x{0:x4}/{1:x2}\nplease manaully check the PDO mapping in the TX and RX PDO tabs\n as it does not agree with the mapping paramater 0x{2:x4}/{3:x2}\nThis can occur if you edit objects that are already mapped",pdoindex,pdosub, idx,sub.subindex));
}
}

String target = "";
int PDOdatasize = 0;

Expand Down

0 comments on commit cef25bd

Please sign in to comment.