增加移动命令前,电机状态的检查; 关闭窗体,关闭服务

This commit is contained in:
zhengxuan.zhang
2024-03-26 17:23:13 +08:00
parent 264c4c5601
commit 54170f3a52
3 changed files with 67 additions and 29 deletions
+1 -1
View File
@@ -557,8 +557,8 @@
this.cboAxisNo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboAxisNo.FormattingEnabled = true;
this.cboAxisNo.Items.AddRange(new object[] {
"1",
"0",
"1",
"8"});
this.cboAxisNo.Location = new System.Drawing.Point(115, 20);
this.cboAxisNo.Name = "cboAxisNo";
+14 -14
View File
@@ -19,7 +19,7 @@ namespace HexcalMC
private const int MaxUiLimitCnt = 8;
private const int MaxUiIoCnt = 8;
private readonly Api _acs;
private readonly int _motionTimeout = 5000; //延时时间
private readonly int _motionTimeout = 50000; //延时时间
private readonly Axis[] UseAxis = MainFrom.UseAxis; //获取激活的轴
@@ -223,6 +223,8 @@ namespace HexcalMC
#region
InitMotion();
#endregion
@@ -242,15 +244,7 @@ namespace HexcalMC
string strTemp;
int i;
//判断通讯对象是否存在
if (_acs == null || !_acs.IsConnected)
{
DebugDfn.AddLogText("未建立通讯,请在主界面先建立通讯");
// 在合适的位置调用 MessageBox.Show() 方法
MessageBox.Show("未建立通讯,请在主界面先建立通讯", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
_mBConnected = _acs.IsConnected;
// Get Total number of axes
@@ -913,11 +907,15 @@ namespace HexcalMC
}
// Add log to ListBox
Invoke((MethodInvoker)delegate
if (lstLog.IsHandleCreated)
{
lstLog.Items.Add(string.Format(" - Axis {0}, Stoppped", axisNo));
lstLog.SelectedIndex = lstLog.Items.Count - 1;
});
Invoke((MethodInvoker)delegate
{
lstLog.Items.Add(string.Format(" - Axis {0}, Stoppped", axisNo));
lstLog.SelectedIndex = lstLog.Items.Count - 1;
});
}
}
private void BtnEventProgramEnd_Click(object sender, EventArgs e)
@@ -1056,6 +1054,8 @@ namespace HexcalMC
0,
0
};
//执行运动指令
_acs.ToPointM(MotionFlags.ACSC_NONE, UseAxis, pointsArray); //多轴运动到指定位置