diff --git a/Configuration.h b/Configuration.h index ac101c5..55421e2 100644 --- a/Configuration.h +++ b/Configuration.h @@ -24,8 +24,8 @@ Licence: GPL #define CONFIGURATION_H #define NAME "RepRapFirmware" -#define VERSION "0.44" -#define DATE "2013-12-21" +#define VERSION "0.45" +#define DATE "2013-12-23" #define LAST_AUTHOR "reprappro.com" // Other firmware that we might switch to be compatible with. @@ -74,6 +74,10 @@ enum Compatibility #define INDEX_PAGE "reprap.htm" #define MESSAGE_FILE "messages.txt" #define FOUR04_FILE "html404.htm" +#define CONFIG_FILE "config.g" // The file that sets the machine's parameters +#define HOME_X_G "homex.g" +#define HOME_Y_G "homey.g" +#define HOME_Z_G "homez.g" #define LONG_TIME 300.0 // Seconds diff --git a/GCodes.cpp b/GCodes.cpp index 48d26f9..ea7ff26 100644 --- a/GCodes.cpp +++ b/GCodes.cpp @@ -551,167 +551,37 @@ bool GCodes::DoHome() if(homeX) { - if(DoFileCannedCycles("homex.g")) + if(DoFileCannedCycles(HOME_X_G)) { homeAxisMoveCount = 0; homeX = false; return NoHome(); } return false; - // 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; -// return NoHome(); -// } -// return false; -// -// default: -// platform->Message(HOST_MESSAGE, "DoHome(): illegal move count.\n"); -// return true; -// } } if(homeY) { - if(DoFileCannedCycles("homey.g")) + if(DoFileCannedCycles(HOME_Y_G)) { homeAxisMoveCount = 0; homeY = false; return NoHome(); } return false; - -// activeDrive[Y_AXIS] = true; -// moveToDo[DRIVES] = platform->HomeFeedRate(Y_AXIS); -// if(platform->HighStopButNotLow(Y_AXIS)) -// { -// 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)) -// { -// homeAxisMoveCount = 0; -// homeY = false; -// return NoHome(); -// } -// return false; -// -// default: -// platform->Message(HOST_MESSAGE, "DoHome(): illegal move count.\n"); -// return true; -// } -// } else -// { -// moveToDo[Y_AXIS] = -2.0*platform->AxisLength(Y_AXIS); -// if(DoCannedCycleMove(true)) -// { -// homeY = false; -// homeAxisMoveCount = 0; -// return NoHome(); -// } -// } -// return false; } if(homeZ) { - switch(homeAxisMoveCount) + if(DoFileCannedCycles(HOME_Z_G)) { - 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)) - { - homeAxisMoveCount = 0; - homeZ = false; - return NoHome(); - } - return false; - - default: - platform->Message(HOST_MESSAGE, "DoHome(): illegal move count.\n"); - return true; + homeAxisMoveCount = 0; + homeZ = false; + return NoHome(); } + return false; } // Should never get here @@ -727,7 +597,7 @@ bool GCodes::DoHome() // probes the bed height, and records the Z coordinate probed. If you want to program any general // internal canned cycle, this shows how to do it. -bool GCodes::DoSingleZProbe() +bool GCodes::DoSingleZProbeAtPoint() { float x, y, z; @@ -787,6 +657,30 @@ bool GCodes::DoSingleZProbe() } } + +// This simply moves down till the Z probe/switch is triggered. + +bool GCodes::DoSingleZProbe() +{ + if(!AllMovesAreFinishedAndMoveBufferIsLoaded()) + return false; + + for(int8_t drive = 0; drive <= DRIVES; drive++) + activeDrive[drive] = false; + + moveToDo[Z_AXIS] = -1.1*platform->AxisLength(Z_AXIS); + activeDrive[Z_AXIS] = true; + moveToDo[DRIVES] = platform->HomeFeedRate(Z_AXIS); + activeDrive[DRIVES] = true; + if(DoCannedCycleMove(true)) + { + cannedCycleMoveCount = 0; + probeCount = 0; + return true; + } + return false; +} + // This sets wherever we are as the probe point P (probePointIndex) // then probes the bed, or gets all its parameters from the arguments. // If X or Y are specified, use those; otherwise use the machine's @@ -797,14 +691,14 @@ bool GCodes::DoSingleZProbe() bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb) { - if(!gb->Seen('P')) - return true; - - int probePointIndex = gb->GetIValue(); - if(!AllMovesAreFinishedAndMoveBufferIsLoaded()) return false; + if(!gb->Seen('P')) + return DoSingleZProbe(); + + int probePointIndex = gb->GetIValue(); + float x, y, z; if(gb->Seen(gCodeLetters[X_AXIS])) x = gb->GetFValue(); @@ -836,7 +730,7 @@ bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb) return true; } else { - if(DoSingleZProbe()) + if(DoSingleZProbeAtPoint()) { probeCount = 0; reprap.GetMove()->SetZProbing(false); @@ -864,7 +758,7 @@ bool GCodes::DoMultipleZProbe() return true; } - if(DoSingleZProbe()) + if(DoSingleZProbeAtPoint()) probeCount++; if(probeCount >= reprap.GetMove()->NumberOfXYProbePoints()) { diff --git a/GCodes.h b/GCodes.h index a308728..f7b69b6 100644 --- a/GCodes.h +++ b/GCodes.h @@ -88,6 +88,7 @@ class GCodes bool SetUpMove(GCodeBuffer* gb); bool DoDwell(GCodeBuffer *gb); bool DoHome(); + bool DoSingleZProbeAtPoint(); bool DoSingleZProbe(); bool SetSingleZProbeAtAPosition(GCodeBuffer *gb); bool DoMultipleZProbe(); diff --git a/Platform.h b/Platform.h index 455c63b..153a22a 100644 --- a/Platform.h +++ b/Platform.h @@ -146,7 +146,6 @@ Licence: GPL #define GCODE_DIR "0:/gcodes/" // Ditto - g-codes #define SYS_DIR "0:/sys/" // Ditto - system files #define TEMP_DIR "0:/tmp/" // Ditto - temporary files -#define CONFIG_FILE "config.g" // The file that sets the machine's parameters #define FILE_LIST_SEPARATOR ',' #define FILE_LIST_BRACKET '"' #define FILE_LIST_LENGTH 1000 // Maximum length of file list diff --git a/Release/RepRapFirmware-044-21-12-2013.bin b/Release/RepRapFirmware-045-23-12-2013.bin similarity index 77% rename from Release/RepRapFirmware-044-21-12-2013.bin rename to Release/RepRapFirmware-045-23-12-2013.bin index ff5b771..d874a4d 100755 Binary files a/Release/RepRapFirmware-044-21-12-2013.bin and b/Release/RepRapFirmware-045-23-12-2013.bin differ diff --git a/Release/RepRapFirmware.bin b/Release/RepRapFirmware.bin index ff5b771..d874a4d 100755 Binary files a/Release/RepRapFirmware.bin and b/Release/RepRapFirmware.bin differ diff --git a/SD-image/sys/homex.g b/SD-image/sys/homex.g index 4081d48..4f17fe0 100644 --- a/SD-image/sys/homex.g +++ b/SD-image/sys/homex.g @@ -7,5 +7,8 @@ G92 X0 G1 X3 F200 G1 X-30 S1 G92 X0 +G91 +G1 Z-5 F200 +G90 M121 diff --git a/SD-image/sys/homez.g b/SD-image/sys/homez.g new file mode 100644 index 0000000..33874a4 --- /dev/null +++ b/SD-image/sys/homez.g @@ -0,0 +1,9 @@ +M120 ; Push +G91 +G1 Z5 F200 +G90 +G1 X55 Y0 +G30 +G1 Z0 F200 +M121 +