diff --git a/src/main/java/competition/subsystems/arm/ArmSubsystem.java b/src/main/java/competition/subsystems/arm/ArmSubsystem.java index 81c892c0..e0791cdf 100644 --- a/src/main/java/competition/subsystems/arm/ArmSubsystem.java +++ b/src/main/java/competition/subsystems/arm/ArmSubsystem.java @@ -369,17 +369,16 @@ public void armEncoderTicksUpdate() { } - // Update the offset of the arm when it touches either forward/reverse limit switches for the first time. + // Update the offset of the arm when it touches reverse limit switches for the first time. + // Both arms calibrate independently public void calibrateArmOffset() { - // For now keeping the concept of left/right having independent calibration, - // but for simplicity, hitting either limit will calibrate both for now. - if ((!hasCalibratedLeft || !hasCalibratedRight) - && (getLimitState(armMotorLeft) == LimitState.LOWER_LIMIT_HIT - || getLimitState(armMotorRight) == LimitState.LOWER_LIMIT_HIT)) - { + if (!hasCalibratedLeft && getLimitState(armMotorLeft) == LimitState.LOWER_LIMIT_HIT) { hasCalibratedLeft = true; - hasCalibratedRight = true; armMotorLeftRevolutionOffset = -armMotorLeft.getPosition(); + } + + if (!hasCalibratedRight && getLimitState(armMotorRight) == LimitState.LOWER_LIMIT_HIT) { + hasCalibratedRight = true; armMotorRightRevolutionOffset = -armMotorRight.getPosition(); } }