void GUIArmDrive_directionPressed(GUIArmDrive.GUIDriveUIDParser t) { int MAG = t.Magnitude; string Axis = t.Axis; string toSend = ""; switch (t.Axis) { case "X": if ((TTtargetPos + MAG) <= 0) { TTtargetPos = 1; } else if ((TTtargetPos + MAG) >= 1023) { TTtargetPos = 1023; } else { TTtargetPos += MAG; } toSend = "TTPOS:" + TTtargetPos; break; case "Y": if ((ELtargetPos + MAG) <= 0) { ELtargetPos = 1; } else if ((ELtargetPos + MAG) >= 1023) { ELtargetPos = 1023; } else { ELtargetPos += MAG; } toSend = "ELPOS:" + ELtargetPos; break; case "Z": if ((S1targetPos + MAG) <= 0) { S1targetPos = 1; } else if ((S1targetPos + MAG) >= 1023) { S1targetPos = 1023; } else { S1targetPos += MAG; } toSend = "S1POS:" + S1targetPos; break; } if (toSend != "") { //If there is data to send, send it ARM.write(toSend); Dispatcher.Invoke(() => outgoingCOMViz.addText(toSend + "\n")); } }
private void testControl_directionPressed(GUIArmDrive.GUIDriveUIDParser t) { MessageBox.Show("Axis: " + t.Axis + " Magnitude: " + t.Magnitude); }