I think there is a small bug in the find_pole_pairs_example.ino.
Can you try to change the while loop to:
while(motor_angle <= pp_search_angle){
motor_angle += 0.01;
encoder.getAngle(); // <- ADD THIS LINE
motor.setPhaseVoltage(pp_search_voltage, motor_angle);
}
What I believe was happening was that because nothing was calling encode.getAngle() then the encoder doesn’t get a chance to notice a 'rollover) (where 4096 goes back to zero). I found that sometimes you get lucky, sometimes you don’t. But if you add the getAngle() in the loop, its good.