Better check dead zone around home position

pull/141/head
Tim Evers 2020-04-18 15:35:26 +02:00
parent 3ef29a3d23
commit 6cb6028273
3 changed files with 24 additions and 6 deletions

View File

@ -32,9 +32,15 @@ int F11Handler::execute(Command *command)
}
int homeIsUp = ParameterList::getInstance()->getValue(MOVEMENT_HOME_UP_X);
int stepsMerMM = ParameterList::getInstance()->getValue(MOVEMENT_STEP_PER_MM_X);
int stepsPerMM = ParameterList::getInstance()->getValue(MOVEMENT_STEP_PER_MM_X);
int missedStepsMax = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_MAX_X);
if (stepsPerMM <= 0)
{
missedStepsMax = 0;
stepsPerMM = 1;
}
int A = 10; // move away coordinates
int execution;
bool emergencyStop;
@ -101,7 +107,7 @@ int F11Handler::execute(Command *command)
Serial.print("\r\n");
// Home position cannot drift more than 5 milimeter otherwise no valid home pos
if (CurrentState::getInstance()->getHomeMissedStepsXscaled() < (5 + missedStepsMax * stepsMerMM))
if (CurrentState::getInstance()->getHomeMissedStepsXscaled() < (5 + missedStepsMax / stepsPerMM))
{
goodConsecutiveHomings++;
if (goodConsecutiveHomings >= 3)

View File

@ -32,9 +32,15 @@ int F12Handler::execute(Command *command)
}
int homeIsUp = ParameterList::getInstance()->getValue(MOVEMENT_HOME_UP_Y);
int stepsMerMM = ParameterList::getInstance()->getValue(MOVEMENT_STEP_PER_MM_Y);
int stepsPerMM = ParameterList::getInstance()->getValue(MOVEMENT_STEP_PER_MM_Y);
int missedStepsMax = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_MAX_Y);
if (stepsPerMM <= 0)
{
missedStepsMax = 0;
stepsPerMM = 1;
}
int A = 10; // move away coordinates
int execution;
bool emergencyStop;
@ -102,7 +108,7 @@ int F12Handler::execute(Command *command)
Serial.print("\r\n");
// Compare postition before and after verify homing, accounting for missed steps detecting stall
if (CurrentState::getInstance()->getHomeMissedStepsYscaled() < (5 + missedStepsMax * stepsMerMM))
if (CurrentState::getInstance()->getHomeMissedStepsYscaled() < (5 + missedStepsMax / stepsPerMM))
{
goodConsecutiveHomings++;
if (goodConsecutiveHomings >= 3)

View File

@ -34,9 +34,15 @@ int F13Handler::execute(Command *command)
Movement::getInstance()->moveToCoords(0, 0, 0, 0, 0, 0, false, false, true);
int homeIsUp = ParameterList::getInstance()->getValue(MOVEMENT_HOME_UP_Z);
int stepsMerMM = ParameterList::getInstance()->getValue(MOVEMENT_STEP_PER_MM_Z);
int stepsPerMM = ParameterList::getInstance()->getValue(MOVEMENT_STEP_PER_MM_Z);
int missedStepsMax = ParameterList::getInstance()->getValue(ENCODER_MISSED_STEPS_MAX_Z);
if (stepsPerMM <= 0)
{
missedStepsMax = 0;
stepsPerMM = 1;
}
int A = 10; // move away coordinates
int execution;
bool emergencyStop;
@ -103,7 +109,7 @@ int F13Handler::execute(Command *command)
Serial.print("\r\n");
// Compare postition before and after verify homing
if (CurrentState::getInstance()->getHomeMissedStepsZscaled() < (5 + missedStepsMax * stepsMerMM))
if (CurrentState::getInstance()->getHomeMissedStepsZscaled() < (5 + missedStepsMax / stepsPerMM))
{
goodConsecutiveHomings++;
if (goodConsecutiveHomings >= 3)