 #include "Secrets.h"
 
 //////
-#define DESIREDRPM_TABLE    60      //desired RPM on output wheel
+//#define DESIREDRPM_TABLE    60      //desired RPM on output wheel
 #define DESIREDRPM_MOTOR    600     //desired motor RPM (this may be superfulous) 
-#define ALARMTIME           3000    //How long alarm cond before alarm signal
+#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 TRANSMISSIONRATIO   10      //Tranmission drive ratio n:1
-#define NUMBEROFRESTARTS    10      //#of restarts attempted after stopped state
+//#define TRANSMISSIONRATIO   10      //Tranmission drive ratio n:1
+#define NUMBEROFRESTARTS    5      //#of restarts attempted after stopped state
 #define STARTTIME           10000   //Expected ramp up time, in MS
 #define STOPTIME            10000   //Expected ramp down time, in MS
  /////////
 #define STARTRELAYPIN       1      //pin locations
-#define HALLSENSORPIN      5       //hall sensor to detect rotaion
+#define HALLSENSORPIN       5       //hall sensor to detect rotaion
 #define SECONDS             1000    //ms in seconds 
 
 WiFiClient espClient;

//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
