Rev absolute encoder configurations not setting

I’m trying to use the RevAbsoluteEncoder with the absolute encoder adapter. It works perfectly, the only issue is that when setting the configuration in the subsystem constructor, the position conversion factor is not being set, as well as the zero offset. If I call these functions in, for example, the periodic function, it works.

These is my code:

  private PivotCubeSubsystem() {
    pivotEncoder = pivotMotor.getAbsoluteEncoder(Type.kDutyCycle);
    pivotEncoder.setPositionConversionFactor(IntakeConstants.pivotPositionConversionFactor);
    pivotMotor.burnFlash();
    pivotEncoder.setZeroOffset(IntakeConstants.pivotZeroOffset);
    pivotMotor.burnFlash();

    mPivotState = PivotState.HOMED;

    resetPID();
  }

Dont call burnFlash() multiple times. It’s a blocking operation on the SparkMax and will cause subsequent API calls (i.e. setZeroOffset) to fail.

Each of these calls return a RevError enum that youre currently ignoring. Try capturing it and logging out the value. You can compare that to the enum source and itll tell you what which call(s) is/are failing and why.

More specifically, api calls directly following it chronologically. Delaying after burnFlash by 200ms or so ensures that subsequent api calls are not ignored.

I prefer not adding arbitrary delays, so the best suggestion I have is to just make sure the burnFlash call is the last thing done.

Okay thanks!