public void updatePDOinfo() { textBox_eventtimer.Enabled = false; textBox_inhibit.Enabled = false; textBox_syncstart.Enabled = false; textBox_type.Enabled = false; textBox_cob.Enabled = false; button_deletePDO.Enabled = false; button_savepdochanges.Enabled = false; listView_TXCOBmap.FullRowSelect = true; listView_TXCOBmap.GridLines = true; TXchoices.Clear(); TXchoices.Add(String.Format("empty")); //TXchoices.Add(string.Format("Dummy Bool")); //not sure how this works at all for a bit??? TXchoices.Add(string.Format("0x002/00/Dummy Int8")); TXchoices.Add(string.Format("0x003/00/Dummy Int16")); TXchoices.Add(string.Format("0x004/00/Dummy Int32")); TXchoices.Add(string.Format("0x005/00/Dummy UInt8")); TXchoices.Add(string.Format("0x006/00/Dummy UInt16")); TXchoices.Add(string.Format("0x007/00/Dummy UInt32")); listView_TXPDO.BeginUpdate(); listView_TXPDO.Items.Clear(); foreach (KeyValuePair <UInt16, ODentry> kvp in eds.ods) { ODentry od = kvp.Value; int index = kvp.Key; if (od.Disabled == true) { continue; } if (od.objecttype == ObjectType.VAR && (od.PDOtype == PDOMappingType.optional || (isTXPDO && (od.PDOtype == PDOMappingType.TPDO)) || (!isTXPDO && (od.PDOtype == PDOMappingType.RPDO)))) { addTXPDOoption(od); } foreach (KeyValuePair <UInt16, ODentry> kvp2 in od.subobjects) { ODentry odsub = kvp2.Value; if (odsub.subindex == 0) { continue; } if (odsub.PDOtype == PDOMappingType.optional || (isTXPDO && (odsub.PDOtype == PDOMappingType.TPDO)) || (!isTXPDO && (odsub.PDOtype == PDOMappingType.RPDO))) { addTXPDOoption(odsub); } } } listView_TXPDO.EndUpdate(); // Clean out any existing TX cob entries for this device. List <UInt32> removes = new List <UInt32>(); foreach (KeyValuePair <UInt32, EDSsharp> kvp in ODEditor_MainForm.TXCobMap) { if (kvp.Value == eds) { removes.Add(kvp.Key); } } foreach (UInt16 u in removes) { ODEditor_MainForm.TXCobMap.Remove(u); } int row = 0; listView_TXCOBmap.BeginUpdate(); listView_TXCOBmap.Items.Clear(); for (UInt16 idx = startcob; idx < startcob + 0x01ff; idx++) { if (eds.ods.ContainsKey(idx)) { ODentry od = eds.ods[idx]; if (od.Disabled == true) { continue; } //protect againt not completed new CommunicationParamater sections //we probably could do better and do more checking but as long as //we protect against the subobjects[1] read in a few lines all else is //good if (od.subobjects.Count <= 1) { continue; } ListViewItem lvi = new ListViewItem(String.Format("0x{0:x3}", idx)); lvi.Tag = od; bool nodeidpresent; UInt32 cob = eds.GetNodeID(od.subobjects[1].defaultvalue, out nodeidpresent); lvi.SubItems.Add(String.Format("0x{0:x8}", cob)); if (!ODEditor_MainForm.TXCobMap.ContainsKey(cob)) { ODEditor_MainForm.TXCobMap.Add(cob, eds); } ListViewItem lvi2 = new ListViewItem(String.Format("0x{0:x3}", cob)); lvi2.SubItems.Add(string.Format("{0:x4}", idx)); lvi2.SubItems.Add(" "); lvi2.SubItems.Add(" "); lvi2.SubItems.Add(" "); lvi2.SubItems.Add(" "); lvi2.SubItems.Add(" "); lvi2.SubItems.Add(" "); lvi2.SubItems.Add(" "); lvi2.SubItems.Add(" "); listView_TXCOBmap.Items.Add(lvi2); updatePDOTXslot(od, row); row++; } } listView_TXCOBmap.EndUpdate(); }