Compass freezing when moved fast

So my compass has been working fine throughout my changes to perfect it although recently it shows the readings continuously until i rotate the compass fast or if I flick it the readings will freeze and not show any new ones. I’ll add my code but I don’t know if you guys have time to understand it all and what not. Is the arduino just not able to keep up with the speed and i need a delay? Idk. Thanks for the help

#include <Wire.h>
#include <LSM303.h>
#include <Servo.h>
#include <Average.h>

LSM303 compass;
Servo Steering;
Servo motor;
int targetHeading = 0;
#define SteeringNeutral 95  
//const long interval = 5000;           // interval at which to blink (milliseconds)
int currentHeading;             // where we are actually facing now
int headingError;  // signed (+/-) difference between targetHeading and currentHeading 
int triggerCount1;
int triggerCount2;
int triggerCount3;
int smoothCompass;


void setup() {
  Serial.begin(9600);
  Wire.begin();
  compass.init();
  compass.enableDefault();
  Steering.attach(10);
  motor.attach(9);
  compass.m_min = (LSM303::vector<int16_t>){-840, -534, -744};
  compass.m_max = (LSM303::vector<int16_t>){+419, +727, +363};
  int smoothCompass = 0;
  motor.writeMicroseconds(1245);
  delay(3000);
  motor.writeMicroseconds(1400);
  



}

void loop() {
  currentHeading = readCompass();
  calcDesiredTurn();
   
 /*unsigned long currentMillis = millis();
if (currentMillis  >= interval) {
motor.writeMicroseconds(1245);
}*/
}



int readCompass(void){
compass.read();
  int heading = compass.heading();

if(heading - smoothCompass > 5) triggerCount1++;
    else
    triggerCount1 = 0;
 if(heading - smoothCompass < -5) triggerCount2++;
    else
    triggerCount2 = 0;

if(triggerCount1 >= 5 && heading - smoothCompass < 180)
smoothCompass += 3;
if(triggerCount1 >= 5 && heading - smoothCompass > 180)
smoothCompass -= 3;
if(triggerCount2 >= 5 && heading - smoothCompass > -180)
smoothCompass -= 3;
if(triggerCount2 >= 5 && heading - smoothCompass < -180)
smoothCompass += 3;

if(smoothCompass < 0)
smoothCompass = smoothCompass + 360;
if(smoothCompass > 360)
smoothCompass = smoothCompass - 360;
  Serial.println(smoothCompass);
int currentHeading = smoothCompass;
 return ((int)currentHeading);
}





void calcDesiredTurn(void){
int headingError = currentHeading - targetHeading;
  if (headingError > 180)
  {
    headingError = headingError - 360;  // for angles > 180, correct in the opposite direction.
  }
if(abs(headingError) > 15) triggerCount3++;
else
triggerCount3 = 0;

if(triggerCount3 > 10) 
Steering.write(SteeringNeutral + headingError / 3);
else
Steering.write(95);


  
}

Have you ruled out mechanical issues with the connection to the compass board?

Yeah I ruled that out. That’s what I thought the problem was initially and made sure all the wires were properly connected and they were and the problem persisted