Skip to content

Commit

Permalink
Added deadzone to close #8
Browse files Browse the repository at this point in the history
Xbox One sync button now takes a capture
  • Loading branch information
cathery committed Nov 5, 2019
1 parent 4d498a2 commit f041918
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions ControllerUSB/include/Controllers/Dualshock3Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ class Dualshock3Controller : public IController

Dualshock3ButtonData m_buttonData;

int8_t kLeftThumbDeadzone = 0;
int8_t kRightThumbDeadzone = 0;
int8_t kLeftThumbDeadzone = 10;
int8_t kRightThumbDeadzone = 10;
int8_t kTriggerMax = 0;
int8_t kTriggerDeadzone = 0;

Expand Down
8 changes: 4 additions & 4 deletions ControllerUSB/include/Controllers/Dualshock4Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class Dualshock4Controller : public IController

Dualshock4ButtonData m_buttonData;

int16_t kLeftThumbDeadzone = 0; //7849;
int16_t kRightThumbDeadzone = 0; //8689;
uint16_t kTriggerMax = 0; //1023;
uint16_t kTriggerDeadzone = 0; //120;
int16_t kLeftThumbDeadzone = 2000; //7849;
int16_t kRightThumbDeadzone = 2000; //8689;
uint16_t kTriggerMax = 0; //1023;
uint16_t kTriggerDeadzone = 0; //120;

public:
Dualshock4Controller(std::unique_ptr<IUSBDevice> &&interface);
Expand Down
8 changes: 4 additions & 4 deletions ControllerUSB/include/Controllers/Xbox360Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class Xbox360Controller : public IController

Xbox360ButtonData m_buttonData;

int16_t kLeftThumbDeadzone = 0; //7849;
int16_t kRightThumbDeadzone = 0; //8689;
uint16_t kTriggerMax = 0; //1023;
uint16_t kTriggerDeadzone = 0; //120;
int16_t kLeftThumbDeadzone = 8000; //7849;
int16_t kRightThumbDeadzone = 8000; //8689;
uint16_t kTriggerMax = 0; //1023;
uint16_t kTriggerDeadzone = 0; //120;

public:
Xbox360Controller(std::unique_ptr<IUSBDevice> &&interface);
Expand Down
11 changes: 6 additions & 5 deletions ControllerUSB/include/Controllers/XboxOneController.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ class XboxOneController : public IController
IUSBEndpoint *m_outPipe = nullptr;

XboxOneButtonData m_buttonData;
bool m_GuidePressed;

int16_t kLeftThumbDeadzone = 0; //7849;
int16_t kRightThumbDeadzone = 0; //8689;
uint16_t kTriggerMax = 0; //1023;
uint16_t kTriggerDeadzone = 0; //120;
int16_t kLeftThumbDeadzone = 2500; //7849;
int16_t kRightThumbDeadzone = 3500; //8689;
uint16_t kTriggerMax = 0; //1023;
uint16_t kTriggerDeadzone = 0; //120;
uint8_t m_rumbleDataCounter = 0;

public:
Expand All @@ -109,5 +110,5 @@ class XboxOneController : public IController

Status SendInitBytes();
Status WriteAckGuideReport(uint8_t sequence);
Status SetRumble(uint8_t strong_magnitude,uint8_t weak_magnitude);
Status SetRumble(uint8_t strong_magnitude, uint8_t weak_magnitude);
};
6 changes: 3 additions & 3 deletions ControllerUSB/source/Controllers/XboxOneController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Status XboxOneController::GetInput()
}
else if (type == XBONEINPUT_GUIDEBUTTON) //Guide button status
{
m_buttonData.sync = input_bytes[4];
m_GuidePressed = input_bytes[4];

//Xbox one S needs to be sent an ack report for guide buttons
//TODO: needs testing
Expand Down Expand Up @@ -188,10 +188,10 @@ NormalizedButtonData XboxOneController::GetNormalizedButtonData()
normalData.left_stick_click = m_buttonData.stick_left_click;
normalData.right_stick_click = m_buttonData.stick_right_click;

normalData.capture = false;
normalData.capture = m_buttonData.sync;
normalData.home = false;

normalData.guide = m_buttonData.sync;
normalData.guide = m_GuidePressed;

normalData.left_trigger = NormalizeTrigger(m_buttonData.trigger_left);
normalData.right_trigger = NormalizeTrigger(m_buttonData.trigger_right);
Expand Down

0 comments on commit f041918

Please sign in to comment.