Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryochan7 committed Jun 29, 2017
1 parent 484337f commit 6c21572
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
11 changes: 2 additions & 9 deletions DS4Windows/DS4Control/ControlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -668,21 +668,19 @@ protected virtual void On_Report(object sender, EventArgs e)
int flashWhenLateAt = getFlashWhenLateAt();
if (!lag[ind] && device.Latency >= flashWhenLateAt)
{
lag[ind] = true;
device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state)
{
LagFlashWarning(ind, true);
}), null);

//LagFlashWarning(ind, true);
}
else if (lag[ind] && device.Latency < flashWhenLateAt)
{
lag[ind] = false;
device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state)
{
LagFlashWarning(ind, false);
}), null);

//LagFlashWarning(ind, false);
}
}
else
Expand All @@ -705,9 +703,6 @@ protected virtual void On_Report(object sender, EventArgs e)
{
OnDeviceStatusChanged(this, ind);
}), null);

//OnDeviceStatusChanged(this, ind);

}
else if (pState.Battery != cState.Battery || device.oldCharging != device.isCharging())
{
Expand All @@ -717,8 +712,6 @@ protected virtual void On_Report(object sender, EventArgs e)
{
OnBatteryStatusChange(this, ind, tempBattery, tempCharging);
}), null);

//OnBatteryStatusChange(this, ind, cState.Battery, device.isCharging());
}

if (getEnableTouchToggle(ind))
Expand Down
19 changes: 8 additions & 11 deletions DS4Windows/DS4Library/DS4Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static bool TryParse(string value, ref DS4Color ds4color)
try
{
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; }
}
Expand Down Expand Up @@ -650,7 +650,6 @@ private void performDs4Input()
{
firstActive = DateTime.UtcNow;
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
int tempLatencyCount = 0;
long oldtime = 0;
Expand Down Expand Up @@ -765,10 +764,10 @@ private void performDs4Input()
}

if (conType == ConnectionType.BT && btInputReport[0] != 0x11)
{
//Received incorrect report, skip it
continue;
}
{
//Received incorrect report, skip it
continue;
}

utcNow = DateTime.UtcNow; // timestamp with UTC in case system time zone changes
resetHapticState();
Expand Down Expand Up @@ -865,7 +864,8 @@ private void performDs4Input()
for (int i = 0; i < inputReport.Length; i++)
Console.Write(" " + inputReport[i].ToString("x2"));
Console.WriteLine();
} */
}
*/

if (conType == ConnectionType.SONYWA)
{
Expand Down Expand Up @@ -970,13 +970,10 @@ private void performDs4Input()
{
Action tempAct = null;
for (int actInd = 0, actLen = eventQueue.Count; actInd < actLen; actInd++)
//foreach (Action tempAct in eventQueue)
{
tempAct = eventQueue.Dequeue();
tempAct.Invoke();
}

//eventQueue.Clear();
}
}

Expand Down Expand Up @@ -1293,7 +1290,7 @@ public void pushHapticState(DS4HapticState hs)
}

override
public String ToString()
public string ToString()
{
return Mac;
}
Expand Down

0 comments on commit 6c21572

Please sign in to comment.