 #define DESIREDRPM_TABLE    60      //desired RPM on output wheel
 //#define DESIREDRPM_MOTOR    600     //desired motor RPM (this may be superfulous) 
 #define DISCSLIPCOUNT       250     //How long alarm cond before alarm signal
-#define LOCKEDDISCRPM       10      //RPM to consider as "disc stopped"
-#define ROTATIONVARIANCE    50      //Variance in RPM before alarm condition 
+#define LOCKEDDISCRPM       20     //RPM to consider as "disc stopped"
+#define ROTATIONVARIANCE    2      //Variance in RPM before alarm condition 
 //#define TRANSMISSIONRATIO   10      //Tranmission drive ratio n:1
-#define NUMBEROFRESTARTS    5      //#of restarts attempted after stopped state
+#define NUMBEROFRESTARTS    3     //#of restarts attempted after stopped state
 #define STARTTIME           10000   //Expected ramp up time, in MS
 #define STOPTIME            10000   //Expected ramp down time, in MS
  /////////

}    

void discSlipCheck(){
    if (rpm < (DESIREDRPM_TABLE - ROTATIONVARIANCE)){
        discSlipPrecond++;
        }
    else
        if (discSlipPrecond > 0){
        discSlipPrecond--;
        }
    if (discSlipPrecond > DISCSLIPCOUNT){

/**************************************/
void sensorPulseCount(){
pulseCount++;
// expected two pulse counts per rotation, two sensors 
}

void calculateRPM(){
if (millis() - prevMillis >= 5000){
	Serial.println("CalculatingRPM");
    detachInterrupt(HALLSENSORPIN);              //disable interrupts while running calculate
    rpm = pulseCount * 6;          //converting frequency to RPM(two magnets on disc x 5 sec)
    pulseCount = 0;                 //reset pulse counter
    prevMillis = millis();          //update prevMillis
    Serial.print("RPM: ");
    Serial.println(rpm);
    attachInterrupt(digitalPinToInterrupt(HALLSENSORPIN), sensorPulseCount, FALLING);
    }
  }

void motionControlStart(){
    if (restartCount < NUMBEROFRESTARTS){
	    Serial.println("Motor Control Start");
		digitalWrite(STARTRELAYPIN, HIGH); // enable start relay if not above fail counter
        delay(3000); // wait for 3 second for a rotation 
        if (pulseCount == 0){               // if no rotation detected in interrupt
            digitalWrite(STARTRELAYPIN, LOW); // turn off motor becuase of no rotation
            restartCount++;
            delay (10000); // delay 10 seconds before attempting restart
            pulseCount = 0; // reset pulse count 
            motionControlStart();
            }
        if (pulseCount > 1){
        Serial.println("motion started, system running");
        restartCount = 0; // set restart counter to 0, since we're started
        allStopVar = 0; // Set allstop condition to off 
		Serial.print("AllStopVar ");
