Skip to content

Commit

Permalink
add saitek rudder and combat rudder, and invert x52 throttle axis
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjarv committed Mar 27, 2018
1 parent bd31806 commit d7c26c5
Show file tree
Hide file tree
Showing 20 changed files with 271 additions and 73 deletions.
16 changes: 13 additions & 3 deletions JoystickProxy/JoystickProxy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
using IniParser;
using IniParser.Model;
using System.Collections.Concurrent;
using System.Diagnostics;

namespace JoystickProxy
{
class Program
{
private static int FPS = 30;
private static int FrameTime;
private bool Debug = true;
private static Dictionary<string, string> SupportedDevices = new Dictionary<string, string>();
private static Dictionary<Guid, string> InstanceGuidToUsbIdLookup = new Dictionary<Guid, string>();
Expand All @@ -30,6 +33,7 @@ static void Main(string[] args)

host = IPAddress.Parse(data["Config"]["Host"]);
port = Int32.Parse(data["Config"]["Port"]);
FrameTime = 1000 / Int32.Parse(data["Config"]["FPS"]);

Console.WriteLine("JoystickProxy");
Console.WriteLine("=============");
Expand Down Expand Up @@ -84,8 +88,10 @@ public Program()

while (true)
{
foreach(Joystick joystick in connectedJoysticks.Values)
Stopwatch sw = new Stopwatch();
foreach (Joystick joystick in connectedJoysticks.Values)
{
sw.Start();
try
{
joystick.Poll();
Expand All @@ -108,8 +114,12 @@ public Program()
{}

}

Thread.Sleep(20);
sw.Stop();
int sleepTime = FrameTime - (int)sw.ElapsedMilliseconds;
if (sleepTime > 0)
{
Thread.Sleep(sleepTime);
}
}
}
catch (Exception e)
Expand Down
4 changes: 3 additions & 1 deletion JoystickProxy/JoystickProxy/settings.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[Config]
Host = 127.0.0.1
Port = 11011
FPS = 60

[Devices]
044f:0402 = Warthog Joystick
044f:0404 = Warthog Throttle
044f:b10a = T.16000M
# 06a3:0764 = Saitek Pro Combat Rudder
06a3:0763 = Saitek Rudder Pedals
06a3:0764 = Saitek Combat Rudder Pedals
068e:00f = CH Pro Pedals
231d:011f = VKB Gunfighter
046d:c215 = Logitech 3D Pro
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ void StickEvent(JoystickState state)
Model.SetActive(entry.Value == 1);
break;

case "RotationZ": // Pedal Position -0.05 0.05
LeftPedal.transform.position = new Vector3(LeftPedal.transform.position.x, LeftPedal.transform.position.y, ConvertRange(entry.Value, 0, 65535, 3, -3));
RightPedal.transform.position = new Vector3(RightPedal.transform.position.x, RightPedal.transform.position.y, ConvertRange(entry.Value, 0, 65535, -3, 3));
case "RotationZ":
LeftPedal.transform.localPosition = new Vector3(LeftPedal.transform.localPosition.x, ConvertRange(entry.Value, 0, 65535, 2.4, -2.4), LeftPedal.transform.localPosition.z);
RightPedal.transform.localPosition = new Vector3(RightPedal.transform.localPosition.x, ConvertRange(entry.Value, 0, 65535, -2.4, 2.4), RightPedal.transform.localPosition.z);
break;
case "X": // Left brake
// Rotate Z between 0 and 20
LeftPedalBrake.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 0, 20), 0, 0);
LeftPedalBrake.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 20, 0), 0, 0);
break;
case "Y": // Right brake
RightPedalBrake.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 0, 20), 0, 0);
RightPedalBrake.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 20, 0), 0, 0);
break;
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d7c26c5

Please sign in to comment.