private void HandleReportPIDValues(WiFiMonitorConnection.Message msg) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { this.pid1PValue.Value = (decimal)msg.Values[0]; this.pid1IValue.Value = (decimal)msg.Values[1]; this.pid1DValue.Value = (decimal)msg.Values[2]; this.pid1SetPointValue.Value = (decimal)msg.Values[3]; this.pid2PValue.Value = (decimal)msg.Values[4]; this.pid2IValue.Value = (decimal)msg.Values[5]; this.pid2DValue.Value = (decimal)msg.Values[6]; this.pid2SetPointValue.Value = (decimal)msg.Values[7]; this.pid3PValue.Value = (decimal)msg.Values[8]; this.pid3IValue.Value = (decimal)msg.Values[9]; this.pid3DValue.Value = (decimal)msg.Values[10]; this.pid3SetPointValue.Value = (decimal)msg.Values[11]; this.pid4PValue.Value = (decimal)msg.Values[12]; this.pid4IValue.Value = (decimal)msg.Values[13]; this.pid4DValue.Value = (decimal)msg.Values[14]; this.pid4SetPointValue.Value = (decimal)msg.Values[15]; this.pid1PValue.BackColor = this.pid1IValue.BackColor = this.pid1DValue.BackColor = this.pid1SetPointValue.BackColor = Color.YellowGreen; this.pid2PValue.BackColor = this.pid2IValue.BackColor = this.pid2DValue.BackColor = this.pid2SetPointValue.BackColor = Color.YellowGreen; this.pid3PValue.BackColor = this.pid3IValue.BackColor = this.pid3DValue.BackColor = this.pid3SetPointValue.BackColor = Color.YellowGreen; this.pid4PValue.BackColor = this.pid4IValue.BackColor = this.pid4DValue.BackColor = this.pid4SetPointValue.BackColor = Color.YellowGreen; })); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Monitor_MessageReceived(object sender, WiFiMonitorConnection.MessageReceivedEventArgs e) { if (e.Message.Type == WiFiMonitorConnection.MessageType.GetLoopSpeed) { this.HandleReportLoopSpeed(e.Message); } else if (e.Message.Type == WiFiMonitorConnection.MessageType.GetPID) { this.HandleReportPIDValues(e.Message); } }
private void HandleReportLoopSpeed(WiFiMonitorConnection.Message msg) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { this.loopSpeedLabel.Text = "LOOP SPEED: " + msg.Values[0].ToString(); })); } }