MCPcopy Create free account
hub / github.com/cathery/sys-con / NormalizeTrigger

Method NormalizeTrigger

source/ControllerLib/Controllers/XboxOneController.cpp:209–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209float XboxOneController::NormalizeTrigger(uint8_t deadzonePercent, uint16_t value)
210{
211 uint16_t deadzone = (TRIGGER_MAXVALUE * deadzonePercent) / 100;
212 //If the given value is below the trigger zone, save the calc and return 0, otherwise adjust the value to the deadzone
213 return value < deadzone
214 ? 0
215 : static_cast<float>(value - deadzone) / (TRIGGER_MAXVALUE - deadzone);
216}
217
218void XboxOneController::NormalizeAxis(int16_t x,
219 int16_t y,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected