Example #1
0
        public static void LoadData()
        {
            ValueStorageClass Flash = new ValueStorageClass();

            if (Flash.ReadFloat() == 1234)
            {
                PitchCtr.P               = Flash.ReadFloat();
                PitchCtr.I               = Flash.ReadFloat();
                RollCtr.P                = Flash.ReadFloat();
                RollCtr.I                = Flash.ReadFloat();
                YawCtr.P                 = Flash.ReadFloat();
                YawCtr.I                 = Flash.ReadFloat();;
                DisableServos            = Flash.ReadBool();
                RadioModem.Frequency     = Flash.ReadDouble();
                Navi.DestLatitude        = Flash.ReadDouble();
                Navi.DestLongitude       = Flash.ReadDouble();
                TargetAirSpeed           = Flash.ReadFloat();
                Magnetometer.CalXoffSet  = Flash.ReadFloat();
                Magnetometer.CalYoffSet  = Flash.ReadFloat();
                Magnetometer.CalZoffSet  = Flash.ReadFloat();
                Magnetometer.CalXscale   = Flash.ReadFloat();
                Magnetometer.CalYscale   = Flash.ReadFloat();
                Magnetometer.CalZscale   = Flash.ReadFloat();
                Barometer.OffSetAltitude = Flash.ReadFloat();
            }
        }
Example #2
0
        public static void SaveValues()
        {
            ValueStorageClass Flash = new ValueStorageClass();

            Flash.WriteFloat(1234f);
            Flash.WriteFloat(PitchCtr.P);
            Flash.WriteFloat(PitchCtr.I);
            Flash.WriteFloat(RollCtr.P);
            Flash.WriteFloat(RollCtr.I);
            Flash.WriteFloat(YawCtr.P);
            Flash.WriteFloat(YawCtr.I);
            Flash.WriteBool(DisableServos);
            Flash.WriteDouble(RadioModem.Frequency);
            Flash.WriteDouble(Navi.DestLatitude);
            Flash.WriteDouble(Navi.DestLongitude);
            Flash.WriteFloat(TargetAirSpeed);
            Flash.WriteFloat(Magnetometer.CalXoffSet);
            Flash.WriteFloat(Magnetometer.CalYoffSet);
            Flash.WriteFloat(Magnetometer.CalZoffSet);
            Flash.WriteFloat(Magnetometer.CalXscale);
            Flash.WriteFloat(Magnetometer.CalYscale);
            Flash.WriteFloat(Magnetometer.CalZscale);
            Flash.WriteFloat(Barometer.OffSetAltitude);

            Flash.WriteToFlash();
        }