Exemple #1
0
        /// <summary>
        /// Setup Display Manager Instance before using the Start Method
        /// </summary>
        internal void SetupDisplayMngr(int telemetryRefreshRateParameter, List<bool> tm1640Units)
        {
            this.telemetryRefreshRate = telemetryRefreshRateParameter;
            this.TM1640Units = tm1640Units;
            CurrentConfiguration.TMDisplaySettings.NumDisplayUnits = CurrentConfiguration.DisplayConfigurations.Count;
            CurrentConfiguration.NumberControllers = CurrentConfiguration.ControllerConfigurations.Count;
            this.DisplayRefreshRate = telemetryRefreshRateParameter / CurrentConfiguration.RefreshRates.DisplayRefreshRate;
            this.LEDRefreshRate = telemetryRefreshRateParameter / CurrentConfiguration.RefreshRates.LEDRefreshRate;
            int units = CurrentConfiguration.TMDisplaySettings.NumDisplayUnits;
            this.WaitTimeTMDisplay.Clear();
            this.WaitTimeTMLEDS.Clear();
            if (!CurrentConfiguration.OtherSettings.UseCustomFuelCalculationOptions)
            {
                CurrentConfiguration.OtherSettings.FuelCalculationLaps = 3;
                CurrentConfiguration.OtherSettings.UseWeightedFuelCalculations = true;
            }
            SavedTelemetry = new SavedTelemetryValues(CurrentConfiguration.OtherSettings.FuelCalculationLaps,CurrentConfiguration.OtherSettings.UseWeightedFuelCalculations, this.telemetryRefreshRate);
            RequestedTMDisplayVariables = new List<TMDisplayVariables>();
            RequestedTMLEDVariables = new List<TMLEDVariables>();
            for (int k = 1; k <= units; k++)
            {
                this.WaitTimeTMDisplay.Add(DateTime.Now);
                this.WaitTimeTMLEDS.Add(DateTime.Now);
                RequestedTMLEDVariables.Add(new TMLEDVariables());
                RequestedTMDisplayVariables.Add(new TMDisplayVariables());
                CurrentScreen.Add(0);
            }
            displayRefreshRateFactor = this.telemetryRefreshRate / CurrentConfiguration.RefreshRates.DisplayRefreshRate;
            useFuelCalcs = false;
            useDeltaTiming = true; // Add Checks for whether to log delta variables
            useLapTiming = false;
            useEngineWarnings = false;
            if (CurrentConfiguration.TMDisplaySettings.NumDisplayUnits > 0)
            {
                foreach (var unit in CurrentConfiguration.DisplayConfigurations)
                {
                    if (unit.ShowLap)
                    {
                        useLapTiming = true;
                    }
                    if (unit.ShowEngineWarnings)
                    {
                        useEngineWarnings = true;
                    }
                    foreach (var screen in unit.Screens)
                    {
                        foreach (var dvar in screen.Variables)
                        {
                            if (dvar == DisplayVarsEnum.FuelBurnRate.ToString() || dvar == DisplayVarsEnum.FuelLapsLeft.ToString() || dvar == DisplayVarsEnum.FuelBurnRateGallons.ToString())
                            {
                                useFuelCalcs = true;
                            }
                        }
                    }
                    foreach (var button in unit.ButtonOptions)
                    {
                        if (button == "Fuel Burn Rate (Litres/Lap)" || button == "Laps of Fuel Remaining" || button == "Fuel Burn Rate (Gallons/Lap)")
                        {
                            useFuelCalcs = true;
                        }
                    }
                }
            }
            foreach (var controller in CurrentConfiguration.ControllerConfigurations)
            {
                foreach (var button in controller.ButtonOptions)
                {
                    if (button == "Fuel Burn Rate (Litres/Lap)" || button == "Laps of Fuel Remaining" || button == "Fuel Burn Rate (Gallons/Lap)")
                    {
                        useFuelCalcs = true;
                    }
                }
            }

            //setup controllers
            if (CurrentConfiguration.NumberControllers > 0)
            {
                IList<ControllerDevice> systemControllers = ControllerDevice.Available();
                this.controllers = new List<ControllerDevice>();
                this.lastPress = new List<List<int>>();
                for (int z = 0; z < CurrentConfiguration.ControllerConfigurations.Count; z++)
                {
                    //find controller
                    int z1 = z;
                    foreach (
                        ControllerDevice systemController in
                            systemControllers.Where(
                                systemController =>
                                systemController.Guid == CurrentConfiguration.ControllerConfigurations[z1].DeviceGuid))
                    {
                        systemController.Acquire(new Form());
                        this.lastPress.Add(new List<int>());
                        this.controllers.Add(systemController);
                    }
                }
            }
            DeltaLightsOn = CurrentConfiguration.TMDisplaySettings.DeltaLightsOnDefault;
        }
