OK ... so it's still a mystery why you end up with a disagreement between IMUYaw & magYaw up to 70 degrees ... that's enough to cause what you experienced. And it's also a mystery why the IMUYaw un-noted by all other sensors turns to align with magYaw for a short period & then goes back to disagree with 70 degrees.
As the forums wisest ( @sar104 ) tried to tech me not long ago ... it can also be that something on the Mini itself have been magnetized ... either some gadget attached to the drone or that it have been stored near some magnetic (standing on top of a loud speaker, or in a trunk of a car for instance). If we look at the magnetic field during the flight (magMod) it changes dramatically ... in line with how the Mini pitches, this can if I understood sar104 correctly indicate just that. But again it doesn't explain the IMUYaw movement ... think we have to wait for sar104 to chime in & give us som clarity
View attachment 103457
I'm pretty sure that this is either a compass problem or a rate gyro problem, and not a simple case of magnetic interference at startup. The key here, I think, is to compare the magnetic yaw, IMU yaw, and the yaw computed purely from the rate gyros (not in the log file - you have to derive it from the quaternions). That shows the following:
After initialization the values diverge as the aircraft is moved and placed on the ground. That's inconclusive in terms of cause. After takeoff, note that the FC sees the discrepancy and increases the magnetomter data weighting in the sensor fusion algorithm to converge the IMU yaw with the magnetic yaw. That's not a real rotation though, as seen from the inertial solution.
At around 30 seconds the aircraft starts moving and the FC appears to have new code (relative to previous firmware) that detects that the yaw is inconsistent with the aircraft attitude and direction of motion, and applies an abrupt second correction to fix the IMU yaw.
So how do we determine whether it is the compass or the rate gyros that are wrong? After takeoff the changes in yaw as recorded by the rate gyros and the compass broadly agree - they just have different starting values. If the aircraft was pointing at the sunset at takeoff (sunset was at 320° which is -40° yaw) then the inertial yaw (-41°) is correct and the IMU yaw (-91°) is wrong. Also, the FC IMU yaw correction at 30 seconds indicates that the magnetic yaw was inconsistent with the aircraft movement. Those two observations suggest that the compass was reading incorrectly in flight, which suggests that it requires calibration and, possibly, that the aircraft has become magnetized.
The magnetic modulus is not way out of spec, but it has more variation than normal:
A definitive test would be to take off with the aircraft carefully aligned pointing north (or any other known direction) and then rotate the aircraft through several rotations CW and CCW. The resulting DAT file should contain plenty of data with which to diagnose any problems.