"I tested it by tilting the plane so that the APM and Compass were at 45 degrees pitch up, then do "Calibrate Level". Then I tested tilting the plane pitch up further, and I expect the compass heading to flip 180 deg when the compass is 45 degrees on…"
1. You have the compass (and APM) on an angle when the plane is level.2. You do the accelerometer level calibration in MissionPlanner.The accelerometer is zeroed in to this new flat level, but what about the compass?