I'll see if I simplify the maths down. The for loop should be easy but the printf's may be a different issue.
So on the firmware side: If we want to get it out of China region 5.2.5 is the last working firmware? Also if, like me, we've upgraded to 5.4.5 that'll probably explode if we do any...