I started trying to figure out the axes properly yesterday; I thought I had it figured out already, but I started reading the Freescale Semi application note that the library I'm trying to use claims to be based upon & it uses the 'NED' (North, East , Down) convention which is different to what I had assumed.

It looks like I need to invert the Y & Z axes of the magnetometer & the X axis of the accelerometer but I'm not sure how to do so - it can't be as simple as putting a minus sign in front?

The accelerometer produces readings between about 265 for -1g & 405 for +1g. So if an axis is the wrong way round it reads 265 for +1g & 405 for -1g. If I simply put a minus sign in front then it will read -265 for +1g & -405 for -1g, which means that +1g is now a bigger number than -1g which is fine.

However atan2(405,346) doesn't give the same result as atan2(-265,346) so the minus sign approach won't work. Will I have to map the axis to the correct scale or something?

Edit: turns out map() should work fine;

Note that the "lower bounds" of either range may be larger or smaller than the "upper bounds" so the map() function may be used to reverse a range of numbers,

http://arduino.cc/en/Reference/map

Edit: Even with the axes all appropriately inverted or not in accordance with the 'NED' convention, it still doesn't work at all

This is completely stalling my project :`(