Minor changes

This commit is contained in:
Travis Nickles 2017-06-29 06:16:02 -07:00
parent 484337f42f
commit 6c21572249
2 changed files with 10 additions and 20 deletions

View File

@ -668,21 +668,19 @@ namespace DS4Windows
int flashWhenLateAt = getFlashWhenLateAt(); int flashWhenLateAt = getFlashWhenLateAt();
if (!lag[ind] && device.Latency >= flashWhenLateAt) if (!lag[ind] && device.Latency >= flashWhenLateAt)
{ {
lag[ind] = true;
device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state) device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state)
{ {
LagFlashWarning(ind, true); LagFlashWarning(ind, true);
}), null); }), null);
//LagFlashWarning(ind, true);
} }
else if (lag[ind] && device.Latency < flashWhenLateAt) else if (lag[ind] && device.Latency < flashWhenLateAt)
{ {
lag[ind] = false;
device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state) device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state)
{ {
LagFlashWarning(ind, false); LagFlashWarning(ind, false);
}), null); }), null);
//LagFlashWarning(ind, false);
} }
} }
else else
@ -705,9 +703,6 @@ namespace DS4Windows
{ {
OnDeviceStatusChanged(this, ind); OnDeviceStatusChanged(this, ind);
}), null); }), null);
//OnDeviceStatusChanged(this, ind);
} }
else if (pState.Battery != cState.Battery || device.oldCharging != device.isCharging()) else if (pState.Battery != cState.Battery || device.oldCharging != device.isCharging())
{ {
@ -717,8 +712,6 @@ namespace DS4Windows
{ {
OnBatteryStatusChange(this, ind, tempBattery, tempCharging); OnBatteryStatusChange(this, ind, tempBattery, tempCharging);
}), null); }), null);
//OnBatteryStatusChange(this, ind, cState.Battery, device.isCharging());
} }
if (getEnableTouchToggle(ind)) if (getEnableTouchToggle(ind))

View File

@ -77,7 +77,7 @@ namespace DS4Windows
try try
{ {
string[] ss = value.Split(','); string[] ss = value.Split(',');
return byte.TryParse(ss[0], out ds4color.red) &&byte.TryParse(ss[1], out ds4color.green) && byte.TryParse(ss[2], out ds4color.blue); return byte.TryParse(ss[0], out ds4color.red) && byte.TryParse(ss[1], out ds4color.green) && byte.TryParse(ss[2], out ds4color.blue);
} }
catch { return false; } catch { return false; }
} }
@ -650,7 +650,6 @@ namespace DS4Windows
{ {
firstActive = DateTime.UtcNow; firstActive = DateTime.UtcNow;
NativeMethods.HidD_SetNumInputBuffers(hDevice.safeReadHandle.DangerousGetHandle(), 2); NativeMethods.HidD_SetNumInputBuffers(hDevice.safeReadHandle.DangerousGetHandle(), 2);
//List<long> latencyList = new List<long>(51); // Set capacity at max + 1 to avoid any list resizing
Queue<long> latencyQueue = new Queue<long>(51); // Set capacity at max + 1 to avoid any resizing Queue<long> latencyQueue = new Queue<long>(51); // Set capacity at max + 1 to avoid any resizing
int tempLatencyCount = 0; int tempLatencyCount = 0;
long oldtime = 0; long oldtime = 0;
@ -765,10 +764,10 @@ namespace DS4Windows
} }
if (conType == ConnectionType.BT && btInputReport[0] != 0x11) if (conType == ConnectionType.BT && btInputReport[0] != 0x11)
{ {
//Received incorrect report, skip it //Received incorrect report, skip it
continue; continue;
} }
utcNow = DateTime.UtcNow; // timestamp with UTC in case system time zone changes utcNow = DateTime.UtcNow; // timestamp with UTC in case system time zone changes
resetHapticState(); resetHapticState();
@ -865,7 +864,8 @@ namespace DS4Windows
for (int i = 0; i < inputReport.Length; i++) for (int i = 0; i < inputReport.Length; i++)
Console.Write(" " + inputReport[i].ToString("x2")); Console.Write(" " + inputReport[i].ToString("x2"));
Console.WriteLine(); Console.WriteLine();
} */ }
*/
if (conType == ConnectionType.SONYWA) if (conType == ConnectionType.SONYWA)
{ {
@ -970,13 +970,10 @@ namespace DS4Windows
{ {
Action tempAct = null; Action tempAct = null;
for (int actInd = 0, actLen = eventQueue.Count; actInd < actLen; actInd++) for (int actInd = 0, actLen = eventQueue.Count; actInd < actLen; actInd++)
//foreach (Action tempAct in eventQueue)
{ {
tempAct = eventQueue.Dequeue(); tempAct = eventQueue.Dequeue();
tempAct.Invoke(); tempAct.Invoke();
} }
//eventQueue.Clear();
} }
} }
@ -1293,7 +1290,7 @@ namespace DS4Windows
} }
override override
public String ToString() public string ToString()
{ {
return Mac; return Mac;
} }