Change input delay warning status depending on connection type.

No longer use a fixed interval
This commit is contained in:
Travis Nickles 2017-04-07 08:59:15 -07:00
parent 7ae8e0deb8
commit f050df5f81
2 changed files with 12 additions and 5 deletions

View File

@ -593,7 +593,8 @@ namespace DS4Windows
// MEMS gyro data is all calibrated to roughly -1G..1G for values -0x2000..0x1fff // MEMS gyro data is all calibrated to roughly -1G..1G for values -0x2000..0x1fff
// Enough additional acceleration and we are no longer mostly measuring Earth's gravity... // Enough additional acceleration and we are no longer mostly measuring Earth's gravity...
// We should try to indicate setpoints of the calibration when exposing this measurement.... // We should try to indicate setpoints of the calibration when exposing this measurement....
if (Program.rootHub.DS4Controllers[(int)nUDSixaxis.Value - 1] == null) DS4Device ds = Program.rootHub.DS4Controllers[(int)nUDSixaxis.Value - 1];
if (ds == null)
{ {
EnableReadings(false); EnableReadings(false);
lbInputDelay.Text = Properties.Resources.InputDelay.Replace("*number*", Properties.Resources.NA); lbInputDelay.Text = Properties.Resources.InputDelay.Replace("*number*", Properties.Resources.NA);
@ -719,14 +720,15 @@ namespace DS4Windows
lbR2Track.ForeColor = Color.Black; lbR2Track.ForeColor = Color.Black;
double latency = Program.rootHub.DS4Controllers[(int)nUDSixaxis.Value - 1].Latency; double latency = ds.Latency;
int warnInterval = ds.getWarnInterval();
lbInputDelay.Text = Properties.Resources.InputDelay.Replace("*number*", latency.ToString()); lbInputDelay.Text = Properties.Resources.InputDelay.Replace("*number*", latency.ToString());
if (latency > 10) if (latency > warnInterval)
{ {
lbInputDelay.BackColor = Color.Red; lbInputDelay.BackColor = Color.Red;
lbInputDelay.ForeColor = Color.White; lbInputDelay.ForeColor = Color.White;
} }
else if (latency > 5) else if (latency > (warnInterval / 2))
{ {
lbInputDelay.BackColor = Color.Yellow; lbInputDelay.BackColor = Color.Yellow;
lbInputDelay.ForeColor = Color.Black; lbInputDelay.ForeColor = Color.Black;

View File

@ -87,7 +87,7 @@ namespace DS4Windows
public override string ToString() => $"Red: {red} Green: {green} Blue: {blue}"; public override string ToString() => $"Red: {red} Green: {green} Blue: {blue}";
} }
public enum ConnectionType : byte { BT, USB, SONYWA }; // Prioritize Bluetooth when both BT and USB are connected. public enum ConnectionType : byte { BT, SONYWA, USB }; // Prioritize Bluetooth when both BT and USB are connected.
/** /**
* The haptics engine uses a stack of these states representing the light bar and rumble motor settings. * The haptics engine uses a stack of these states representing the light bar and rumble motor settings.
@ -145,6 +145,11 @@ namespace DS4Windows
private bool charging; private bool charging;
private bool outputRumble = false; private bool outputRumble = false;
private int warnInterval = WARN_INTERVAL_USB; private int warnInterval = WARN_INTERVAL_USB;
public int getWarnInterval()
{
return warnInterval;
}
private bool exitOutputThread = false; private bool exitOutputThread = false;
private object exitLocker = new object(); private object exitLocker = new object();
public event EventHandler<EventArgs> Report = null; public event EventHandler<EventArgs> Report = null;