Homing modified to correspond with Ian's documentation...
This commit is contained in:
parent
e9539d97f0
commit
4feab9afce
6 changed files with 110 additions and 49 deletions
|
@ -24,8 +24,8 @@ Licence: GPL
|
|||
#define CONFIGURATION_H
|
||||
|
||||
#define NAME "RepRapFirmware"
|
||||
#define VERSION "0.41"
|
||||
#define DATE "2013-12-18"
|
||||
#define VERSION "0.42"
|
||||
#define DATE "2013-12-19"
|
||||
#define LAST_AUTHOR "reprappro.com"
|
||||
|
||||
// Other firmware that we might switch to be compatible with.
|
||||
|
|
147
GCodes.cpp
147
GCodes.cpp
|
@ -67,7 +67,7 @@ void GCodes::Init()
|
|||
homeX = false;
|
||||
homeY = false;
|
||||
homeZ = false;
|
||||
homeAxisFinalMove = false;
|
||||
homeAxisMoveCount = 0;
|
||||
offSetSet = false;
|
||||
dwellWaiting = false;
|
||||
stackPointer = 0;
|
||||
|
@ -465,58 +465,98 @@ bool GCodes::DoHome()
|
|||
|
||||
if(homeX)
|
||||
{
|
||||
activeDrive[X_AXIS] = true;
|
||||
moveToDo[DRIVES] = platform->HomeFeedRate(X_AXIS);
|
||||
if(platform->HighStopButNotLow(X_AXIS))
|
||||
{
|
||||
if(homeAxisFinalMove)
|
||||
{
|
||||
moveToDo[X_AXIS] = 0.0;
|
||||
if(DoCannedCycleMove(false))
|
||||
{
|
||||
homeAxisFinalMove = false;
|
||||
homeX = false;
|
||||
return NoHome();
|
||||
}
|
||||
}else
|
||||
{
|
||||
moveToDo[X_AXIS] = 2.0*platform->AxisLength(X_AXIS);
|
||||
if(DoCannedCycleMove(true))
|
||||
homeAxisFinalMove = true;
|
||||
}
|
||||
} else
|
||||
|
||||
// FIXME Need to reinstate this to deal with high endstop on X.
|
||||
|
||||
// activeDrive[X_AXIS] = true;
|
||||
// moveToDo[DRIVES] = platform->HomeFeedRate(X_AXIS);
|
||||
// if(platform->HighStopButNotLow(X_AXIS))
|
||||
// {
|
||||
// if(homeAxisFinalMove)
|
||||
// {
|
||||
// moveToDo[X_AXIS] = 0.0;
|
||||
// if(DoCannedCycleMove(false))
|
||||
// {
|
||||
// homeAxisFinalMove = false;
|
||||
// homeX = false;
|
||||
// return NoHome();
|
||||
// }
|
||||
// }else
|
||||
// {
|
||||
// moveToDo[X_AXIS] = 2.0*platform->AxisLength(X_AXIS);
|
||||
// if(DoCannedCycleMove(true))
|
||||
// homeAxisFinalMove = true;
|
||||
// }
|
||||
// } else
|
||||
// {
|
||||
// moveToDo[X_AXIS] = -2.0*platform->AxisLength(X_AXIS);
|
||||
// if(DoCannedCycleMove(true))
|
||||
// {
|
||||
// homeX = false;
|
||||
// homeAxisFinalMove = false;
|
||||
// return NoHome();
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
|
||||
switch(homeAxisMoveCount)
|
||||
{
|
||||
case 0:
|
||||
if(!AllMovesAreFinishedAndMoveBufferIsLoaded())
|
||||
return false;
|
||||
activeDrive[Z_AXIS] = true;
|
||||
moveToDo[DRIVES] = platform->HomeFeedRate(Z_AXIS);
|
||||
moveToDo[Z_AXIS] = 5.0 + moveBuffer[Z_AXIS];
|
||||
if(DoCannedCycleMove(false))
|
||||
homeAxisMoveCount = 1;
|
||||
return false;
|
||||
|
||||
case 1:
|
||||
activeDrive[X_AXIS] = true;
|
||||
moveToDo[DRIVES] = platform->HomeFeedRate(X_AXIS);
|
||||
moveToDo[X_AXIS] = -2.0*platform->AxisLength(X_AXIS);
|
||||
if(DoCannedCycleMove(true))
|
||||
{
|
||||
homeAxisMoveCount = 0;
|
||||
homeX = false;
|
||||
homeAxisFinalMove = false;
|
||||
return NoHome();
|
||||
}
|
||||
return false;
|
||||
|
||||
default:
|
||||
platform->Message(HOST_MESSAGE, "DoHome(): illegal move count.\n");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(homeY)
|
||||
{
|
||||
activeDrive[Y_AXIS] = true;
|
||||
moveToDo[DRIVES] = platform->HomeFeedRate(Y_AXIS);
|
||||
if(platform->HighStopButNotLow(Y_AXIS))
|
||||
{
|
||||
if(homeAxisFinalMove)
|
||||
switch(homeAxisMoveCount)
|
||||
{
|
||||
case 0:
|
||||
moveToDo[Y_AXIS] = 2.0*platform->AxisLength(Y_AXIS);
|
||||
if(DoCannedCycleMove(true))
|
||||
homeAxisMoveCount = 1;
|
||||
return false;
|
||||
|
||||
case 1:
|
||||
moveToDo[Y_AXIS] = 0.0;
|
||||
if(DoCannedCycleMove(false))
|
||||
{
|
||||
homeAxisFinalMove = false;
|
||||
homeAxisMoveCount = 0;
|
||||
homeY = false;
|
||||
return NoHome();
|
||||
}
|
||||
}else
|
||||
{
|
||||
moveToDo[Y_AXIS] = 2.0*platform->AxisLength(Y_AXIS);
|
||||
if(DoCannedCycleMove(true))
|
||||
homeAxisFinalMove = true;
|
||||
return false;
|
||||
|
||||
default:
|
||||
platform->Message(HOST_MESSAGE, "DoHome(): illegal move count.\n");
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -524,40 +564,61 @@ bool GCodes::DoHome()
|
|||
if(DoCannedCycleMove(true))
|
||||
{
|
||||
homeY = false;
|
||||
homeAxisFinalMove = false;
|
||||
homeAxisMoveCount = 0;
|
||||
return NoHome();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(homeZ)
|
||||
{
|
||||
activeDrive[Z_AXIS] = true;
|
||||
moveToDo[DRIVES] = platform->HomeFeedRate(Z_AXIS);
|
||||
if(homeAxisFinalMove)
|
||||
switch(homeAxisMoveCount)
|
||||
{
|
||||
case 0:
|
||||
if(!AllMovesAreFinishedAndMoveBufferIsLoaded())
|
||||
return false;
|
||||
activeDrive[X_AXIS] = true;
|
||||
activeDrive[Y_AXIS] = true;
|
||||
moveToDo[DRIVES] = platform->HomeFeedRate(X_AXIS);
|
||||
moveToDo[X_AXIS] = reprap.GetMove()->xBedProbePoint(0);
|
||||
moveToDo[Y_AXIS] = reprap.GetMove()->yBedProbePoint(0);
|
||||
if(DoCannedCycleMove(false))
|
||||
homeAxisMoveCount = 1;
|
||||
return false;
|
||||
|
||||
case 1:
|
||||
activeDrive[Z_AXIS] = true;
|
||||
moveToDo[DRIVES] = platform->HomeFeedRate(Z_AXIS);
|
||||
moveToDo[Z_AXIS] = -2.0*platform->AxisLength(Z_AXIS);
|
||||
if(DoCannedCycleMove(true))
|
||||
homeAxisMoveCount = 2;
|
||||
return false;
|
||||
|
||||
case 2:
|
||||
activeDrive[Z_AXIS] = true;
|
||||
moveToDo[DRIVES] = platform->HomeFeedRate(Z_AXIS);
|
||||
moveToDo[Z_AXIS] = 0.0;
|
||||
if(DoCannedCycleMove(false))
|
||||
{
|
||||
homeAxisFinalMove = false;
|
||||
homeAxisMoveCount = 0;
|
||||
homeZ = false;
|
||||
return NoHome();
|
||||
}
|
||||
}else
|
||||
{
|
||||
moveToDo[Z_AXIS] = -2.0*platform->AxisLength(Z_AXIS);
|
||||
if(DoCannedCycleMove(true))
|
||||
homeAxisFinalMove = true;
|
||||
return false;
|
||||
|
||||
default:
|
||||
platform->Message(HOST_MESSAGE, "DoHome(): illegal move count.\n");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Should never get here
|
||||
|
||||
checkEndStops = false;
|
||||
moveAvailable = false;
|
||||
homeAxisFinalMove = false;
|
||||
homeAxisMoveCount = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1165,7 +1226,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
case 28: // Home
|
||||
if(NoHome())
|
||||
{
|
||||
homeAxisFinalMove = false;
|
||||
homeAxisMoveCount = 0;
|
||||
homeX = gb->Seen(gCodeLetters[X_AXIS]);
|
||||
homeY = gb->Seen(gCodeLetters[Y_AXIS]);
|
||||
homeZ = gb->Seen(gCodeLetters[Z_AXIS]);
|
||||
|
|
4
GCodes.h
4
GCodes.h
|
@ -142,7 +142,7 @@ class GCodes
|
|||
bool homeX;
|
||||
bool homeY;
|
||||
bool homeZ;
|
||||
bool homeAxisFinalMove;
|
||||
int8_t homeAxisMoveCount;
|
||||
float gFeedRate;
|
||||
int probeCount;
|
||||
int8_t cannedCycleMoveCount;
|
||||
|
@ -192,7 +192,7 @@ inline bool GCodes::PrintingAFile()
|
|||
|
||||
inline bool GCodes::NoHome()
|
||||
{
|
||||
return !(homeX || homeY || homeZ || homeAxisFinalMove);
|
||||
return !(homeX || homeY || homeZ || homeAxisMoveCount);
|
||||
}
|
||||
|
||||
// This function takes care of the fact that the heater and head indices
|
||||
|
|
4
Move.cpp
4
Move.cpp
|
@ -115,8 +115,8 @@ void Move::Init()
|
|||
|
||||
for(uint8_t point = 0; point < NUMBER_OF_PROBE_POINTS; point++)
|
||||
{
|
||||
xBedProbePoints[point] = (0.2 + 0.6*(float)(point%2))*platform->AxisLength(X_AXIS);
|
||||
yBedProbePoints[point] = (0.2 + 0.6*(float)(point/2))*platform->AxisLength(Y_AXIS);
|
||||
xBedProbePoints[point] = (0.3 + 0.6*(float)(point%2))*platform->AxisLength(X_AXIS);
|
||||
yBedProbePoints[point] = (0.0 + 0.9*(float)(point/2))*platform->AxisLength(Y_AXIS);
|
||||
zBedProbePoints[point] = 0.0;
|
||||
probePointSet[point] = unset;
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Reference in a new issue