 /*            GLOBAL VARS              /
 /**************************************/
 
-uint16_t hallSensor1_count  = 0 ;
-uint16_t hallSensor2_count  = 0 ;
-volatile uint8_t pulseCount = 0 ;
-uint8_t rpm                 = 0 ;
-unsigned long timeOld       = 0 ;
+uint16_t hallSensor1_count  = 0;
+uint16_t hallSensor2_count  = 0;
+volatile uint8_t pulseCount = 0;
+uint8_t rpm                 = 0;
+unsigned long timeOld       = 0;
 //
-unsigned long now = 0 ;
-unsigned long prevMillis = 0 ;
-unsigned long OTAUntilMillis = 0 ;
+unsigned long now           = 0;
+unsigned long prevMillis    = 0;
+unsigned long OTAUntilMillis = 0;
+uint8_t discSlipPrecond    = 0;
+uint8_t restartCount        = 0;
 char msg[50];                   
 
 /**************************************/
 /*               SETUP                 /
 /**************************************/
-void setup()
-{
+void setup(){
 pinMode(STARTRELAYPIN, OUTPUT);
-pinMode(HALLSENSOR1PIN, INPUT);
+pinMode(HALLSENSORPIN, INPUT);
 attachInterrupt(digitalPinToInterrupt(HALLSENSORPIN), sensorPulseCount, RISING);
-
 client.setServer(mqtt_server, 1883);
 client.setCallback(callback);
 }

//current rotation value 00
//if rotation doesn't stop, report error

void discSlipCheck()
{// check disc for slip condition
//if below certain rotatation for x seconds, motiionControlStop

}

    }
  }

void motionControlStart(){
    if (restartCount < NUMBEROFRESTARTS){
        digitalWrite(STARTRELAYPIN, HIGH); // enable start relay if not above fail counter
        delay(2000); // wait for 2 second for a rotation 
        if (pulseCount > 1){               // if no rotation detected in interrupt
            digitalWrite(STARTRELAYPIN, LOW); // turn off motor becuase of no rotation
            restartCount++;
            delay (2000); // delay 2 seconds before attempting restart
            pulseCount = 0; // reset pulse count 
            motionControlStart();
            }
        else {
        restartCount = 0; // set restart counter to 0, since we're started
        }
    }    
    if (restartCount >= NUMBEROFRESTARTS) {
        //MQTT "Disc Start / Restart Failed ---- SYSTEM HALTED"
        allStop();   
    }
}

void motiionControlStop(){}
//disable start relay
