private void cbCoolant_CheckedChanged(object sender, EventArgs e) { GlobalProperties.ManualCoolant = cbCoolant.Checked ? true : false; if (DeviceOutput != null && GlobalProperties.ManualState) { if (GlobalProperties.ManualCoolant && GlobalProperties.ManualState) { DeviceOutput.SetBit(11); DeviceOutput.SetBit(14); Actions.SetIndicator(GlobalProperties.Valve.Open, GlobalProperties.Type.ValveCoolant); } else if (!GlobalProperties.ManualCoolant && GlobalProperties.ManualState) { DeviceOutput.ResetBit(11); DeviceOutput.ResetBit(14); Actions.SetIndicator(GlobalProperties.Valve.Close, GlobalProperties.Type.ValveCoolant); } } }
private void PutTrolley() { Task TaskPull = new Task(() => { AsyncTask = true; StatusIndicator(false); while (AsyncTask) { try { FLAG_NEXT = false; if (GlobalProperties.ModbusInputStatus && GlobalProperties.ModbusOutputStatus) { // WRITE DeviceOutput.SetBit(BitInterlock); // READ DeviceInput.GetData("CHA9", out int FeedbackOn); DeviceInput.GetData("CHA8", out int FeedbackOff); // CHECK if (FeedbackOn == 1 && FeedbackOff == 0) { StatusIndicator(true); FLAG_NEXT = true; AsyncTask = false; } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } Thread.Sleep(100); } }); TaskPull.Start(); }
private void PutTrolley() { Task TaskPull = new Task(() => { AsyncTask = true; StatusIndicator(false); while (AsyncTask) { try { FLAG_NEXT = false; if (PublicProperties.ModbusInputStatus && PublicProperties.ModbusOutputStatus) { // WRITE DeviceOutput.SetBit(13); // READ DeviceInput.GetData("CHA9", out int result); System.Diagnostics.Debug.WriteLine(result); // CHECK if (result != 0) { StatusIndicator(true); FLAG_NEXT = true; AsyncTask = false; } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } Thread.Sleep(100); } }); TaskPull.Start(); }