GRBL 1.1h fail to home X-axis for my Ortur LM2

Hmmm.. OK - so I wrote up a piece of code (mostly borrowed from another post) which keeps moving the X-axis in the negative direction until it hits the limit switch.. and it works..

Does anyone here have experience with GRBL 1.1h :interrobang:

There is the test code:

const byte directionPin = 5; // X=5, Y=6 and Z=7
const byte stepPin = 2;      // X=2, Y=3 and Z=4
const byte limitPin = 9;     // X=9, Y=10 and Z=11
const byte enPin = 8;        // Enable Stepper
const float delayTime = 0.001;

void setup() {
   Serial.begin(115200);
   pinMode(directionPin, OUTPUT);
   pinMode(stepPin, OUTPUT);
   pinMode(enPin, OUTPUT); 
   pinMode(limitPin,INPUT_PULLUP);
   digitalWrite(enPin, LOW);
   digitalWrite(directionPin, HIGH); // Negative direction=HIGH, Positive direction=LOW
}

void loop() {
   singleStep(delayTime);  // delay in milliseconds per step
}

void singleStep(unsigned long stepInterval) {
   static unsigned long stepTimer = 0;
      int pinValue = digitalRead(limitPin);
   Serial.print("limitPin is now ");Serial.println(pinValue);
   if (millis() - stepTimer >= stepInterval)
   {
      stepTimer = millis();
      if(pinValue== HIGH) { 
          digitalWrite(stepPin, LOW);
          digitalWrite(stepPin, HIGH);
      }
   }
}