Exemple #2
0
        public static string BuildDisplayString(SdkWrapper.TelemetryUpdatedEventArgs e, List<string> variables, Dictionarys dictionarys, SavedTelemetryValues savedTelemetry, int currentDeltaType)
        {
            var displayString = "";
            foreach (string dvString in variables)
            {
                DisplayVarsEnum dv;
                if (!Enum.TryParse(dvString, out dv)) continue;
                switch (dv)
                {
                    case DisplayVarsEnum.Speed:
                        float speedtemp = e.TelemetryInfo.Speed.Value * 3.6f;
                        if (speedtemp > 1)
                        {
                            displayString += RightJustify((e.TelemetryInfo.Speed.Value * 3.6f).ToString("0"),
                                                          dictionarys.DisplayVariables[dv].Length);
                        }
                        else
                        {
                            displayString += RightJustify("0", dictionarys.DisplayVariables[dv].Length);
                        }
                        break;
                    case DisplayVarsEnum.SpeedMiles:
                        float speedtemp2 = e.TelemetryInfo.Speed.Value * 2.236f;
                        if (speedtemp2 > 1)
                        {
                            displayString += RightJustify((e.TelemetryInfo.Speed.Value * 2.236f).ToString("0"),
                                                          dictionarys.DisplayVariables[dv].Length);
                        }
                        else
                        {
                            displayString += RightJustify("0", dictionarys.DisplayVariables[dv].Length);
                        }
                        break;
                    case DisplayVarsEnum.Gear:
                        if (e.TelemetryInfo.Gear.Value > 0)
                        {
                            displayString += e.TelemetryInfo.Gear.Value.ToString(CultureInfo.InvariantCulture);
                        }
                        else if (e.TelemetryInfo.Gear.Value == 0)
                        {
                            displayString += "n";
                        }
                        else
                        {
                            displayString += "r";
                        }
                        break;
                    case DisplayVarsEnum.RPM5:
                        displayString += RightJustify(e.TelemetryInfo.RPM.Value.ToString("0"),
                                                      dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.RPM4:
                        if (e.TelemetryInfo.RPM.Value >= 10000)
                        {
                            displayString += RightJustify((e.TelemetryInfo.RPM.Value / 1000f).ToString("0.00"),
                                                          dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        else
                        {
                            displayString += RightJustify(e.TelemetryInfo.RPM.Value.ToString("0"),
                                                          dictionarys.DisplayVariables[dv].Length);
                        }
                        break;
                    case DisplayVarsEnum.RPM3:
                        if (e.TelemetryInfo.RPM.Value >= 10000)
                        {
                            displayString += RightJustify((e.TelemetryInfo.RPM.Value / 1000f).ToString("0.0"),
                                                          dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        else
                        {
                            displayString += RightJustify((e.TelemetryInfo.RPM.Value / 1000f).ToString("0.00"),
                                                          dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        break;
                    case DisplayVarsEnum.Throttle:
                        displayString += RightJustify((e.TelemetryInfo.Throttle.Value * 100).ToString("0"),
                                                      dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.Brake:
                        displayString += RightJustify((e.TelemetryInfo.Brake.Value * 100).ToString("0"),
                                                      dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.Clutch:
                        displayString += RightJustify((e.TelemetryInfo.Clutch.Value * 100).ToString("0"),
                                                      dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.RaceLaps3:
                        displayString +=
                            RightJustify(e.TelemetryInfo.RaceLaps.Value.ToString(CultureInfo.InvariantCulture),
                                         dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.RaceLaps2:
                        displayString +=
                            RightJustify(e.TelemetryInfo.RaceLaps.Value.ToString(CultureInfo.InvariantCulture),
                                         dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.Laps3:
                        displayString +=
                            RightJustify(e.TelemetryInfo.Lap.Value.ToString(CultureInfo.InvariantCulture),
                                         dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.Laps2:
                        displayString +=
                            RightJustify(e.TelemetryInfo.Lap.Value.ToString(CultureInfo.InvariantCulture),
                                         dictionarys.DisplayVariables[dv].Length);
                        break;

                    case DisplayVarsEnum.CurrentLapTime:
                        if (e.TelemetryInfo.LapCurrentLapTime.Value > 1)
                        {
                            TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(e.TelemetryInfo.LapCurrentLapTime.Value));
                            displayString += t.ToString("m\\-ss\\.ff");
                        }
                        else
                        {
                            displayString += "_-__.__";
                        }
                        break;
                    case DisplayVarsEnum.SelectableLapDelta:
                        switch (currentDeltaType)
                        {
                            case 0:
                                if (e.TelemetryInfo.LapDeltaToBestLap_OK.Value)
                                {
                                    displayString += DeltaDisplay(e.TelemetryInfo.LapDeltaToBestLap.Value);
                                }
                                else
                                {
                                    displayString += " _._";
                                }
                                break;
                            case 1:
                                if (e.TelemetryInfo.LapDeltaToOptimalLap_OK.Value)
                                {
                                    displayString += DeltaDisplay(e.TelemetryInfo.LapDeltaToOptimalLap.Value);
                                }
                                else
                                {
                                    displayString += " _._";
                                }

                                break;
                            case 2:
                                if (e.TelemetryInfo.LapDeltaToSessionBestLap_OK.Value)
                                {
                                    displayString += DeltaDisplay(e.TelemetryInfo.LapDeltaToSessionBestLap.Value);
                                }
                                else
                                {
                                    displayString += " _._";
                                }

                                break;
                            case 3:
                                if (e.TelemetryInfo.LapDeltaToSessionOptimalLap_OK.Value)
                                {
                                    displayString += DeltaDisplay(e.TelemetryInfo.LapDeltaToSessionOptimalLap.Value);
                                }
                                else
                                {
                                    displayString += " _._";
                                }
                                break;
                            default:
                                displayString += " _._";
                                break;
                        }
                        break;
                    case DisplayVarsEnum.LapDeltaBest:
                        if (e.TelemetryInfo.LapDeltaToBestLap_OK.Value)
                        {
                            displayString += DeltaDisplay(e.TelemetryInfo.LapDeltaToBestLap.Value);
                        }
                        else
                        {
                            displayString += " _._";
                        }
                        break;
                    case DisplayVarsEnum.LapDeltaOptimal:
                        if (e.TelemetryInfo.LapDeltaToOptimalLap_OK.Value)
                        {
                            displayString += DeltaDisplay(e.TelemetryInfo.LapDeltaToOptimalLap.Value);
                        }
                        else
                        {
                            displayString += " _._";
                        }
                        break;
                    case DisplayVarsEnum.LapDeltaSessionBest:
                        if (e.TelemetryInfo.LapDeltaToSessionBestLap_OK.Value)
                        {
                            displayString += DeltaDisplay(e.TelemetryInfo.LapDeltaToSessionBestLap.Value);
                        }
                        else
                        {
                            displayString += " _._";
                        }
                        break;
                    case DisplayVarsEnum.LapDeltaSessionOptimal:
                        if (e.TelemetryInfo.LapDeltaToSessionOptimalLap_OK.Value)
                        {
                            displayString += DeltaDisplay(e.TelemetryInfo.LapDeltaToSessionOptimalLap.Value);
                        }
                        else
                        {
                            displayString += " _._";
                        }
                        break;

                    case DisplayVarsEnum.ForceFeedBackPCT:
                        displayString += RightJustify(
                            (e.TelemetryInfo.SteeringWheelPctTorque.Value * 100).ToString("0"),
                            dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.FuelLitres:
                        if (e.TelemetryInfo.FuelLevel.Value < 100)
                        {
                            displayString += RightJustify(e.TelemetryInfo.FuelLevel.Value.ToString("0.0"),
                                                          dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        else
                        {
                            displayString += RightJustify(e.TelemetryInfo.FuelLevel.Value.ToString("0"),
                                                          dictionarys.DisplayVariables[dv].Length);
                        }
                        break;
                    case DisplayVarsEnum.FuelGallons:
                        float fuelGallons = e.TelemetryInfo.FuelLevel.Value * 0.26417f;
                        if (fuelGallons < 100)
                        {
                            displayString += RightJustify(fuelGallons.ToString("0.0"),
                                                          dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        else
                        {
                            displayString += RightJustify(fuelGallons.ToString("0"),
                                                          dictionarys.DisplayVariables[dv].Length);
                        }
                        break;
                    case DisplayVarsEnum.FuelPCT:
                        if (e.TelemetryInfo.FuelLevelPct.Value >= 100)
                        {
                            displayString += "100";
                        }
                        else
                        {
                            displayString += RightJustify((e.TelemetryInfo.FuelLevelPct.Value * 100).ToString("0.0"),
                                                          dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        break;
                    case DisplayVarsEnum.FuelBurnRate:
                        if (savedTelemetry.Fuel.BurnRate >= 0.01f)
                        {
                            displayString += RightJustify(savedTelemetry.Fuel.BurnRate.ToString("0.00"), dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        else
                        {
                            displayString += "_.__";
                        }
                        break;
                    case DisplayVarsEnum.FuelBurnRateGallons:
                        //System.Diagnostics.Debug.WriteLine(String.Format("FuelBurnGallons"));
                        float burnRateGallons = savedTelemetry.Fuel.BurnRate * 0.26417f;
                        //System.Diagnostics.Debug.WriteLine(String.Format("          Value: {0}",burnRateGallons));
                        if (burnRateGallons >= 0.01f)
                        {
                            displayString += RightJustify(burnRateGallons.ToString("0.00"), dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        else
                        {
                            displayString += "_.__";
                        }
                        break;
                    case DisplayVarsEnum.FuelLapsLeft:
                        if (savedTelemetry.Fuel.LapsLeft > 100)
                        {
                            displayString += RightJustify(savedTelemetry.Fuel.LapsLeft.ToString("0"), dictionarys.DisplayVariables[dv].Length);
                        }
                        else if (savedTelemetry.Fuel.LapsLeft >= 0.1f)
                        {
                            displayString += RightJustify(savedTelemetry.Fuel.LapsLeft.ToString("0.0"), dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        else
                        {
                            displayString += "_._";
                        }
                        break;
                    case DisplayVarsEnum.LongG:
                        displayString += RightJustify(
                            (e.TelemetryInfo.LongAccel.Value / 10).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.LatG:
                        displayString += RightJustify(
                            (e.TelemetryInfo.LatAccel.Value / 10).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.TotalG:
                        displayString +=
                            RightJustify(
                                (Math.Sqrt(e.TelemetryInfo.LongAccel.Value * e.TelemetryInfo.LongAccel.Value +
                                           e.TelemetryInfo.LatAccel.Value * e.TelemetryInfo.LatAccel.Value) / 10)
                                    .ToString(" 0.0;-0.0; 0.0"), dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.Position:
                        displayString +=
                            RightJustify(savedTelemetry.Position.ToString(CultureInfo.InvariantCulture),
                                         dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.Space:
                        displayString += " ";
                        break;
                    case DisplayVarsEnum.DoubleSpace:
                        displayString += "  ";
                        break;
                    case DisplayVarsEnum.Underscore:
                        displayString += "_";
                        break;
                    case DisplayVarsEnum.FuelPressure:
                        displayString += RightJustify(
                            (e.TelemetryInfo.FuelPress.Value).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.FuelPressurePSi:
                        displayString += RightJustify(
                            (e.TelemetryInfo.FuelPress.Value * 14.5f).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.ManifoldPressure:
                        displayString += RightJustify(
                            (e.TelemetryInfo.ManifoldPressure.Value).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.ManifoldPressurePSi:
                        displayString += RightJustify(
                            (e.TelemetryInfo.ManifoldPressure.Value * 14.5f).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.OilLevel:
                        displayString += RightJustify(
                            (e.TelemetryInfo.OilLevel.Value).ToString("0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.OilPressure:
                        displayString += RightJustify(
                            (e.TelemetryInfo.OilPress.Value).ToString("0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.OilTemp:
                        displayString += RightJustify(
                            (e.TelemetryInfo.OilTemp.Value).ToString("000"),
                            dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.OilLevelGallons:
                        displayString += RightJustify(
                            (e.TelemetryInfo.OilLevel.Value * 0.26417f).ToString("0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.OilPressurePSi:
                        displayString += RightJustify(
                            (e.TelemetryInfo.OilPress.Value * 14.5f).ToString("0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.OilTempFahrenheit:
                        displayString += RightJustify(
                            ((e.TelemetryInfo.OilTemp.Value) * 9f/5f + 32).ToString("000"),
                            dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.Pitch:
                        displayString += RightJustify(
                            (e.TelemetryInfo.Pitch.Value * 57.2957795).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.PitchRate:
                        displayString += RightJustify(
                            (e.TelemetryInfo.PitchRate.Value * 57.2957795).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.Roll:
                        displayString += RightJustify(
                            (e.TelemetryInfo.Roll.Value * 57.2957795).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.RollRate:
                        displayString += RightJustify(
                            (e.TelemetryInfo.RollRate.Value * 57.2957795).ToString(" 0.0;-0.0; 0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.Yaw:
                        displayString += RightJustify(
                            (e.TelemetryInfo.Yaw.Value * 57.2957795).ToString(" 00;-00; 00"),
                            dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.YawRate:
                        displayString += RightJustify(
                            (e.TelemetryInfo.YawRate.Value * 57.2957795).ToString(" 00;-00; 00"),
                            dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.SteeringWheelAngle:
                        displayString += RightJustify(
                            (e.TelemetryInfo.SteeringWheelAngle.Value * 57.2957795).ToString(" 000;-000; 000"),
                            dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.EngineVoltage:
                        displayString += RightJustify(
                            (e.TelemetryInfo.Voltage.Value).ToString("00.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.EngineWaterLevel:
                        displayString += RightJustify(
                            (e.TelemetryInfo.WaterLevel.Value).ToString("0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.EngineWaterTemp:
                        displayString += RightJustify(
                            (e.TelemetryInfo.WaterTemp.Value).ToString("000"),
                            dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.EngineWaterLevelGallons:
                        displayString += RightJustify(
                            (e.TelemetryInfo.WaterLevel.Value * 0.26417).ToString("0.0"),
                            dictionarys.DisplayVariables[dv].Length + 1);
                        break;
                    case DisplayVarsEnum.EngineWaterTempFahrenheit:
                        displayString += RightJustify(
                            ((e.TelemetryInfo.WaterTemp.Value) * 9f/5f + 32).ToString("000"),
                            dictionarys.DisplayVariables[dv].Length);
                        break;
                    case DisplayVarsEnum.SessionLapsRemaining:
                        if (e.TelemetryInfo.SessionLapsRemaining != null)
                        {
                            displayString += RightJustify(
                                (e.TelemetryInfo.SessionLapsRemaining.Value).ToString("000"),
                                dictionarys.DisplayVariables[dv].Length);
                        }
                        break;
                    case DisplayVarsEnum.SessionTime:
                        if (e.TelemetryInfo.SessionTime != null)
                        {
                            var tempST = new TimeSpan(0, 0, Convert.ToInt32(e.TelemetryInfo.SessionTime.Value));
                            displayString += RightJustify(
                                String.Format("{0}-{1}.{2}", tempST.Hours.ToString("0"),
                                              tempST.Minutes.ToString("00"), tempST.Seconds.ToString("00")),
                                dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        break;
                    case DisplayVarsEnum.SessionTimeRemaining:
                        if (e.TelemetryInfo.SessionTimeRemaining != null)
                        {
                            var tempStr = new TimeSpan(0, 0,
                                                       Convert.ToInt32(e.TelemetryInfo.SessionTimeRemaining.Value));
                            displayString += RightJustify(
                                String.Format("{0}-{1}.{2}", tempStr.Hours.ToString("0"),
                                              tempStr.Minutes.ToString("00"), tempStr.Seconds.ToString("00")),
                                dictionarys.DisplayVariables[dv].Length + 1);
                        }
                        break;

                    case DisplayVarsEnum.LapsSinceLastPit:
                        displayString += e.TelemetryInfo.Lap.Value - savedTelemetry.LapLastPited;
                        break;
                }
            }
            return displayString;
        }
Exemple #3
0
 internal void ResetSavedTelemetryValues()
 {
     this.SavedTelemetry = new SavedTelemetryValues(CurrentConfiguration.OtherSettings.FuelCalculationLaps, CurrentConfiguration.OtherSettings.UseWeightedFuelCalculations, this.telemetryRefreshRate);
 }
Exemple #4
0
 public static string BuildLapDisplayString(LapDisplayStylesEnum lapstyle, SavedTelemetryValues savedTelemetry)
 {
     string displayString = "";
     switch (lapstyle)
     {
         case LapDisplayStylesEnum.LapTimeDeltaPersonal:
             if (savedTelemetry.PersonalBestLap > 1)
             {
                 displayString = String.Format(
                     "{0}{1}",
                     LapTimeParserShort(Convert.ToSingle(savedTelemetry.LastLapTimeMeasured)),
                     (savedTelemetry.LastLapTimeMeasured - savedTelemetry.PersonalBestLap).ToString(
                         " 0.00;-0.00; 0.00"));
             }
             else
             {
                 displayString = String.Format(
                     "{0}{1}",
                     LapTimeParserShort(Convert.ToSingle(savedTelemetry.LastLapTimeMeasured)),
                     "nrEF");
             }
             break;
         case LapDisplayStylesEnum.LapTimeDeltaOverall:
             if (savedTelemetry.Overallbestlap > 1)
             {
                 displayString = String.Format(
                     "{0}{1}",
                     LapTimeParserShort(Convert.ToSingle(savedTelemetry.LastLapTimeMeasured)),
                     (savedTelemetry.LastLapTimeMeasured - savedTelemetry.Overallbestlap).ToString(
                         " 0.00;-0.00; 0.00"));
             }
             else
             {
                 displayString = String.Format(
                     "{0}{1}",
                     LapTimeParserShort(Convert.ToSingle(savedTelemetry.LastLapTimeMeasured)),
                     "nrEF");
             }
             break;
         case LapDisplayStylesEnum.LapTimeDeltaClassOverall:
             if (savedTelemetry.ClassBestLap > 1)
             {
                 displayString = String.Format(
                     "{0}{1}",
                     LapTimeParserShort(Convert.ToSingle(savedTelemetry.LastLapTimeMeasured)),
                     (savedTelemetry.LastLapTimeMeasured - savedTelemetry.ClassBestLap).ToString(
                         " 0.00;-0.00; 0.00"));
             }
             else
             {
                 displayString = String.Format(
                     "{0}{1}",
                     LapTimeParserShort(Convert.ToSingle(savedTelemetry.LastLapTimeMeasured)),
                     "nrEF");
             }
             break;
         case LapDisplayStylesEnum.FullLapTime:
             displayString = String.Format(
                 "  {0}", LapTimeParser(Convert.ToSingle(savedTelemetry.LastLapTimeMeasured)));
             break;
         case LapDisplayStylesEnum.DualDeltas: //personal overall
             if (savedTelemetry.PersonalBestLap > 1 && savedTelemetry.Overallbestlap > 1)
             {
                 displayString = String.Format(
                     "{0}{1}",
                     (savedTelemetry.LastLapTimeMeasured - savedTelemetry.PersonalBestLap).ToString(
                         " 0.00;-0.00; 0.00"),
                     (savedTelemetry.LastLapTimeMeasured - savedTelemetry.Overallbestlap).ToString(
                         " 0.00;-0.00; 0.00"));
             }
             else if (savedTelemetry.PersonalBestLap > 1)
             {
                 //show only my personal delta
                 displayString = String.Format(
                     "{0}{1}",
                     (savedTelemetry.LastLapTimeMeasured - savedTelemetry.PersonalBestLap).ToString(
                         " 0.00;-0.00; 0.00"),
                     "nrEF");
             }
             else if (savedTelemetry.Overallbestlap > 1)
             {
                 // show only overall delta
                 displayString = String.Format(
                     "{0}{1}",
                     "nrEF",
                     (savedTelemetry.LastLapTimeMeasured - savedTelemetry.Overallbestlap).ToString(
                         " 0.00;-0.00; 0.00"));
             }
             break;
     }
     return displayString;
 }