Beispiel #1
0
 public Dictionarys()
 {
     this.ButtonFunctions  = ButtonFunctionsClass.FillButtonFunctions();
     this.DisplayVariables = DisplayVariablesClass.FillDisplayVariables();
     LEDs.LEDUserInterfaceNames(out this.ShiftStyles, out this.PitFlashStyles, out this.RevFlashStyles, out this.PitFlashSpeeds, out this.MatchCarShiftOptions, out this.DeltaLightsPositionOptions);
     this.RPMStyles        = LEDs.FillRPMStyles();
     this.PitStyles        = LEDs.FillPitStyles();
     this.RevLimStyles     = LEDs.FillRevLimStyles();
     this.LapDisplayStyles = LapDisplays.LapDisplayStylesFill();
 }
Beispiel #2
0
        /// <summary>
        ///     Quick info string builder.
        /// </summary>
        /// <param name="disp">DisplayManager Reference</param>
        /// <param name="option">Option string for quick info</param>
        /// <param name="unit"></param>
        private static void DisplayQuickInfoNow(DisplayManager disp, string option, int unit)
        {
            switch (option)
            {
            case "Current Time":
                disp.ShowStringTimed(
                    String.Format(" {0}-{1}", DateTime.Now.Hour.ToString("00"), DateTime.Now.Minute.ToString("00")),
                    disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                break;

            case "Position":
                if (disp.Wrapper.IsConnected)
                {
                    disp.ShowStringTimed(String.Format("Pos {0}", disp.SavedTelemetry.Position),
                                         disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Class Position":
                if (disp.Wrapper.IsConnected)
                {
                    disp.ShowStringTimed(String.Format("C Pos {0}", disp.SavedTelemetry.ClassPosition),
                                         disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Lap ### of ###":
                if (disp.Wrapper.IsConnected)
                {
                    disp.ShowStringTimed(
                        disp.SavedTelemetry.TotalLaps > 0
                                ? String.Format("L{0}-{1}", disp.SavedTelemetry.CurrentLap, disp.SavedTelemetry.TotalLaps)
                                : String.Format("L {0}", disp.SavedTelemetry.CurrentLap),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Sessions Fastest Lap":
                if (disp.Wrapper.IsConnected)
                {
                    if (disp.SavedTelemetry.Overallbestlap > 1)
                    {
                        TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(disp.SavedTelemetry.Overallbestlap));
                        disp.ShowStringTimed(t.ToString("m\\-ss\\.fff"), disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    }
                    else
                    {
                        disp.ShowStringTimed("  none  ", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    }
                }
                break;

            case "Personal Best Lap":
                if (disp.Wrapper.IsConnected)
                {
                    if (disp.SavedTelemetry.PersonalBestLap > 1)
                    {
                        TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(disp.SavedTelemetry.PersonalBestLap));
                        disp.ShowStringTimed(t.ToString("m\\-ss\\.fff"), disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    }
                    else
                    {
                        disp.ShowStringTimed("  none  ", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    }
                }
                break;

            case "Personal Last Lap":
                if (disp.Wrapper.IsConnected)
                {
                    if (disp.SavedTelemetry.LastLapTimeMeasured < 5)
                    {
                        return;
                    }
                    disp.ShowStringTimed(
                        LapDisplays.BuildLapDisplayString(
                            LapDisplayStylesEnum.FullLapTime, disp.SavedTelemetry),
                        disp.CurrentConfiguration.TMDisplaySettings.LapDisplayTime,
                        unit);
                }
                break;

            case "Class Sessions Fastest Lap":
                if (disp.Wrapper.IsConnected)
                {
                    if (disp.SavedTelemetry.ClassBestLap > 1)
                    {
                        TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(disp.SavedTelemetry.ClassBestLap));
                        disp.ShowStringTimed(t.ToString("m\\-ss\\.fff"), disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    }
                    else
                    {
                        disp.ShowStringTimed("  none  ", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    }
                }
                break;

            case "Fuel Percentage":
                if (disp.Wrapper.IsConnected)
                {
                    disp.ShowStringTimed(String.Format("FPct{0}", (disp.SavedTelemetry.CurrentFuelPCT * 100).ToString("0.0")),
                                         disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Fuel Percentage with Quick Info Lights":
                if (disp.Wrapper.IsConnected)
                {
                    disp.ShowStringTimed(String.Format("FPct{0}", (disp.SavedTelemetry.CurrentFuelPCT * 100).ToString("0.0")),
                                         disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    byte[] lights = LEDs.QuickInfoLEDs(disp.SavedTelemetry.CurrentFuelPCT * 100, 0, 100, disp.CurrentConfiguration.TMDisplaySettings.QuickInfoLightsColour);
                    disp.ShowLEDTimed(
                        lights[0],
                        lights[1],
                        false,
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                }
                break;

            case "Session Time":
                if (disp.Wrapper.IsConnected)
                {
                    var tempSt = new TimeSpan(0, 0, Convert.ToInt32(disp.SavedTelemetry.CurrentSessionTime));
                    disp.ShowStringTimed(
                        String.Format("{0}-{1}.{2}", tempSt.Hours.ToString("0"), tempSt.Minutes.ToString("00"),
                                      tempSt.Seconds.ToString("00")),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Session Time Remaining":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.SessionTimeRemaining > 0)
                {
                    var tempStr = new TimeSpan(0, 0, Convert.ToInt32(disp.SavedTelemetry.SessionTimeRemaining));
                    disp.ShowStringTimed(
                        String.Format("{0}-{1}.{2}", tempStr.Hours.ToString("0"), tempStr.Minutes.ToString("00"),
                                      tempStr.Seconds.ToString("00")),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Session Laps Remaining":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.SessionLapsRemaining > 0)
                {
                    disp.ShowStringTimed(
                        String.Format("{0} LaPS", (disp.SavedTelemetry.SessionLapsRemaining).ToString("000")),      //why was I multiplying this value by 100?
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Session Laps Remaining with Quick Info Lights":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.SessionLapsRemaining > 0)
                {
                    disp.ShowStringTimed(
                        String.Format("{0} LaPS", (disp.SavedTelemetry.SessionLapsRemaining).ToString("000")),      //why was I multiplying this value by 100?
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    byte[] lights = LEDs.QuickInfoLEDs(disp.SavedTelemetry.SessionLapsRemaining, 0, 8, disp.CurrentConfiguration.TMDisplaySettings.QuickInfoLightsColour);
                    disp.ShowLEDTimed(
                        lights[0],
                        lights[1],
                        false,
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                }

                break;

            case "Laps of Fuel Remaining":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.Fuel.LapsLeft > 100)
                {
                    disp.ShowStringTimed(
                        String.Format("{0} LaPS", (disp.SavedTelemetry.Fuel.LapsLeft).ToString("0")),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                }
                else if (disp.Wrapper.IsConnected && disp.SavedTelemetry.Fuel.LapsLeft > 0.09f)
                {
                    disp.ShowStringTimed(
                        String.Format("{0} LaPS", (disp.SavedTelemetry.Fuel.LapsLeft).ToString("0.0")),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                }
                else
                {
                    disp.ShowStringTimed("__._ LaPS", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Laps of Fuel Remaining with Quick Info Lights":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.Fuel.LapsLeft > 100)
                {
                    disp.ShowStringTimed(
                        String.Format("{0} LaPS", (disp.SavedTelemetry.Fuel.LapsLeft).ToString("0")),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                    byte[] lights = LEDs.QuickInfoLEDs(disp.SavedTelemetry.Fuel.LapsLeft, 0, 8, disp.CurrentConfiguration.TMDisplaySettings.QuickInfoLightsColour);
                    disp.ShowLEDTimed(
                        lights[0],
                        lights[1],
                        false,
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                }
                else if (disp.Wrapper.IsConnected && disp.SavedTelemetry.Fuel.LapsLeft > 0.09f)
                {
                    disp.ShowStringTimed(
                        String.Format("{0} LaPS", (disp.SavedTelemetry.Fuel.LapsLeft).ToString("0.0")),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                    byte[] lights = LEDs.QuickInfoLEDs(disp.SavedTelemetry.Fuel.LapsLeft, 0, 8, disp.CurrentConfiguration.TMDisplaySettings.QuickInfoLightsColour);
                    disp.ShowLEDTimed(
                        lights[0],
                        lights[1],
                        false,
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                }
                else
                {
                    disp.ShowStringTimed("__._ LaPS", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Fuel Burn Rate (Litres/Lap)":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.Fuel.BurnRate > 0.09f)
                {
                    disp.ShowStringTimed(
                        String.Format("{0} burn", (disp.SavedTelemetry.Fuel.BurnRate).ToString("0.00")),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                }
                else
                {
                    disp.ShowStringTimed("_.__ burn", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Fuel Burn Rate (Gallons/Lap)":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.Fuel.BurnRate > 0.09f)
                {
                    disp.ShowStringTimed(
                        String.Format("{0} burn", (disp.SavedTelemetry.Fuel.BurnRate * 0.26417f).ToString("0.00")),
                        disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime,
                        unit);
                }
                else
                {
                    disp.ShowStringTimed("_.__ burn", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Lap Delta to Best Lap":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.DeltaBestOK)
                {
                    disp.ShowStringTimed(String.Format("bt {0}", disp.SavedTelemetry.DeltaBest.ToString(" 0.00;-0.00; 0.00")), disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                else
                {
                    disp.ShowStringTimed("bt  _.__", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Lap Delta to Optimal Lap":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.DeltaOptOK)
                {
                    disp.ShowStringTimed(String.Format("op {0}", disp.SavedTelemetry.DeltaOpt.ToString(" 0.00;-0.00; 0.00")), disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                else
                {
                    disp.ShowStringTimed("op  _.__", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Lap Delta to Session Best Lap":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.DeltaSesBestOK)
                {
                    disp.ShowStringTimed(String.Format("sb {0}", disp.SavedTelemetry.DeltaSesBest.ToString(" 0.00;-0.00; 0.00")), disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                else
                {
                    disp.ShowStringTimed("sb  _.__", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Lap Delta to Session Optimal Lap":
                if (disp.Wrapper.IsConnected && disp.SavedTelemetry.DeltaSesOptOK)
                {
                    disp.ShowStringTimed(String.Format("so {0}", disp.SavedTelemetry.DeltaSesOpt.ToString(" 0.00;-0.00; 0.00")), disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                else
                {
                    disp.ShowStringTimed("so  _.__", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                }
                break;

            case "Current Selected Lap Delta Type (for Selectable Lap Delta Variable)":
                switch (disp.CurrentDeltaType)
                {
                case 0:
                    disp.ShowStringTimed("bEst", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    break;

                case 1:
                    disp.ShowStringTimed("opt", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    break;

                case 2:
                    disp.ShowStringTimed("ses bEst", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    break;

                case 3:
                    disp.ShowStringTimed("ses opt", disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                    break;
                }
                break;

            case "Change in delta for last 5 seconds (for Selectable Lap Delta Variable)":
                string  result;
                float[] array  = disp.SavedTelemetry.DeltaHistory[disp.CurrentDeltaType].ToArray();
                bool    dataOk = true;
                int     limit  = Math.Min(disp.SavedTelemetry.ExpectedDeltaHistoryLength, array.Length);
                for (int x = 0; x < limit; x++)
                {
                    if (array[x] > 500 - 10)
                    {
                        dataOk = false;
                    }
                }
                if (disp.Wrapper.IsConnected && dataOk)
                {
                    float answer = array[0] - array[disp.SavedTelemetry.ExpectedDeltaHistoryLength - 2];
                    result = String.Format("{0}", answer.ToString(" 0.00;-0.00; 0.00"));
                }
                else
                {
                    result = " _.__";
                }
                disp.ShowStringTimed(
                    String.Format("Ld5 {0}", result), disp.CurrentConfiguration.TMDisplaySettings.QuickInfoDisplayTime, unit);
                break;
            }
        }