Skip to content

Commit 6cee770

Browse files
committed
Limiting the length of the objects to be mapped in a PDO to the maximum length of a CAN message (8 bytes)
1 parent 7bee039 commit 6cee770

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

EDSEditorGUI/DevicePDOView2.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ public void UpdatePDOinfo(bool updatechoices = true)
440440
{
441441
if (isTXPDO != slot.isTXPDO())
442442
continue;
443-
443+
if (grid1.ColumnsCount > 64+3)
444+
grid1.ColumnsCount = 64+3;
444445
grid1.Redim(grid1.RowsCount + 1, grid1.ColumnsCount);
445446
grid1.Rows[grid1.RowsCount - 1].Tag = slot;
446447
grid1.Rows[row + 2].Height = 30;
@@ -477,9 +478,15 @@ public void UpdatePDOinfo(bool updatechoices = true)
477478

478479
grid1[row + 2, bitoff + 3].AddController(vcc);
479480
bitoff += entry.Sizeofdatatype();
481+
}
482+
483+
ordinal++;
484+
485+
if (bitoff >= 64) {
486+
MessageBox.Show(string.Format("Invalid TXPDO mapping parameters in 0x{0:X}. Trying to map more than 64 bit (8 Bytes). CAN message maximum lenght is 8 Byte", slot.ConfigurationIndex));
487+
break;
480488
}
481489

482-
ordinal++;
483490
}
484491

485492
//Pad out with an empty combo

0 commit comments

Comments
 (0)