Sensor Fusion Accel, Gyro, Magnetometer

Hi Gang!

I am working on a project with the LSM6DS33 and the LIS3MDL.

For my project I will get the roll, pitch and yaw.

So I used the complementary filter for the roll and pitch and I got perfect data after combining of Accel and Gyro.

My problem is the yaw. I didn´t find the "perfect" information about that.
I used also the compl. filter and combined the Gyro yaw and the Magnetometer Yaw:
yaw = (0.75)(yaw + GyroYaw * dt) + (0.25)(MagYaw);

I can say it works, but my problem is, if I roll, the yaw will also change the values. After checking the raw values of the Magnetometer, I think it comes from it.
I need only changings of the yaw, if I do the yaw :wink:

What can I do?

Greetings