Skip to content

Commit

Permalink
Cleanup Coderabbit thick finger incident.
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperH2O committed Dec 19, 2023
1 parent da79fbb commit 70983fa
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions HandheldCompanion/Controllers/LegionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ private enum BackEnum
private const byte PING_IDX = 40;
private HashSet<int> READY_STATES = new HashSet<int>() {25, 60};

private const byte MIN_WIRELESS_STATUS = 40;
private const byte MAX_WIRELESS_STATUS = 50;

private Thread dataThread;
private bool dataThreadRunning;

Expand All @@ -56,22 +59,13 @@ public override bool IsReady
return READY_STATES.Contains(status);
}
}
private const byte MIN_WIRELESS_STATUS = 40;
private const byte MAX_WIRELESS_STATUS = 50;

public bool IsWireless
{
get
{
return (status >= MIN_WIRELESS_STATUS && status <= MAX_WIRELESS_STATUS);
}
}
public bool IsWireless
{
get
{
byte status = GetStatus(PING_IDX);
return (status >= 40 && status <= 50);
byte status = GetStatus(PING_IDX);
return (status >= MIN_WIRELESS_STATUS && status <= MAX_WIRELESS_STATUS);
}
}

Expand Down Expand Up @@ -245,12 +239,9 @@ private async void dataThreadLoop(object? obj)
if (hidDevice is null)
continue;

HidReport report = hidDevice.ReadReport();
internal void SetPassthrough(bool enabled)
{
SetTouchPadStatus(enabled ? 1 : 0);
IsPassthrough = enabled;
}
HidReport report = hidDevice.ReadReport();

if (report is not null)
{
// check if packet is safe
if (READY_STATES.Contains(report.Data[STATUS_IDX]))
Expand Down Expand Up @@ -384,17 +375,9 @@ public void HandleTouchpadInput(bool touched, ushort x, ushort y)

internal void SetPassthrough(bool enabled)
{
switch(enabled)
{
case true:
SetTouchPadStatus(1);
break;
case false:
SetTouchPadStatus(0);
break;
}

SetTouchPadStatus(enabled ? 1 : 0);
IsPassthrough = enabled;
}

}
}

0 comments on commit 70983fa

Please sign in to comment.