Ejemplo n.º 1
0
 public static void deleteSSASPreset(SSASPreset p)
 {
     if (Instance.activeSSASPreset == p)
     {
         Instance.activeSSASPreset = null;
     }
     Instance.SSASPresetList.Remove(p);
     p = null;
     saveToFile();
 }
Ejemplo n.º 2
0
        public static ConfigNode PIDnode(string name, int index, SSASPreset preset)
        {
            ConfigNode node = new ConfigNode(name);

            node.AddValue(pGain, preset.PIDGains[index, 0]);
            node.AddValue(iGain, preset.PIDGains[index, 1]);
            node.AddValue(dGain, preset.PIDGains[index, 2]);
            node.AddValue(scalar, preset.PIDGains[index, 3]);
            return(node);
        }
Ejemplo n.º 3
0
        public static ConfigNode SSASPresetNode(SSASPreset preset)
        {
            ConfigNode node = new ConfigNode(sasPresetNodeName);

            node.AddValue("name", preset.name);
            node.AddNode(PIDnode(aileronCtrlr, (int)SASList.Bank, preset));
            node.AddNode(PIDnode(rudderCtrlr, (int)SASList.Hdg, preset));
            node.AddNode(PIDnode(elevCtrlr, (int)SASList.Pitch, preset));

            return(node);
        }
Ejemplo n.º 4
0
        public static void loadSSASPreset(SSASPreset p, TweakableSAS instance)
        {
            PIDErrorController[] c = instance.SASControllers;

            foreach (SASList s in Enum.GetValues(typeof(SASList)))
            {
                c[(int)s].PGain  = p.PIDGains[(int)s, 0];
                c[(int)s].IGain  = p.PIDGains[(int)s, 1];
                c[(int)s].DGain  = p.PIDGains[(int)s, 2];
                c[(int)s].Scalar = p.PIDGains[(int)s, 3];
            }

            Instance.activeSSASPreset = p;
            saveToFile();
        }
Ejemplo n.º 5
0
        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 = "";
        }
Ejemplo n.º 6
0
        public static ConfigNode SSASPresetNode(SSASPreset preset)
        {
            ConfigNode node = new ConfigNode(sasPresetNodeName);
            node.AddValue("name", preset.name);
            node.AddNode(PIDnode(aileronCtrlr, (int)SASList.Bank, preset));
            node.AddNode(PIDnode(rudderCtrlr, (int)SASList.Hdg, preset));
            node.AddNode(PIDnode(elevCtrlr, (int)SASList.Pitch, preset));

            return node;
        }
Ejemplo n.º 7
0
 public static ConfigNode PIDnode(string name, int index, SSASPreset preset)
 {
     ConfigNode node = new ConfigNode(name);
     node.AddValue(pGain, preset.PIDGains[index, 0]);
     node.AddValue(iGain, preset.PIDGains[index, 1]);
     node.AddValue(dGain, preset.PIDGains[index, 2]);
     node.AddValue(scalar, preset.PIDGains[index, 3]);
     return node;
 }
Ejemplo n.º 8
0
        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 = "";
        }
Ejemplo n.º 9
0
        public static void loadSSASPreset(SSASPreset p, TweakableSAS instance)
        {
            PIDErrorController[] c = instance.SASControllers;

            foreach (SASList s in Enum.GetValues(typeof(SASList)))
            {
                c[(int)s].PGain = p.PIDGains[(int)s, 0];
                c[(int)s].IGain = p.PIDGains[(int)s, 1];
                c[(int)s].DGain = p.PIDGains[(int)s, 2];
                c[(int)s].Scalar = p.PIDGains[(int)s, 3];
            }

            Instance.activeSSASPreset = p;
            saveToFile();
        }
Ejemplo n.º 10
0
 public static void deleteSSASPreset(SSASPreset p)
 {
     if (Instance.activeSSASPreset == p)
         Instance.activeSSASPreset = null;
     Instance.SSASPresetList.Remove(p);
     p = null;
     saveToFile();
 }