Detect a 360 turn using ICM/MPU

I want to detect a 360 degree turn using ICM or MPU (currently have MPU 9250 and iCM 20948). I've two main ideas on the top of my head. I can use the AHRS algorithm to calculate the yaw or can sum up the (absolute) readings from the gyroscope.

I've tested a few AHRS example sketches from github but as soon as I change the axis the angles are not accurate. Any ideas on how to do this would be helpful.

I think the MPU 9250 has a 3-axis magnetometer

see MPU-9250 Hookup Guide - learn.sparkfun.com for magnetic north

then probably can be used to detect and track change

Using a working AHRS (several on Github for the MPU-9250 do not), the yaw angle will do exactly what you want, but only if you take the time to calibrate the magnetometer properly.

Did you do that?