Commit 96c3ca94 authored by nanthony21's avatar nanthony21

Sensitivity of axis increases and deadband increases. This fixes an issue...

Sensitivity of axis increases and deadband increases. This fixes an issue where the maximum percent output from an axis would be 100% - percentDeadband.
parent 4c34fb38
......@@ -339,13 +339,16 @@ float Joystick::_adjustRange(int value, Calibration_t calibration, bool withDead
axisLength = calibration.center - calibration.min;
}
float axisPercent;
if (withDeadbands) {
if (valueNormalized>calibration.deadband) valueNormalized-=calibration.deadband;
else if (valueNormalized<-calibration.deadband) valueNormalized+=calibration.deadband;
else valueNormalized = 0.f;
if (valueNormalized>calibration.deadband) axisPercent = (valueNormalized - calibration.deadband) / (axisLength - calibration.deadband);
else if (valueNormalized<-calibration.deadband) axisPercent = (valueNormalized + calibration.deadband) / (axisLength - calibration.deadband);
else axisPercent = 0.f;
}
else {
axisPercent = valueNormalized / axisLength;
}
float axisPercent = valueNormalized / axisLength;
float correctedValue = axisBasis * axisPercent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment