예제 #1
0
        // Event handler called when the telemetry is updated
        private void wrapper_TelemetryUpdated(object sender, SdkWrapper.TelemetryUpdatedEventArgs e)
        {
            if (connection.isOpen())
            {
                dataPacket data = new dataPacket(console);
                data.fetch(e.TelemetryInfo, wrapper.Sdk, fuelEst, chkBrake.Checked ? brk.getBrakeVibe(e.TelemetryInfo, trkTol.Value, trkSens.Value) : 0,
                           sendTimeReset, sendTime, prevFuel);
                connection.send(data.compile(this.cboSpdUnit.SelectedIndex == 0, this.trkIntensity.Value));
                sendTime      = false;
                sendTimeReset = false;

                float ll = Convert.ToSingle(wrapper.Sdk.GetData("LapLastLapTime"));

                if (ll != prevLapTime)
                {
                    if (prevFuel != 0 && ll > 0)
                    {
                        sendTime    = true;
                        prevLapTime = ll;
                    }
                }

                if (e.TelemetryInfo.Lap.Value > prevLap)
                {
                    sendTimeReset = true;
                    estimateFuel(e.TelemetryInfo);
                    prevLap = e.TelemetryInfo.Lap.Value;
                }

                if (wrapper.GetTelemetryValue <Boolean[]>("CarIdxOnPitRoad").Value[driverID])
                {
                    prevFuel = 0;
                }
            }

            if (ticker % 5 == 0)
            {
                printTelemInfo(e.TelemetryInfo);
                ticker += 1;
            }

            if (ticker == 40)
            {
                ticker = 0;
            }
            else
            {
                ticker += 1;
            }
        }
예제 #2
0
        // Event handler called when the telemetry is updated
        private void wrapper_TelemetryUpdated(object sender, SdkWrapper.TelemetryUpdatedEventArgs e)
        {
            try
            {
                if (connection.isOpen())
                {
                    if (!connection.isFake())
                    {
                        dataPacket data = new dataPacket(console);
                        data.fetch(e.TelemetryInfo, wrapper.Sdk, fuelEst, sendTimeReset, sendTime, prevFuel);
                        connection.send(data.compile(this.cboSpdUnit.SelectedIndex == 0, this.trkIntensity.Value));

                        sendTime      = false;
                        sendTimeReset = false;

                        float ll = Convert.ToSingle(wrapper.Sdk.GetData("LapLastLapTime"));

                        if (ll != prevLapTime)
                        {
                            if (prevFuel != 0 && ll > 0)
                            {
                                sendTime    = true;
                                prevLapTime = ll;
                            }
                        }
                    }


                    if (e.TelemetryInfo.Lap.Value > prevLap)
                    {
                        estimateFuel(e.TelemetryInfo);
                        prevLap       = e.TelemetryInfo.Lap.Value;
                        sendTimeReset = true;
                    }

                    if (wrapper.GetTelemetryValue <Boolean[]>("CarIdxOnPitRoad").Value[driverID])
                    {
                        prevFuel = 0;
                    }
                }

                if (ticker % 5 == 0)
                {
                    printTelemInfo(e.TelemetryInfo);
                    ticker += 1;
                }

                if (ticker == 40)
                {
                    ticker = 0;
                }
                else
                {
                    ticker += 1;
                }
            }
            catch (Exception exe)
            {
                ExceptionHelper.writeToLogFile(exe.Message, exe.ToString(), "Update Arduino", exe.LineNumber(), this.FindForm().Name);
            }
        }
        // Event handler called when the telemetry is updated
        private void wrapper_TelemetryUpdated(object sender, SdkWrapper.TelemetryUpdatedEventArgs e)
        {
            try
            {
                if (connection.isOpen())
                {
                    if (!connection.isFake())
                    {
                        dataPacket data = new dataPacket(console);
                        data.fetch(e.TelemetryInfo, wrapper.Sdk, fuelEst, sendTimeReset, sendTime, prevFuel);
                        connection.send(data.compile(this.cboSpdUnit.SelectedIndex == 0, this.trkIntensity.Value));

                        sendTime = false;
                        sendTimeReset = false;

                        float ll = Convert.ToSingle(wrapper.Sdk.GetData("LapLastLapTime"));

                        if (ll != prevLapTime)
                        {
                            if (prevFuel != 0 && ll > 0)
                            {
                                sendTime = true;
                                prevLapTime = ll;
                            }
                        }
                    }

                    if (e.TelemetryInfo.Lap.Value > prevLap)
                    {
                        estimateFuel(e.TelemetryInfo);
                        prevLap = e.TelemetryInfo.Lap.Value;
                        sendTimeReset = true;
                    }

                    if (wrapper.GetTelemetryValue<Boolean[]>("CarIdxOnPitRoad").Value[driverID])
                        prevFuel = 0;
                }

                if (ticker % 5 == 0)
                {
                    printTelemInfo(e.TelemetryInfo);
                    ticker += 1;
                }

                if (ticker == 40)
                {
                    ticker = 0;
                }
                else
                    ticker += 1;
            }
            catch (Exception exe)
            {
                ExceptionHelper.writeToLogFile(exe.Message, exe.ToString(), "Update Arduino", exe.LineNumber(), this.FindForm().Name);
            }
        }
예제 #4
0
        // Event handler called when the telemetry is updated
        private void wrapper_TelemetryUpdated(object sender, SdkWrapper.TelemetryUpdatedEventArgs e)
        {
            if (connection.isOpen())
            {
                dataPacket data = new dataPacket(console);
                data.fetch(e.TelemetryInfo, wrapper.Sdk, fuelEst, chkBrake.Checked ? brk.getBrakeVibe(e.TelemetryInfo, trkTol.Value, trkSens.Value) : 0,
                    sendTimeReset, sendTime, prevFuel);
                connection.send(data.compile(this.cboSpdUnit.SelectedIndex == 0, this.trkIntensity.Value));
                sendTime = false;
                sendTimeReset = false;

                float ll = Convert.ToSingle(wrapper.Sdk.GetData("LapLastLapTime"));

                if (ll != prevLapTime)
                {
                    if (prevFuel != 0 && ll > 0)
                    {
                        sendTime = true;
                        prevLapTime = ll;
                    }
                }

                if (e.TelemetryInfo.Lap.Value > prevLap)
                {
                    sendTimeReset = true;
                    estimateFuel(e.TelemetryInfo);
                    prevLap = e.TelemetryInfo.Lap.Value;
                }

                if (wrapper.GetTelemetryValue<Boolean[]>("CarIdxOnPitRoad").Value[driverID])
                    prevFuel = 0;
            }

            if (ticker % 5 == 0)
            {
                printTelemInfo(e.TelemetryInfo);
                ticker += 1;
            }

            if (ticker == 40)
            {
                ticker = 0;
            }
            else
                ticker += 1;
        }