I have an Adafruit feather sense that I'm trying to code to get direction from according to the LIS3MDL magnetometer inside of it however rotating around the up-down axis it refuses to give an accurate response. Turning the chip around the different horizontal axis' seems to give me the full range of rotations but I need it to work around any axis. Ive tried it with other peoples code around but can only find it specific to the LIS3MDL rather than the feather sense and theres has the same effect as well. I'm new to this sort of thing so let me know if I need to explain something better or even if it's worth putting the question somewhere else. It is worth noting that I'm using Ardiuno code and also that I am in fact calibrating (as far as I can tell) using the Adafruit_Sensor_Calibration.h header.
float get_angle(vec3 vector) {
return atan2(vector.y, vector.x) * (180 / PI);
}