When I had a compass on my mower, I always used the the Compass Learn feature. It is described here: Advanced Compass Setup — Rover documentation (ardupilot.org).
Bullet 5 describes the method I used to trigger it. I set a channel switch on my remote to option 62 on the tuning page which allows me to flip the switch when I have my vehicle in manual and out in the open ready to “learn”. I have the Messages tab open in Mission Planner. When you flip the switch on (you can flip it right back off), it triggers the learning mode. Drive your vehicle around in crazy patterns and circles until you see the “Compass Learned: Finished” message.
I see that this method is not recommended but that is what I always did and it worked well for me.
The original introduction of this feature was introduced and discussed here: Testers needed for in-flight compass learning - Blog - ArduPilot Discourse