public void Update(PIDErrorController[] controllers) { foreach (SASList s in Enum.GetValues(typeof(SASList))) { PIDGains[(int)s, 0] = controllers[(int)s].PGain; PIDGains[(int)s, 1] = controllers[(int)s].IGain; PIDGains[(int)s, 2] = controllers[(int)s].DGain; PIDGains[(int)s, 3] = controllers[(int)s].Scalar; } }
// used for adding a new preset, can clone the current values public SSASPreset(PIDErrorController[] controllers, string Name) { name = Name; foreach (SASList s in Enum.GetValues(typeof(SASList))) { PIDGains[(int)s, 0] = controllers[(int)s].PGain; PIDGains[(int)s, 1] = controllers[(int)s].IGain; PIDGains[(int)s, 2] = controllers[(int)s].DGain; PIDGains[(int)s, 3] = controllers[(int)s].Scalar; } }
private void drawPIDValues(SASList controllerID, string inputName) { PIDErrorController controller = GetSAS(controllerID); controller.bShow = GUILayout.Toggle(controller.bShow, inputName, UISkin.customStyles[(int)myStyles.btnToggle]); if (controller.bShow) { controller.PGain = labPlusNumBox(KpLabel, controller.PGain.ToString("N3"), 45); controller.IGain = labPlusNumBox(KiLabel, controller.IGain.ToString("N3"), 45); controller.DGain = labPlusNumBox(KdLabel, controller.DGain.ToString("N3"), 45); controller.Scalar = labPlusNumBox(ScalarLabel, controller.Scalar.ToString("N3"), 45); } }
public static void newSSASPreset(ref string name, PIDErrorController[] controllers, Vessel v) { if (string.IsNullOrEmpty(name)) return; string nameTest = name; if (Instance.SSASPresetList.Any(p => p.name == nameTest)) return; SSASPreset newPreset = new SSASPreset(controllers, name); Instance.SSASPresetList.Add(newPreset); Instance.activeSSASPreset = Instance.SSASPresetList.Last(); saveToFile(); name = ""; }