Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip deadzone option on tilt #12756

Merged
merged 2 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ static ConfigSetting controlSettings[] = {
ConfigSetting("TiltSensitivityX", &g_Config.iTiltSensitivityX, 100, true, true),
ConfigSetting("TiltSensitivityY", &g_Config.iTiltSensitivityY, 100, true, true),
ConfigSetting("DeadzoneRadius", &g_Config.fDeadzoneRadius, 0.2f, true, true),
ConfigSetting("TiltDeadzoneSkip", &g_Config.fTiltDeadzoneSkip, 0.0f, true, true),
ConfigSetting("TiltInputType", &g_Config.iTiltInputType, 0, true, true),
#endif

Expand Down
2 changes: 2 additions & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ struct Config {
int iTiltSensitivityY;
//the deadzone radius of the tilt
float fDeadzoneRadius;
// deadzone skip
float fTiltDeadzoneSkip;
//type of tilt input currently selected: Defined in TiltEventProcessor.h
//0 - no tilt, 1 - analog stick, 2 - D-Pad, 3 - Action Buttons (Tri, Cross, Square, Circle)
int iTiltInputType;
Expand Down
1 change: 1 addition & 0 deletions UI/TiltAnalogSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ void TiltAnalogSettingsScreen::CreateViews() {
settings->Add(new PopupSliderChoice(&g_Config.iTiltSensitivityX, 0, 100, co->T("Tilt Sensitivity along X axis"), screenManager(),"%"));
settings->Add(new PopupSliderChoice(&g_Config.iTiltSensitivityY, 0, 100, co->T("Tilt Sensitivity along Y axis"), screenManager(),"%"));
settings->Add(new PopupSliderChoiceFloat(&g_Config.fDeadzoneRadius, 0.0, 1.0, co->T("Deadzone Radius"), 0.01f, screenManager(),"/ 1.0"));
settings->Add(new PopupSliderChoiceFloat(&g_Config.fTiltDeadzoneSkip, 0.0, 1.0, co->T("Tilt Base Radius"), 0.01f, screenManager(),"/ 1.0"));

settings->Add(new ItemHeader(co->T("Calibration")));
InfoItem *calibrationInfo = new InfoItem(co->T("To Calibrate", "To calibrate, keep device on a flat surface and press calibrate."), "");
Expand Down
4 changes: 2 additions & 2 deletions UI/TiltEventProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ inline float tiltInputCurve (float x, float deadzone, float sensitivity) {
const float factor = sensitivity * 1.0f / (1.0f - deadzone);

if (x > deadzone) {
return (x - deadzone) * factor * factor;
return (x + g_Config.fTiltDeadzoneSkip - deadzone) * factor * factor;
} else if (x < -deadzone) {
return (x + deadzone) * factor * factor;
return (x - g_Config.fTiltDeadzoneSkip + deadzone) * factor * factor;
} else {
return 0.0f;
}
Expand Down