Skip to content

Commit

Permalink
add virpil mongoos t50 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjarv committed May 11, 2018
1 parent 68aee20 commit cfe148f
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 1 deletion.
3 changes: 2 additions & 1 deletion JoystickProxyWin/Joystick Proxy/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
0738:2215 = Saitek X55 Joystick
06a3:0c2d = Saitek Pro Flight Throttle Quadrant
06a3:2541 = Saitek X45 HOTAS (2541)
06a3:053c = Saitek X45 HOTAS (053c)
06a3:053c = Saitek X45 HOTAS (053c)
03eb:2043 = Virpil Mongoos T-50
8 changes: 8 additions & 0 deletions JoystickVisualizer/Assets/Devices/Virpil Mongoos T-50.meta

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
@@ -0,0 +1,59 @@
using Assets;
using System.Collections.Generic;
using UnityEngine;

public class VirpilMongoosT50 : MonoBehaviour {
public const string USB_ID = "03eb:2043";
//public const string USB_ID = "044f:0402";

public GameObject Model;
public GameObject Joystick;

// Use this for initialization
void Start()
{
UDPListener.StickEventListener += StickEvent;
}

// Update is called once per frame
void Update()
{
}

void StickEvent(JoystickState state)
{
if (state.UsbID != USB_ID)
{
return;
}

Model.SetActive(true);

foreach (KeyValuePair<string, int> entry in state.Data)
{
switch (entry.Key)
{
case "Connected":
if (Model.activeInHierarchy)
Model.SetActive(entry.Value == 1);
break;

case "X":
Joystick.transform.localEulerAngles = new Vector3(Joystick.transform.localEulerAngles.x, Joystick.transform.localEulerAngles.y, ConvertRange(entry.Value, 0, 65535, -20, 20));
break;
case "Y":
Joystick.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, -20, 20), Joystick.transform.localEulerAngles.y, Joystick.transform.localEulerAngles.z);
break;
}
}
}

public static float ConvertRange(
double value, // value to convert
double originalStart, double originalEnd, // original range
double newStart, double newEnd) // desired range
{
double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);
return (float)(newStart + ((value - originalStart) * scale));
}
}

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

Binary file modified JoystickVisualizer/Assets/JoystickVisualizer.unity
Binary file not shown.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ This software will read buttons and axis input from supported devices and visual
* Thrustmaster Warthog Throttle
* Thrustmaster T.Flight Rudder
* Thrustmaster T16000M
* Thrustmaster T.Flight HOTAS X (Using Warthog 3D model)
* VKB Gunfighter (Using Warthog 3D model)
* Virpil Mongoos T-50 (Using Warthog 3D model)

If you want to get in contact with me hop on my [Discord](https://discord.gg/4nc3XtQ) server and say hello or tweet me [@papapiishu](https://twitter.com/papapiishu)

Expand Down

0 comments on commit cfe148f

Please sign in to comment.