If you didn't implement those GetOrientation functions correctly as stated above you're getting data from other than expected orientation and that's why the result is NAN - NotANumber. The code example I wrote you above is valid for IKS01A3 but if yo...
First problem was that your timers should be switched, TIMER2 have to support Capture Compare functionality and you have the timer with this functionality (TIM1) in TIMER1 (I understand that it was logical choice to use TIM1 as TIMER1 but...).Second ...
I'm glad you finally calibrated successfully. After disconnecting power you need to calibrate it again otherwise you should implement storage of your calibration parameters and reload it after powerup but since magnetic field can change it's always b...
Aha, ok, so please send me your datalog with rotation around all 3 axes and I'll simulate it here to see if the problem is in your data or in your code. Again I really suggest to compare your code with MagnetometerCalibration application code in late...