Skip to content

Commit

Permalink
add X55 throttle
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjarv committed Mar 4, 2018
1 parent a98f3ec commit b428a14
Show file tree
Hide file tree
Showing 52 changed files with 798 additions and 26 deletions.
2 changes: 1 addition & 1 deletion JoystickProxy/JoystickProxy/settings.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Config]
Host = 127.0.0.1
Port = 11000
Port = 11011

[Devices]
044f:0402 = Warthog Joystick
Expand Down
10 changes: 10 additions & 0 deletions JoystickVisualizer/Assets/Devices/Generic Stick.meta

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.

10 changes: 10 additions & 0 deletions JoystickVisualizer/Assets/Devices/Generic Stick/Materials.meta

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.

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.

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.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class TMWarthogJoystick : MonoBehaviour {
public const string USB_ID = "044f:0402";

public Boolean ButtonIndicator = false;

public GameObject Particles;

public GameObject Model;
public GameObject StickGimbal;

Expand Down Expand Up @@ -61,15 +66,19 @@ void StickEvent(JoystickState state)

case "Buttons10":
DMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), DMS.transform.localEulerAngles.y, DMS.transform.localEulerAngles.z);
SpawnIndicator(DMS);
break;
case "Buttons11":
DMS.transform.localEulerAngles = new Vector3(DMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : -10.0f), DMS.transform.localEulerAngles.z);
SpawnIndicator(DMS);
break;
case "Buttons12":
DMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), DMS.transform.localEulerAngles.y, DMS.transform.localEulerAngles.z);
SpawnIndicator(DMS);
break;
case "Buttons13":
DMS.transform.localEulerAngles = new Vector3(DMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : 10.0f), DMS.transform.localEulerAngles.z);
SpawnIndicator(DMS);
break;

case "Buttons14":
Expand Down Expand Up @@ -103,25 +112,31 @@ void StickEvent(JoystickState state)

case "Buttons1":
Pickle.transform.localPosition = new Vector3(Pickle.transform.localPosition.x, Pickle.transform.localPosition.y, ((entry.Value == 0) ? 0.0f : 0.25f));
SpawnIndicator(Pickle);
break;

case "Buttons4":
MasterMode.transform.localPosition = new Vector3(((entry.Value == 0) ? 0.0f : -0.20f), MasterMode.transform.localPosition.y, MasterMode.transform.localPosition.z);
SpawnIndicator(MasterMode);
break;

case "Buttons2":
PinkyButton.transform.localPosition = new Vector3(PinkyButton.transform.localPosition.x, PinkyButton.transform.localPosition.y, ((entry.Value == 0) ? 0.0f : -0.20f));
SpawnIndicator(PinkyButton);
break;

case "Buttons3":
PinkyLever.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), PinkyLever.transform.localEulerAngles.y, PinkyLever.transform.localEulerAngles.z);
SpawnIndicator(PinkyLever);
break;

case "Buttons0":
Trigger.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), Trigger.transform.localEulerAngles.y, Trigger.transform.localEulerAngles.z);
SpawnIndicator(Trigger);
break;
case "Buttons5":
Trigger.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 10.0f : 20.0f), Trigger.transform.localEulerAngles.y, Trigger.transform.localEulerAngles.z);
SpawnIndicator(Trigger);
break;

case "PointOfViewControllers0":
Expand Down Expand Up @@ -160,6 +175,18 @@ void StickEvent(JoystickState state)
}
}

private void SpawnIndicator(GameObject gimbal)
{
if (ButtonIndicator)
{
GameObject indicator = Instantiate(Particles, gimbal.transform) as GameObject;
Transform parent = gimbal.GetComponentInChildren<MeshFilter>().transform;
indicator.transform.position = parent.GetComponent<Renderer>().bounds.center;
indicator.SetActive(true);
Destroy(indicator, 1);
}
}

public static float ConvertRange(
double value, // value to convert
double originalStart, double originalEnd, // original range
Expand Down
10 changes: 10 additions & 0 deletions JoystickVisualizer/Assets/Devices/Saitek X55 Throttle.meta

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

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 b428a14

Please sign in to comment.