Merge branch 'mika-n-jay' into jay

This commit is contained in:
Travis Nickles 2019-02-28 03:33:45 -06:00
commit 3e5035b3e8
3 changed files with 83 additions and 20 deletions

View File

@ -3811,7 +3811,7 @@ namespace DS4Windows
controller.wheelCircleCenterPointLeft.X = controller.wheelCenterPoint.X;
controller.wheelCircleCenterPointLeft.Y = controller.wheel90DegPointLeft.Y;
AppLogger.LogToGui($"Controller {ctrl.x360Bus.FirstController + device} steering wheel emulation calibration values. center=({controller.wheelCenterPoint.X}, {controller.wheelCenterPoint.Y}) 90L=({controller.wheel90DegPointLeft.X}, {controller.wheel90DegPointLeft.Y}) 90R=({controller.wheel90DegPointRight.X}, {controller.wheel90DegPointRight.Y})", false);
AppLogger.LogToGui($"Controller {ctrl.x360Bus.FirstController + device} steering wheel emulation calibration values. Center=({controller.wheelCenterPoint.X}, {controller.wheelCenterPoint.Y}) 90L=({controller.wheel90DegPointLeft.X}, {controller.wheel90DegPointLeft.Y}) 90R=({controller.wheel90DegPointRight.X}, {controller.wheel90DegPointRight.Y}) Range={Global.GetSASteeringWheelEmulationRange(device)}", false);
controller.wheelPrevRecalibrateTime = DateTime.Now;
}
@ -3824,41 +3824,53 @@ namespace DS4Windows
// Apply deadzone (SA X-deadzone value). This code assumes that 20deg is the max deadzone anyone ever might wanna use (in practice effective deadzone
// is probably just few degrees by using SXDeadZone values 0.01...0.05)
double sxDead = getSXDeadzone(device);
if (sxDead > 0 && result != 0 && Math.Abs(result) < (20.0 * C_WHEEL_ANGLE_PRECISION * sxDead))
if (sxDead > 0)
{
result = 0;
int sxDeadInt = Convert.ToInt32(20.0 * C_WHEEL_ANGLE_PRECISION * sxDead);
if (Math.Abs(result) <= sxDeadInt)
{
result = 0;
}
else
{
// Smooth steering angle based on deadzone range instead of just clipping the deadzone gap
result -= (result < 0 ? -sxDeadInt : sxDeadInt);
}
}
// If wrapped around from +180 to -180 side (or vice versa) then SA steering wheel keeps on turning beyond 360 degrees (if range is >360)
// If wrapped around from +180 to -180 side (or vice versa) then SA steering wheel keeps on turning beyond 360 degrees (if range is >360).
// Keep track of how many times the steering wheel has been turned beyond the full 360 circle and clip the result to max range.
int wheelFullTurnCount = controller.wheelFullTurnCount;
if (controller.wheelPrevPhysicalAngle < 0 && result > 0)
{
if ((result - controller.wheelPrevPhysicalAngle) > 180 * C_WHEEL_ANGLE_PRECISION)
if (maxRangeRight > 360 * C_WHEEL_ANGLE_PRECISION)
{
if (maxRangeRight > 360/2 * C_WHEEL_ANGLE_PRECISION)
wheelFullTurnCount--;
else
result = maxRangeLeft;
}
}
else if (controller.wheelPrevPhysicalAngle > 0 && result < 0)
{
if ((controller.wheelPrevPhysicalAngle - result) > 180 * C_WHEEL_ANGLE_PRECISION)
if (maxRangeRight > 360 * C_WHEEL_ANGLE_PRECISION)
{
if (maxRangeRight > 360/2 * C_WHEEL_ANGLE_PRECISION)
wheelFullTurnCount++;
else
result = maxRangeRight;
}
}
controller.wheelPrevPhysicalAngle = result;
if (wheelFullTurnCount != 0)
{
if (wheelFullTurnCount > 0)
result = (wheelFullTurnCount * 180 * C_WHEEL_ANGLE_PRECISION) + ((wheelFullTurnCount * 180 * C_WHEEL_ANGLE_PRECISION) + result);
else
result = (wheelFullTurnCount * 180 * C_WHEEL_ANGLE_PRECISION) - ((wheelFullTurnCount * -180 * C_WHEEL_ANGLE_PRECISION) - result);
// Adjust value of result (steering wheel angle) based on num of full 360 turn counts
result += (wheelFullTurnCount * 180 * C_WHEEL_ANGLE_PRECISION * 2);
}
// If the new angle is more than 180 degrees further away then this is probably bogus value (controller shaking too much and gyro and velocity sensors went crazy).
// Accept the new angle only when the new angle is within a "stability threshold", otherwise use the previous full angle value.
// Accept the new angle only when the new angle is within a "stability threshold", otherwise use the previous full angle value and wait for controller to be stabilized.
if (Math.Abs(result - controller.wheelPrevFullAngle) <= 180 * C_WHEEL_ANGLE_PRECISION)
{
controller.wheelPrevFullAngle = result;

View File

@ -1630,7 +1630,7 @@ namespace DS4Windows.Properties {
/// <summary>
/// Looks up a localized string similar to Calibration of sixaxis wheel emulation.
/// </summary>
internal static string SASteeringWheelEmulationCalibrate {
public static string SASteeringWheelEmulationCalibrate {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrate", resourceCulture);
}
@ -1639,7 +1639,7 @@ namespace DS4Windows.Properties {
/// <summary>
/// Looks up a localized string similar to All calibraton points are set when lightbar color turns to green. While turning the controller the lightbar color flashes when the controller is at calibration point. Accept calibration with OK button.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateInstruction {
public static string SASteeringWheelEmulationCalibrateInstruction {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateInstruction", resourceCulture);
}
@ -1648,7 +1648,7 @@ namespace DS4Windows.Properties {
/// <summary>
/// Looks up a localized string similar to (1) Center the controller, hold it steady and press &quot;X&quot;.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateInstruction1 {
public static string SASteeringWheelEmulationCalibrateInstruction1 {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateInstruction1", resourceCulture);
}
@ -1657,7 +1657,7 @@ namespace DS4Windows.Properties {
/// <summary>
/// Looks up a localized string similar to (2) Turn to 90° left (or right) position and press &quot;X&quot;.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateInstruction2 {
public static string SASteeringWheelEmulationCalibrateInstruction2 {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateInstruction2", resourceCulture);
}
@ -1666,7 +1666,7 @@ namespace DS4Windows.Properties {
/// <summary>
/// Looks up a localized string similar to (3) Turn to 90° right (or left) position and press &quot;X&quot;.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateInstruction3 {
public static string SASteeringWheelEmulationCalibrateInstruction3 {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateInstruction3", resourceCulture);
}
@ -1675,7 +1675,7 @@ namespace DS4Windows.Properties {
/// <summary>
/// Looks up a localized string similar to Cannot calibrate gyro (sixaxis) steering wheel emulation values without a controller. Connect a controller via bluetooth or usb.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateNoControllerError {
public static string SASteeringWheelEmulationCalibrateNoControllerError {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateNoControllerError", resourceCulture);
}
@ -1684,7 +1684,7 @@ namespace DS4Windows.Properties {
/// <summary>
/// Looks up a localized string similar to Gyro steering wheel emulation axis option is set to NONE (emulation is not used). Please select an axis option before calibrating the sixaxis gyro steering wheel emulation.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateNoneAxisError {
public static string SASteeringWheelEmulationCalibrateNoneAxisError {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateNoneAxisError", resourceCulture);
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
@ -549,4 +549,55 @@
<data name="XMLFiles" xml:space="preserve">
<value>XML-tiedostot (*xml)</value>
</data>
<data name="BTPollRate" xml:space="preserve">
<value>Määrittelee DS4 laitteen tietojen luentatiheyden BT yhteystavassa</value>
</data>
<data name="CloseConfirm" xml:space="preserve">
<value>Tämä toiminto sulkee yhteyden kaikkiin ohjaimiin. Suorita toiminto?</value>
</data>
<data name="Confirm" xml:space="preserve">
<value>Vahvista...</value>
</data>
<data name="GyroTriggerBehavior" xml:space="preserve">
<value>Valitse valinta jolloin kytkimen painallus aktivoi gyro toiminnon. Poista valinta jolloin kytkimen painallus poistaa gyro toiminnon.</value>
</data>
<data name="LanguagePackApplyRestartRequired" xml:space="preserve">
<value>Kielivalinta tulee voimaan kun DS4Windows sovellus käynnistetään seuraavan kerran uudelleen.</value>
</data>
<data name="MacroRecorded" xml:space="preserve">
<value>Makro tallennettu.</value>
</data>
<data name="MultiAction" xml:space="preserve">
<value>Monitoiminappi</value>
</data>
<data name="RunAtStartup" xml:space="preserve">
<value>Määrittää Windowsin käynnistämään DS4Windows sovelluksen kirjautumisen yhteydessä</value>
</data>
<data name="SelectMacro" xml:space="preserve">
<value>Valitse makro</value>
</data>
<data name="SASteeringWheelEmulationCalibrate" xml:space="preserve">
<value>Sixaxis rattitoiminnon kalibrointi</value>
</data>
<data name="SASteeringWheelEmulationCalibrateInstruction1" xml:space="preserve">
<value>(1) Keskitä ohjain vaakatasoon, pidä ohjain vakaana ja paina "X"</value>
</data>
<data name="SASteeringWheelEmulationCalibrateInstruction2" xml:space="preserve">
<value>(2) Kallista ohjainta 90° vasemmalle (tai oikealle) keskikohdasta ja paina "X"</value>
</data>
<data name="SASteeringWheelEmulationCalibrateInstruction3" xml:space="preserve">
<value>(3) Kallista ohjainta 90° oikealle (tai vasemmalle) keskikohdasta ja paina "X"</value>
</data>
<data name="SASteeringWheelEmulationCalibrateInstruction" xml:space="preserve">
<value>Kaikki kolme kalibrointipistettä on asetettu kun valopalkin väri on muuttunut vihreäksi. Ohjaimen kallistelun aikana valopalkki vilkkuu kun ohjain on kallistettu kalibrointipisteen kohdalle. Hyväksy kalibrointi OK napilla.</value>
</data>
<data name="SASteeringWheelEmulationCalibrateNoControllerError" xml:space="preserve">
<value>Rattiohjainemuloinnin sixaxis kallistusantureita ei voi kalibroida ilman ohjainta. Kytke ohjain joko bluetooth tai usb yhteydellä</value>
</data>
<data name="SASteeringWheelEmulationCalibrateNoneAxisError" xml:space="preserve">
<value>Gyro rattiohjainemuloinnin käyttöakseli on asetettu NONE (ei käytössä) valinnalle. Valitse jokin muu valintavaihtoehto ennen sixaxis rattiohjainemuloinnin kalibrointia</value>
</data>
<data name="UACTask" xml:space="preserve">
<value>DS4Windows sovellus pitää käynnistää järjestelmävalvojan oikeuksilla tämän toiminnon käyttämiseksi.</value>
</data>
</root>