示例#1
0
 private static void UpdateHSI(IHorizontalSituationIndicator hsi, IEHSI ehsi, HsiBits hsibits, FlightData fromFalcon)
 {
     hsi.InstrumentState.OffFlag = ((hsibits & HsiBits.HSI_OFF) == HsiBits.HSI_OFF) && !Extractor.State.OptionsFormIsShowing;
     hsi.InstrumentState.MagneticHeadingDegrees  = (360 + (fromFalcon.yaw / Common.Math.Constants.RADIANS_PER_DEGREE)) % 360;
     ehsi.InstrumentState.NoDataFlag             = ((hsibits & HsiBits.HSI_OFF) == HsiBits.HSI_OFF) && !Extractor.State.OptionsFormIsShowing;;
     ehsi.InstrumentState.NoPowerFlag            = ((fromFalcon.powerBits & (int)PowerBits.BusPowerBattery) != (int)PowerBits.BusPowerBattery) && !Extractor.State.OptionsFormIsShowing;
     ehsi.InstrumentState.MagneticHeadingDegrees = (360 + (fromFalcon.yaw / Common.Math.Constants.RADIANS_PER_DEGREE)) % 360;
 }
示例#2
0
 private static void TurnOffHSI(IHorizontalSituationIndicator hsi)
 {
     hsi.InstrumentState.DmeInvalidFlag                = true;
     hsi.InstrumentState.DeviationInvalidFlag          = false;
     hsi.InstrumentState.CourseDeviationLimitDegrees   = 0;
     hsi.InstrumentState.CourseDeviationDegrees        = 0;
     hsi.InstrumentState.BearingToBeaconDegrees        = 0;
     hsi.InstrumentState.DistanceToBeaconNauticalMiles = 0;
 }
示例#3
0
 private static void UpdateHSIFlightData(IHorizontalSituationIndicator hsi, FlightData flightData, HsiBits hsibits)
 {
     hsi.InstrumentState.DmeInvalidFlag                = ((hsibits & HsiBits.CourseWarning) == HsiBits.CourseWarning);
     hsi.InstrumentState.DeviationInvalidFlag          = ((hsibits & HsiBits.IlsWarning) == HsiBits.IlsWarning);
     hsi.InstrumentState.CourseDeviationLimitDegrees   = flightData.deviationLimit;
     hsi.InstrumentState.CourseDeviationDegrees        = flightData.courseDeviation;
     hsi.InstrumentState.DesiredCourseDegrees          = (int)flightData.desiredCourse;
     hsi.InstrumentState.DesiredHeadingDegrees         = (int)flightData.desiredHeading;
     hsi.InstrumentState.BearingToBeaconDegrees        = flightData.bearingToBeacon;
     hsi.InstrumentState.DistanceToBeaconNauticalMiles = flightData.distanceToBeacon;
 }
示例#4
0
        private static void UpdateHSIAndEHSICourseDeviationAndToFromFlags(IHorizontalSituationIndicator hsi, IEHSI ehsi)
        {
            var  deviationLimitDecimalDegrees  = hsi.InstrumentState.CourseDeviationLimitDegrees % 180;
            var  courseDeviationDecimalDegrees = hsi.InstrumentState.CourseDeviationDegrees;
            bool toFlag;
            bool fromFlag;

            if (Math.Abs(courseDeviationDecimalDegrees) <= 90)
            {
                toFlag   = true;
                fromFlag = false;
            }
            else
            {
                toFlag   = false;
                fromFlag = true;
            }

            if (courseDeviationDecimalDegrees < -90)
            {
                courseDeviationDecimalDegrees = Util.AngleDelta(Math.Abs(courseDeviationDecimalDegrees), 180) % 180;
            }
            else if (courseDeviationDecimalDegrees > 90)
            {
                courseDeviationDecimalDegrees = -Util.AngleDelta(courseDeviationDecimalDegrees, 180) % 180;
            }
            else
            {
                courseDeviationDecimalDegrees = -courseDeviationDecimalDegrees;
            }
            if (Math.Abs(courseDeviationDecimalDegrees) > deviationLimitDecimalDegrees)
            {
                courseDeviationDecimalDegrees = Math.Sign(courseDeviationDecimalDegrees) * deviationLimitDecimalDegrees;
            }

            hsi.InstrumentState.CourseDeviationDegrees = courseDeviationDecimalDegrees;
            hsi.InstrumentState.ToFlag   = toFlag;
            hsi.InstrumentState.FromFlag = fromFlag;
            ehsi.InstrumentState.CourseDeviationDegrees = courseDeviationDecimalDegrees;
            ehsi.InstrumentState.ToFlag   = toFlag;
            ehsi.InstrumentState.FromFlag = fromFlag;
        }
示例#5
0
        private static void UpdateNavigationMode(IHorizontalSituationIndicator hsi, IEHSI ehsi, IADI adi, IISIS isis, FlightData flightData)
        {
            /*
             *  This value is called navMode and is unsigned char type with 4 possible values: ILS_TACAN = 0, and TACAN = 1,
             *  NAV = 2, ILS_NAV = 3
             */

            byte bmsNavMode = flightData.navMode;

            switch (bmsNavMode)
            {
            case 0:     //NavModes.PlsTcn:
                hsi.InstrumentState.ShowToFromFlag  = false;
                ehsi.InstrumentState.ShowToFromFlag = false;
                ehsi.InstrumentState.InstrumentMode = InstrumentModes.PlsTacan;
                break;

            case 1:     //NavModes.Tcn:
                hsi.InstrumentState.ShowToFromFlag   = true;
                ehsi.InstrumentState.ShowToFromFlag  = true;
                ehsi.InstrumentState.InstrumentMode  = InstrumentModes.Tacan;
                adi.InstrumentState.ShowCommandBars  = false;
                isis.InstrumentState.ShowCommandBars = false;
                break;

            case 2:     //NavModes.Nav:
                hsi.InstrumentState.ShowToFromFlag   = false;
                ehsi.InstrumentState.ShowToFromFlag  = false;
                ehsi.InstrumentState.InstrumentMode  = InstrumentModes.Nav;
                adi.InstrumentState.ShowCommandBars  = false;
                isis.InstrumentState.ShowCommandBars = false;
                break;

            case 3:     //NavModes.PlsNav:
                hsi.InstrumentState.ShowToFromFlag  = false;
                ehsi.InstrumentState.ShowToFromFlag = false;
                ehsi.InstrumentState.InstrumentMode = InstrumentModes.PlsNav;
                break;
            }
        }