Error code for axis timeout
parent
796810a0c0
commit
c0c69e6086
|
@ -28,6 +28,10 @@
|
|||
const char COMM_REPORT_HOMED_Y[4] = { 'R', '1', '2', '\0' };
|
||||
const char COMM_REPORT_HOMED_Z[4] = { 'R', '1', '3', '\0' };
|
||||
|
||||
const char COMM_REPORT_TIMEOUT_X[4] = { 'R', '7', '1', '\0' };
|
||||
const char COMM_REPORT_TIMEOUT_Y[4] = { 'R', '7', '2', '\0' };
|
||||
const char COMM_REPORT_TIMEOUT_Z[4] = { 'R', '7', '3', '\0' };
|
||||
|
||||
const char COMM_REPORT_ENCODER_SCALED[4] = { 'R', '8', '4', '\0' };
|
||||
const char COMM_REPORT_ENCODER_RAW[4] = { 'R', '8', '5', '\0' };
|
||||
|
||||
|
@ -118,6 +122,11 @@
|
|||
const long MOVEMENT_MAX_SPD_Y_DEFAULT = 400;
|
||||
const long MOVEMENT_MAX_SPD_Z_DEFAULT = 400;
|
||||
|
||||
// switch the end contacts from NO to NC
|
||||
const long MOVEMENT_INVERT_2_ENDPOINTS_X_DEFAULT = 0;
|
||||
const long MOVEMENT_INVERT_2_ENDPOINTS_Y_DEFAULT = 0;
|
||||
const long MOVEMENT_INVERT_2_ENDPOINTS_Z_DEFAULT = 0;
|
||||
|
||||
// Stop at the home position or continue to other size of axis
|
||||
const long MOVEMENT_STOP_AT_HOME_X_DEFAULT = 0;
|
||||
const long MOVEMENT_STOP_AT_HOME_Y_DEFAULT = 0;
|
||||
|
|
|
@ -410,6 +410,16 @@ void ParameterList::loadDefaultValue(int id)
|
|||
paramValues[id] = MOVEMENT_MAX_SPD_Z_DEFAULT;
|
||||
break;
|
||||
|
||||
case MOVEMENT_INVERT_2_ENDPOINTS_X:
|
||||
paramValues[id] = MOVEMENT_INVERT_2_ENDPOINTS_X_DEFAULT;
|
||||
break;
|
||||
case MOVEMENT_INVERT_2_ENDPOINTS_Y:
|
||||
paramValues[id] = MOVEMENT_INVERT_2_ENDPOINTS_Y_DEFAULT;
|
||||
break;
|
||||
case MOVEMENT_INVERT_2_ENDPOINTS_Z:
|
||||
paramValues[id] = MOVEMENT_INVERT_2_ENDPOINTS_Z_DEFAULT;
|
||||
break;
|
||||
|
||||
case MOVEMENT_STOP_AT_MAX_X:
|
||||
paramValues[id] = MOVEMENT_STOP_AT_MAX_X_DEFAULT;
|
||||
break;
|
||||
|
|
|
@ -76,6 +76,11 @@ enum ParamListEnum
|
|||
MOVEMENT_MAX_SPD_Y = 72,
|
||||
MOVEMENT_MAX_SPD_Z = 73,
|
||||
|
||||
// switch the end contacts from NO to NC
|
||||
MOVEMENT_INVERT_2_ENDPOINTS_X = 75,
|
||||
MOVEMENT_INVERT_2_ENDPOINTS_Y = 76,
|
||||
MOVEMENT_INVERT_2_ENDPOINTS_Z = 77,
|
||||
|
||||
// encoder settings
|
||||
ENCODER_ENABLED_X = 101,
|
||||
ENCODER_ENABLED_Y = 102,
|
||||
|
|
|
@ -534,18 +534,24 @@ int StepperControl::moveToCoords(double xDestScaled, double yDestScaled, double
|
|||
// Check timeouts
|
||||
if (axisActive[0] == true && ((millis() >= timeStart && millis() - timeStart > timeOut[0] * 1000) || (millis() < timeStart && millis() > timeOut[0] * 1000)))
|
||||
{
|
||||
serialBuffer += COMM_REPORT_TIMEOUT_X;
|
||||
serialBuffer += "\r\n";
|
||||
serialBuffer += "R99 timeout X axis\r\n";
|
||||
//Serial.print("R99 timeout X axis\r\n");
|
||||
error = 1;
|
||||
}
|
||||
if (axisActive[1] == true && ((millis() >= timeStart && millis() - timeStart > timeOut[0] * 1000) || (millis() < timeStart && millis() > timeOut[0] * 1000)))
|
||||
{
|
||||
serialBuffer += COMM_REPORT_TIMEOUT_Y;
|
||||
serialBuffer += "\r\n";
|
||||
serialBuffer += "R99 timeout Y axis\r\n";
|
||||
//Serial.print("R99 timeout Y axis\r\n");
|
||||
error = 1;
|
||||
}
|
||||
if (axisActive[2] == true && ((millis() >= timeStart && millis() - timeStart > timeOut[0] * 1000) || (millis() < timeStart && millis() > timeOut[0] * 1000)))
|
||||
{
|
||||
serialBuffer += COMM_REPORT_TIMEOUT_Z;
|
||||
serialBuffer += "\r\n";
|
||||
serialBuffer += "R99 timeout Z axis\r\n";
|
||||
//Serial.print("R99 timeout Z axis\r\n");
|
||||
error = 1;
|
||||
|
@ -1223,6 +1229,10 @@ void StepperControl::loadMotorSettings()
|
|||
endStInv[1] = ParameterList::getInstance()->getValue(MOVEMENT_INVERT_ENDPOINTS_Y);
|
||||
endStInv[2] = ParameterList::getInstance()->getValue(MOVEMENT_INVERT_ENDPOINTS_Z);
|
||||
|
||||
endStInv2[0] = ParameterList::getInstance()->getValue(MOVEMENT_INVERT_2_ENDPOINTS_X);
|
||||
endStInv2[1] = ParameterList::getInstance()->getValue(MOVEMENT_INVERT_2_ENDPOINTS_Y);
|
||||
endStInv2[2] = ParameterList::getInstance()->getValue(MOVEMENT_INVERT_2_ENDPOINTS_Z);
|
||||
|
||||
endStEnbl[0] = intToBool(ParameterList::getInstance()->getValue(MOVEMENT_ENABLE_ENDPOINTS_X));
|
||||
endStEnbl[1] = intToBool(ParameterList::getInstance()->getValue(MOVEMENT_ENABLE_ENDPOINTS_Y));
|
||||
endStEnbl[2] = intToBool(ParameterList::getInstance()->getValue(MOVEMENT_ENABLE_ENDPOINTS_Z));
|
||||
|
@ -1276,9 +1286,9 @@ void StepperControl::loadMotorSettings()
|
|||
|
||||
CurrentState::getInstance()->setStepsPerMm(stepsPerMm[0], stepsPerMm[1], stepsPerMm[2]);
|
||||
|
||||
axisX.loadMotorSettings(speedMax[0], speedMin[0], speedHome[0], stepsAcc[0], timeOut[0], homeIsUp[0], motorInv[0], endStInv[0], MOVEMENT_INTERRUPT_SPEED, motor2Enbl[0], motor2Inv[0], endStEnbl[0], motorStopAtHome[0], motorMaxSize[0], motorStopAtMax[0]);
|
||||
axisY.loadMotorSettings(speedMax[1], speedMin[1], speedHome[1], stepsAcc[1], timeOut[1], homeIsUp[1], motorInv[1], endStInv[1], MOVEMENT_INTERRUPT_SPEED, motor2Enbl[1], motor2Inv[1], endStEnbl[1], motorStopAtHome[1], motorMaxSize[1], motorStopAtMax[1]);
|
||||
axisZ.loadMotorSettings(speedMax[2], speedMin[2], speedHome[2], stepsAcc[2], timeOut[2], homeIsUp[2], motorInv[2], endStInv[2], MOVEMENT_INTERRUPT_SPEED, motor2Enbl[2], motor2Inv[2], endStEnbl[2], motorStopAtHome[2], motorMaxSize[2], motorStopAtMax[2]);
|
||||
axisX.loadMotorSettings(speedMax[0], speedMin[0], speedHome[0], stepsAcc[0], timeOut[0], homeIsUp[0], motorInv[0], endStInv[0], endStInv2[0], MOVEMENT_INTERRUPT_SPEED, motor2Enbl[0], motor2Inv[0], endStEnbl[0], motorStopAtHome[0], motorMaxSize[0], motorStopAtMax[0]);
|
||||
axisY.loadMotorSettings(speedMax[1], speedMin[1], speedHome[1], stepsAcc[1], timeOut[1], homeIsUp[1], motorInv[1], endStInv[1], endStInv2[1], MOVEMENT_INTERRUPT_SPEED, motor2Enbl[1], motor2Inv[1], endStEnbl[1], motorStopAtHome[1], motorMaxSize[1], motorStopAtMax[1]);
|
||||
axisZ.loadMotorSettings(speedMax[2], speedMin[2], speedHome[2], stepsAcc[2], timeOut[2], homeIsUp[2], motorInv[2], endStInv[2], endStInv2[2], MOVEMENT_INTERRUPT_SPEED, motor2Enbl[2], motor2Inv[2], endStEnbl[2], motorStopAtHome[2], motorMaxSize[2], motorStopAtMax[2]);
|
||||
|
||||
primeMotors();
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ private:
|
|||
bool motor2Enbl[3] = { false, false, false };
|
||||
bool motorStopAtHome[3] = { false, false, false };
|
||||
bool endStInv[3] = { false, false, false };
|
||||
bool endStInv2[3] = { false, false, false };
|
||||
bool endStEnbl[3] = { false, false, false };
|
||||
long timeOut[3] = { 0, 0, 0 };
|
||||
long stepsPerMm[3] = { 1.0, 1.0, 1.0 };
|
||||
|
|
|
@ -397,7 +397,7 @@ void StepperControlAxis::StepperControlAxis::loadPinNumbers(int step, int dir, i
|
|||
|
||||
void StepperControlAxis::loadMotorSettings(
|
||||
long speedMax, long speedMin, long speedHome, long stepsAcc, long timeOut, bool homeIsUp, bool motorInv,
|
||||
bool endStInv, long interruptSpeed, bool motor2Enbl, bool motor2Inv, bool endStEnbl,
|
||||
bool endStInv, bool endStInv2, long interruptSpeed, bool motor2Enbl, bool motor2Inv, bool endStEnbl,
|
||||
bool stopAtHome, long maxSize, bool stopAtMax)
|
||||
{
|
||||
|
||||
|
@ -409,6 +409,7 @@ void StepperControlAxis::loadMotorSettings(
|
|||
motorHomeIsUp = homeIsUp;
|
||||
motorMotorInv = motorInv;
|
||||
motorEndStopInv = endStInv;
|
||||
motorEndStopInv2 = endStInv2;
|
||||
motorEndStopEnbl = endStEnbl;
|
||||
motorInterruptSpeed = interruptSpeed;
|
||||
motorMotor2Enl = motor2Enbl;
|
||||
|
@ -603,19 +604,19 @@ unsigned long StepperControlAxis::getLength(long l1, long l2)
|
|||
|
||||
bool StepperControlAxis::endStopsReached()
|
||||
{
|
||||
return ((digitalRead(pinMin) == motorEndStopInv) || (digitalRead(pinMax) == motorEndStopInv)) && motorEndStopEnbl;
|
||||
return ((digitalRead(pinMin) == motorEndStopInv2) || (digitalRead(pinMax) == motorEndStopInv2)) && motorEndStopEnbl;
|
||||
}
|
||||
|
||||
bool StepperControlAxis::endStopMin()
|
||||
{
|
||||
//return ((digitalRead(pinMin) == motorEndStopInv) || (digitalRead(pinMax) == motorEndStopInv));
|
||||
return digitalRead(pinMin) && motorEndStopEnbl;
|
||||
return ((digitalRead(pinMin) == motorEndStopInv2) && motorEndStopEnbl);
|
||||
}
|
||||
|
||||
bool StepperControlAxis::endStopMax()
|
||||
{
|
||||
//return ((digitalRead(pinMin) == motorEndStopInv) || (digitalRead(pinMax) == motorEndStopInv));
|
||||
return digitalRead(pinMax) && motorEndStopEnbl;
|
||||
return ((digitalRead(pinMax) == motorEndStopInv2) && motorEndStopEnbl);
|
||||
}
|
||||
|
||||
bool StepperControlAxis::isAxisActive()
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
StepperControlAxis();
|
||||
|
||||
void loadPinNumbers(int step, int dir, int enable, int min, int max, int step2, int dir2, int enable2);
|
||||
void loadMotorSettings(long speedMax, long speedMin, long speedHome, long stepsAcc, long timeOut, bool homeIsUp, bool motorInv, bool endStInv, long interruptSpeed, bool motor2Enbl, bool motor2Inv, bool endStEnbl, bool stopAtHome, long maxSize, bool stopAtMax);
|
||||
void loadMotorSettings(long speedMax, long speedMin, long speedHome, long stepsAcc, long timeOut, bool homeIsUp, bool motorInv, bool endStInv, bool endStInv2, long interruptSpeed, bool motor2Enbl, bool motor2Inv, bool endStEnbl, bool stopAtHome, long maxSize, bool stopAtMax);
|
||||
void loadCoordinates(long sourcePoint, long destinationPoint, bool home);
|
||||
void setMaxSpeed(long speed);
|
||||
|
||||
|
@ -96,7 +96,8 @@ private:
|
|||
int pinMax;
|
||||
|
||||
// motor settings
|
||||
bool motorEndStopInv; // invert input (true/false) of end stops
|
||||
bool motorEndStopInv; // switch places of end stops
|
||||
bool motorEndStopInv2; // invert input (true/normal open, falce/normal closed) of end stops
|
||||
bool motorEndStopEnbl; // enable the use of the end stops
|
||||
|
||||
// motor settings
|
||||
|
|
Loading…
Reference in New Issue