private void xAxisEventObj_EventNotify(CML_AMP_EVENT match, bool hasError) { try { if (direction == false) { direction = true; totalReps = totalReps + 1; AutoMoveMotor(true); } else { direction = false; AutoMoveMotor(false); } } catch (Exception ex) { xAxisAmp.HaltMove(); xAxisEventObj.Stop(); xAxisAmp.ClearFaults(); automove = false; motorButton.BackgroundImage = TeamMusclesAndMachine.Properties.Resources.Start_button; DisplayErrorPopup("Auto Move Error", "Auto Move Error: 200"); } }
private void motorStopButton_Click(object sender, EventArgs e) { try { // Disable buttons function while executing this function motorMoveButton.Enabled = false; motorAutoMove.Enabled = false; moveStatusLabel.BackColor = Color.Red; moveStatusLabel.Text = "Motor Stopped"; if (automove == true) { xAxisEventObj.Stop(); } StopMotor(); automove = false; motorMoveButton.Enabled = true; motorAutoMove.Enabled = true; } catch (Exception ex) { motorMoveButton.Enabled = true; motorAutoMove.Enabled = true; moveStatusLabel.BackColor = Color.Yellow; DisplayErrorPopup("Motor Comand Error", "Malfunction with motor movement."); } }