Skip to content

Conversation

@chihirobelmo
Copy link
Contributor

#14

image

AxisValueProgress.Foreground = CommonConstants.LIGHTRED;
check_ABIDLE.Visibility = Visibility.Visible;
check_ABIDLE.Content = "IDLE CUTOFF";
if (Math.Abs(AxisValueProgress.Value) < CommonConstants.AXISMAX * 0.5 - CommonConstants.AXIS_NEUTRAL_TOLERANCE |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This compound-if seems needlessly confusing, to me. (Why are we taking Abs of the AxisValueProgress.. can it ever be negative? And what is up with the bitwise-OR vs logical OR..?)

Taking Abs of the distance from center, is what I would normally expect to see..

float axisCenter = CommonConstants.AXISMAX * 0.5;

if (Math.Abs(AxisValueProgress.Value-axisCenter) > CommonConstants.AXIS_NEUTRAL_TOLERANCE) { ...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually what might be better.. is we modify the ApplyDeadZone() function above, to return a bool indicating if the axis in the deadzone or not. (Or maybe a separate method, "IsInDeadZone" or something. Haven't looked closely at it.)

Then, this indicator would be naturally dynamic.. no need for CommonConstants.AXIS_NEUTRAL_TOLERANCE

And it would serve to help people set appropriate deadzone size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants