private void Drone_OnDebugDataChange(object sender, DebugDataChangedEventArgs e) { if (InvokeRequired) { Invoke(new EventHandler <DebugDataChangedEventArgs>(Drone_OnDebugDataChange), sender, e); return; } if (drone.Data.State == DroneState.Flying) { StringBuilder pidData = new StringBuilder(); pidData.AppendFormat("Roll: {0}", Formatting.FormatDecimal(e.DebugData.RollOutput, 2, 3)); pidData.AppendLine(); pidData.AppendFormat("Pitch: {0}", Formatting.FormatDecimal(e.DebugData.PitchOutput, 2, 3)); pidData.AppendLine(); pidData.AppendFormat("Yaw: {0}", Formatting.FormatDecimal(e.DebugData.YawOutput, 2, 3)); pidDataLabel.Text = pidData.ToString(); pidDataLabel.Visible = true; } else { pidDataLabel.Visible = false; } }
private void Drone_OnDebugDataChange(object sender, DebugDataChangedEventArgs e) { if (InvokeRequired) { Invoke(new EventHandler <DebugDataChangedEventArgs>(Drone_OnDebugDataChange), sender, e); return; } UpdateDebugData(e.DebugData); }