Skip to content

Commit

Permalink
properly reinitialized iRSDK every loop iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesClonk committed Nov 10, 2018
1 parent 04ee1d2 commit cc860de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions iR60TelemetryProvider/iR60TelemetryProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed class iR60TelemetryProvider : AbstractTelemetryProvider
public iR60TelemetryProvider() : base()
{
Author = "JamesClonk";
Version = "v1.0-rc.6";
Version = "v1.0-rc.7";
BannerImage = @"img\banner_iracing.png"; // Image shown on top of the profiles tab
IconImage = @"img\iracing.jpg"; // Icon used in the tree view for the profile
TelemetryUpdateFrequency = 60; // the update frequency in samples per second
Expand Down Expand Up @@ -111,13 +111,15 @@ private void Run()
{
try
{
sdk.Startup();

// check if the SDK is connected
if (sdk.IsConnected())
{
IsConnected = true;

// check if car is on track and if we got new data
if ((bool)sdk.GetData("IsOnTrack") && _lastSessionTick != (int)sdk.GetData("SessionTick"))
if ((bool)sdk.GetData("IsOnTrack") &&_lastSessionTick != (int)sdk.GetData("SessionTick"))
{
IsRunning = true;
_lastSessionTick = (int)sdk.GetData("SessionTick");
Expand All @@ -132,11 +134,14 @@ private void Run()
IsRunning = false;
}
}
else
{
sdk.Startup();
else if (sdk.IsInitialized) {
sdk.Shutdown();

IsConnected = false;
IsRunning = false;
_lastSessionTick = -1;

Thread.Sleep(1000);
}
Thread.Sleep(SamplePeriod);
}
Expand All @@ -149,10 +154,10 @@ private void Run()
}
}

sdk.Shutdown();

IsConnected = false;
IsRunning = false;

sdk.Shutdown();
}

}
Expand Down
2 changes: 1 addition & 1 deletion iracing_60hz_iRacing_-_60hz_testing.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<Profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Active="false" Name="iRacing - 60hz testing" TelemetryProvider="iracing_60hz" OverallSmoothnessEnabled="false" OverallSmoothness="0.3" overallIntensity="1" acceleration="60" minSpeed="64704" maxSpeed="65304">
<author>JamesClonk</author>
<version>v1.0-rc.6</version>
<version>v1.0-rc.7</version>
<info>Test profile for iRacing 60hz telemetry.
Right click on the profile name (left) and copy.
Activate your copy and get started!
Expand Down

0 comments on commit cc860de

Please sign in to comment.