diff --git a/Configuration.h b/Configuration.h index d62a497..7c8a21e 100644 --- a/Configuration.h +++ b/Configuration.h @@ -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. diff --git a/GCodes.cpp b/GCodes.cpp index 09fed48..3602fe0 100644 --- a/GCodes.cpp +++ b/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]); diff --git a/GCodes.h b/GCodes.h index b44a14d..d4ec4c7 100644 --- a/GCodes.h +++ b/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 diff --git a/Move.cpp b/Move.cpp index b1c9f89..3449f3e 100644 --- a/Move.cpp +++ b/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; } diff --git a/Release/RepRapFirmware-040-17-12-2013.bin b/Release/RepRapFirmware-040-17-12-2013.bin deleted file mode 100755 index 18f8510..0000000 Binary files a/Release/RepRapFirmware-040-17-12-2013.bin and /dev/null differ diff --git a/Release/RepRapFirmware.bin b/Release/RepRapFirmware.bin index 3284ef3..9f55d77 100755 Binary files a/Release/RepRapFirmware.bin and b/Release/RepRapFirmware.bin differ