Homing against max endstop for Y (and X) implemented when there is a top

endstop but not a bottom one.
This commit is contained in:
Adrian Bowyer 2013-11-25 11:03:36 +00:00
parent 0670357001
commit 00a0ffd9b4
5 changed files with 66 additions and 21 deletions

View file

@ -24,7 +24,7 @@ Licence: GPL
#define CONFIGURATION_H
#define NAME "RepRapFirmware"
#define VERSION "0.21"
#define VERSION "0.22"
#define DATE "2013-11-25"
#define LAST_AUTHOR "reprappro.com"

View file

@ -67,7 +67,7 @@ void GCodes::Init()
homeX = false;
homeY = false;
homeZ = false;
homeZFinalMove = false;
homeAxisFinalMove = false;
dwellWaiting = false;
stackPointer = 0;
selectedHead = -1;
@ -355,12 +355,32 @@ bool GCodes::DoHome()
if(homeX)
{
action[X_AXIS] = true;
moveToDo[X_AXIS] = -2.0*platform->AxisLength(X_AXIS);
moveToDo[DRIVES] = platform->HomeFeedRate(X_AXIS);
if(DoCannedCycleMove(moveToDo, action, true))
if(platform->HighStopButNotLow(X_AXIS))
{
homeX = false;
return NoHome();
if(homeAxisFinalMove)
{
moveToDo[X_AXIS] = 0.0;
if(DoCannedCycleMove(moveToDo, action, false))
{
homeAxisFinalMove = false;
homeX = false;
return NoHome();
}
}else
{
moveToDo[X_AXIS] = 2.0*platform->AxisLength(X_AXIS);
if(DoCannedCycleMove(moveToDo, action, true))
homeAxisFinalMove = true;
}
} else
{
moveToDo[X_AXIS] = -2.0*platform->AxisLength(X_AXIS);
moveToDo[DRIVES] = platform->HomeFeedRate(X_AXIS);
if(DoCannedCycleMove(moveToDo, action, true))
{
homeX = false;
return NoHome();
}
}
return false;
}
@ -368,12 +388,32 @@ bool GCodes::DoHome()
if(homeY)
{
action[Y_AXIS] = true;
moveToDo[Y_AXIS] = -2.0*platform->AxisLength(Y_AXIS);
moveToDo[DRIVES] = platform->HomeFeedRate(Y_AXIS);
if(DoCannedCycleMove(moveToDo, action, true))
if(platform->HighStopButNotLow(Y_AXIS))
{
homeY = false;
return NoHome();
if(homeAxisFinalMove)
{
moveToDo[Y_AXIS] = 0.0;
if(DoCannedCycleMove(moveToDo, action, false))
{
homeAxisFinalMove = false;
homeY = false;
return NoHome();
}
}else
{
moveToDo[Y_AXIS] = 2.0*platform->AxisLength(Y_AXIS);
if(DoCannedCycleMove(moveToDo, action, true))
homeAxisFinalMove = true;
}
} else
{
moveToDo[Y_AXIS] = -2.0*platform->AxisLength(Y_AXIS);
moveToDo[DRIVES] = platform->HomeFeedRate(Y_AXIS);
if(DoCannedCycleMove(moveToDo, action, true))
{
homeY = false;
return NoHome();
}
}
return false;
}
@ -382,23 +422,22 @@ bool GCodes::DoHome()
{
action[Z_AXIS] = true;
moveToDo[DRIVES] = platform->HomeFeedRate(Z_AXIS);
if(homeZFinalMove)
if(homeAxisFinalMove)
{
moveToDo[Z_AXIS] = 0.0;
if(DoCannedCycleMove(moveToDo, action, false))
{
homeZFinalMove = false;
homeAxisFinalMove = false;
homeZ = false;
return NoHome();
}
return false;
}else
{
moveToDo[Z_AXIS] = -2.0*platform->AxisLength(Z_AXIS);
if(DoCannedCycleMove(moveToDo, action, true))
homeZFinalMove = true;
return false;
homeAxisFinalMove = true;
}
return false;
}
// Should never get here

View file

@ -135,7 +135,7 @@ class GCodes
bool homeX;
bool homeY;
bool homeZ;
bool homeZFinalMove;
bool homeAxisFinalMove;
float gFeedRate;
int probeCount;
int8_t cannedCycleMoveCount;
@ -186,7 +186,7 @@ inline bool GCodes::PrintingAFile()
inline bool GCodes::NoHome()
{
return !(homeX || homeY || homeZ || homeZFinalMove);
return !(homeX || homeY || homeZ || homeAxisFinalMove);
}
// This function takes care of the fact that the heater and head indices

View file

@ -81,8 +81,8 @@ Licence: GPL
#define ENABLE false // What to send to enable...
#define DISABLE true // ...and disable a drive
#define DISABLE_DRIVES {false, false, true, false} // Set true to disable a drive when it becomes idle
#define LOW_STOP_PINS {11, 28, 60, 31}
#define HIGH_STOP_PINS {-1, -1, -1, -1}
#define LOW_STOP_PINS {11, -1, 60, 31}
#define HIGH_STOP_PINS {-1, 28, -1, -1}
#define ENDSTOP_HIT 1 // when a stop == this it is hit
#define POT_WIPES {0, 1, 2, 3} // Indices for motor current digipots (if any)
#define SENSE_RESISTOR 0.1 // Stepper motor current sense resistor
@ -459,6 +459,7 @@ class Platform
EndStopHit Stopped(int8_t drive);
float AxisLength(int8_t axis);
void SetAxisLength(int8_t axis, float value);
bool HighStopButNotLow(int8_t axis);
float ZProbeStopHeight();
void SetZProbeStopHeight(float z);
@ -686,6 +687,11 @@ inline float Platform::InstantDv(int8_t drive)
return instantDvs[drive];
}
inline bool Platform::HighStopButNotLow(int8_t axis)
{
return (lowStopPins[axis] < 0) && (highStopPins[axis] >= 0);
}
inline void Platform::SetDirection(byte drive, bool direction)
{
if(directionPins[drive] < 0)

Binary file not shown.