Fixes for Quick Charge mode

Resolves issue #19.
This commit is contained in:
Travis Nickles 2017-04-22 07:49:01 -07:00
parent ecb271cfb1
commit 3e4a5c0562
4 changed files with 22 additions and 10 deletions

View File

@ -216,7 +216,7 @@ namespace DS4Windows
if (showlog)
LogDebug(Properties.Resources.StoppedDS4Windows);
ControllerStatusChanged(this);
ControllerStatusChanged(this);
}
return true;
}
@ -231,6 +231,13 @@ namespace DS4Windows
for (int i = 0, devlen = devices.Count(); i < devlen; i++)
{
DS4Device device = devices.ElementAt<DS4Device>(i);
if (QuickCharge && device?.getConnectionType() == ConnectionType.BT && (bool)device?.isCharging())
{
device.DisconnectBT();
continue;
}
if (device.isDisconnectingStatus())
continue;
@ -278,6 +285,7 @@ namespace DS4Windows
}
}
}
return true;
}

View File

@ -1572,7 +1572,7 @@ namespace DS4Windows
ConnectionType deviceConn = d.getConnectionType();
if (deviceConn == ConnectionType.BT)
{
d.DisconnectBT();
d.DisconnectBT(false);
}
//foreach (DS4Controls dc in action.trigger)

View File

@ -877,11 +877,6 @@ namespace DS4Windows
{
Pads[Index].Text = Program.rootHub.getDS4MacAddress(Index);
DS4Device d = Program.rootHub.DS4Controllers[Index];
if (QuickCharge && d?.getConnectionType() == ConnectionType.BT && (bool)d?.isCharging())
{
d.DisconnectBT();
return;
}
switch (Program.rootHub.getDS4Status(Index))
{

View File

@ -410,6 +410,7 @@ namespace DS4Windows
Console.WriteLine(e.Message);
}
}
StopOutputUpdate();
}
@ -705,7 +706,7 @@ namespace DS4Windows
{
if (conType == ConnectionType.BT)
{
if (DisconnectBT())
if (DisconnectBT(false))
return; // all done
}
else if (conType == ConnectionType.SONYWA)
@ -814,7 +815,7 @@ namespace DS4Windows
}
}
public bool DisconnectBT()
public bool DisconnectBT(bool allThreadsQuit = true)
{
if (Mac != null)
{
@ -851,7 +852,15 @@ namespace DS4Windows
if(success)
{
IsDisconnecting = true;
StopOutputUpdate();
if (allThreadsQuit)
{
StopUpdate();
}
else
{
StopOutputUpdate();
}
if (Removal != null)
Removal(this, EventArgs.Empty);
}