//Axis原点触发 void NewCtrlCardSR_AxisHomeChange(object sender, EventArgs e) { if (arrAxis == null) { return; } CardAxisSignalEvengArgs cASE = e as CardAxisSignalEvengArgs; if (cASE.CardNum == arrAxis.CardNum && cASE.type == (int)arrAxis.tag_MotionCardManufacturer) { this.Invoke((MethodInvoker) delegate { ulong one = 1; if (arrAxis.tag_homeIoHighLow) { bool VAR = (cASE.Value & (one << arrAxis.AxisNum)) > 0; lblORG.Image = VAR ? Properties.Resources.led_green_on_16 : Properties.Resources.led_off_16; } else { lblORG.Image = ((cASE.Value & (one << arrAxis.AxisNum)) == 0) ? Properties.Resources.led_green_on_16 : Properties.Resources.led_off_16; } }); } }
//Axis负极限触发 void NewCtrlCardSR_AxisLimitNChange(object sender, EventArgs e) { if (arrAxis == null || arrAxis.tag_IoLimtNEnable == 1) { return; } CardAxisSignalEvengArgs cASE = e as CardAxisSignalEvengArgs; if (cASE.CardNum == arrAxis.CardNum && cASE.type == (int)arrAxis.tag_MotionCardManufacturer) { try { ulong one = 1; this.Invoke((MethodInvoker) delegate { if (arrAxis.tag_IoLimtPNHighEnable == 1) { lblMEL.Image = ((cASE.Value & (one << arrAxis.AxisNum)) > 0) ? Properties.Resources.led_green_on_16 : Properties.Resources.led_off_16; } else { lblMEL.Image = ((cASE.Value & (one << arrAxis.AxisNum)) == 0) ? Properties.Resources.led_green_on_16 : Properties.Resources.led_off_16; } }); } catch (System.Exception) { } } }
//Axis使能 void NewCtrlCardSR_AxisEnableChange(object sender, EventArgs e) { if (!bIsAlarm) { ulong one = 1; CardAxisSignalEvengArgs cASE = (CardAxisSignalEvengArgs)e; if (cASE != null && cASE.axisNum == arrAxis.AxisNum && cASE.CardNum == arrAxis.CardNum && cASE.type == (int)arrAxis.tag_MotionCardManufacturer) { this.Invoke((MethodInvoker) delegate { if ((cASE.Value & (one << arrAxis.AxisNum)) == 0) { BTServoSigle.Text = "Servo ON"; BTServoSigle.BackColor = Color.LawnGreen; } else { BTServoSigle.Text = "Servo Off"; BTServoSigle.BackColor = Color.DarkGreen; } }); } } }
//Axis报警 void NewCtrlCardSR_AxisAlarmChange(object sender, EventArgs e) { if (arrAxis == null) { return; } CardAxisSignalEvengArgs cASE = e as CardAxisSignalEvengArgs; if (cASE.CardNum == arrAxis.CardNum && cASE.type == (int)arrAxis.tag_MotionCardManufacturer) { try { ulong one = 1; this.Invoke((MethodInvoker) delegate { if (arrAxis.tag_IoAlarmNHighEnable == 1) { if ((cASE.Value & (one << arrAxis.AxisNum)) > 0) { stfile = BTServoSigle.Text; cl = BTServoSigle.BackColor; BTServoSigle.Text = "Alarm"; BTServoSigle.BackColor = Color.Red; bIsAlarm = true; } else { if (bIsAlarm) { bIsAlarm = false; BTServoSigle.Text = stfile; BTServoSigle.BackColor = cl; } } } else { if ((cASE.Value & (one << arrAxis.AxisNum)) == 0) { stfile = BTServoSigle.Text; cl = BTServoSigle.BackColor; BTServoSigle.Text = "Alarm"; BTServoSigle.BackColor = Color.Red; bIsAlarm = true; } else { if (bIsAlarm) { bIsAlarm = false; BTServoSigle.Text = stfile; BTServoSigle.BackColor = cl; } } } }); } catch (System.Exception) { } } }