G32 and G92 improvements
1. G92 with a Z value now sets exactly that Z value even if bed compensation is in effect. 2. If G32 is run before the Z axis is homed, the first bed probe in the G32 sequence homes the Z axiws.
This commit is contained in:
parent
25ad6c9f85
commit
2d61bba024
5 changed files with 34 additions and 18 deletions
|
@ -24,8 +24,8 @@ Licence: GPL
|
|||
#define CONFIGURATION_H
|
||||
|
||||
#define NAME "RepRapFirmware"
|
||||
#define VERSION "0.57k-dc42"
|
||||
#define DATE "2014-02-06"
|
||||
#define VERSION "0.57l-dc42"
|
||||
#define DATE "2014-02-07"
|
||||
#define LAST_AUTHOR "reprappro.com"
|
||||
|
||||
// Other firmware that we might switch to be compatible with.
|
||||
|
|
22
GCodes.cpp
22
GCodes.cpp
|
@ -84,7 +84,7 @@ void GCodes::Init()
|
|||
active = true;
|
||||
longWait = platform->Time();
|
||||
dwellTime = longWait;
|
||||
axisIsHomed[0] = axisIsHomed[1] = axisIsHomed[2] = false;
|
||||
axisIsHomed[X_AXIS] = axisIsHomed[Y_AXIS] = axisIsHomed[Z_AXIS] = false;
|
||||
}
|
||||
|
||||
void GCodes::doFilePrint(GCodeBuffer* gb)
|
||||
|
@ -518,6 +518,9 @@ bool GCodes::SetPositions(GCodeBuffer *gb)
|
|||
return false;
|
||||
|
||||
LoadMoveBufferFromGCode(gb, true, false);
|
||||
// Transform the position so that e.g. if the user does G92 Z0,
|
||||
// the position we report (which gets inverse-transformed) really is Z=0 afterwards
|
||||
reprap.GetMove()->Transform(moveBuffer);
|
||||
reprap.GetMove()->SetLiveCoordinates(moveBuffer);
|
||||
reprap.GetMove()->SetPositions(moveBuffer);
|
||||
|
||||
|
@ -597,7 +600,7 @@ bool GCodes::DoHome(char* reply, bool& error)
|
|||
homeX = false;
|
||||
homeY = false;
|
||||
homeZ = false;
|
||||
axisIsHomed[0] = axisIsHomed[1] = axisIsHomed[2] = true;
|
||||
axisIsHomed[X_AXIS] = axisIsHomed[Y_AXIS] = axisIsHomed[Z_AXIS] = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -609,7 +612,7 @@ bool GCodes::DoHome(char* reply, bool& error)
|
|||
{
|
||||
homeAxisMoveCount = 0;
|
||||
homeX = false;
|
||||
axisIsHomed[0] = true;
|
||||
axisIsHomed[X_AXIS] = true;
|
||||
return NoHome();
|
||||
}
|
||||
return false;
|
||||
|
@ -622,7 +625,7 @@ bool GCodes::DoHome(char* reply, bool& error)
|
|||
{
|
||||
homeAxisMoveCount = 0;
|
||||
homeY = false;
|
||||
axisIsHomed[1] = true;
|
||||
axisIsHomed[Y_AXIS] = true;
|
||||
return NoHome();
|
||||
}
|
||||
return false;
|
||||
|
@ -631,7 +634,7 @@ bool GCodes::DoHome(char* reply, bool& error)
|
|||
|
||||
if(homeZ)
|
||||
{
|
||||
if (!(axisIsHomed[0] && axisIsHomed[1]))
|
||||
if (!(axisIsHomed[X_AXIS] && axisIsHomed[Y_AXIS]))
|
||||
{
|
||||
// We can only home Z if X and Y have already been homed. Possibly this should only be if we are using an IR probe.
|
||||
strncpy(reply, "Must home X and Y before homing Z", STRING_LENGTH);
|
||||
|
@ -643,7 +646,7 @@ bool GCodes::DoHome(char* reply, bool& error)
|
|||
{
|
||||
homeAxisMoveCount = 0;
|
||||
homeZ = false;
|
||||
axisIsHomed[2] = true;
|
||||
axisIsHomed[Z_AXIS] = true;
|
||||
return NoHome();
|
||||
}
|
||||
return false;
|
||||
|
@ -702,7 +705,10 @@ bool GCodes::DoSingleZProbeAtPoint()
|
|||
activeDrive[DRIVES] = true;
|
||||
reprap.GetMove()->SetZProbing(true);
|
||||
if(DoCannedCycleMove(true))
|
||||
{
|
||||
cannedCycleMoveCount++;
|
||||
axisIsHomed[Z_AXIS] = true; // we now home the Z-axis in Move.cpp it is wasn't already
|
||||
}
|
||||
return false;
|
||||
|
||||
case 3:
|
||||
|
@ -741,7 +747,7 @@ bool GCodes::DoSingleZProbe()
|
|||
{
|
||||
cannedCycleMoveCount = 0;
|
||||
probeCount = 0;
|
||||
axisIsHomed[2] = true; // we have homed the Z axis
|
||||
axisIsHomed[Z_AXIS] = true; // we have homed the Z axis
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1315,7 +1321,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
break;
|
||||
|
||||
case 32: // Probe Z at multiple positions and generate the bed transform
|
||||
if (!(axisIsHomed[0] && axisIsHomed[1]))
|
||||
if (!(axisIsHomed[X_AXIS] && axisIsHomed[Y_AXIS]))
|
||||
{
|
||||
// We can only do a Z probe if X and Y have already been homed
|
||||
strncpy(reply, "Must home X and Y before bed probing", STRING_LENGTH);
|
||||
|
|
3
Move.cpp
3
Move.cpp
|
@ -98,8 +98,6 @@ void Move::Init()
|
|||
lastMove->Release();
|
||||
liveCoordinates[DRIVES] = platform->HomeFeedRate(Z_AXIS);
|
||||
|
||||
checkEndStopsOnNextMove = false;
|
||||
|
||||
SetStepHypotenuse();
|
||||
|
||||
currentFeedrate = -1.0;
|
||||
|
@ -169,6 +167,7 @@ void Move::Spin()
|
|||
// If there's a G Code move available, add it to the look-ahead
|
||||
// ring for processing.
|
||||
|
||||
bool checkEndStopsOnNextMove;
|
||||
if(gCodes->ReadMove(nextMove, checkEndStopsOnNextMove))
|
||||
{
|
||||
Transform(nextMove);
|
||||
|
|
15
Move.h
15
Move.h
|
@ -227,7 +227,6 @@ class Move
|
|||
float lastTime;
|
||||
bool addNoMoreMoves;
|
||||
bool active;
|
||||
bool checkEndStopsOnNextMove;
|
||||
float currentFeedrate;
|
||||
float nextMove[DRIVES + 1]; // Extra is for feedrate
|
||||
float stepDistances[(1<<AXES)]; // Index bits: lsb -> dx, dy, dz <- msb
|
||||
|
@ -547,13 +546,25 @@ inline void Move::HitLowStop(int8_t drive, LookAhead* la, DDA* hitDDA)
|
|||
{
|
||||
if(zProbing)
|
||||
{
|
||||
// Executing G32, so record the Z position at which we hit the end stop
|
||||
if (gCodes->GetAxisIsHomed(drive))
|
||||
{
|
||||
// Z-axis has already been homed, so just record the height of the bed at this point
|
||||
lastZHit = ComputeCurrentCoordinate(drive, la, hitDDA);
|
||||
la->SetDriveCoordinateAndZeroEndSpeed(lastZHit, drive);
|
||||
lastZHit = lastZHit - platform->ZProbeStopHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Z axis has not yet been homed, so treat this probe as a homing command
|
||||
la->SetDriveCoordinateAndZeroEndSpeed(platform->ZProbeStopHeight(), drive);
|
||||
lastZHit = 0.0;
|
||||
}
|
||||
return;
|
||||
} else
|
||||
{
|
||||
lastZHit = platform->ZProbeStopHeight(); // Should never be used.
|
||||
// Executing G30, so set the current Z height to the value at which the end stop is triggered
|
||||
lastZHit = platform->ZProbeStopHeight();
|
||||
hitPoint = lastZHit;
|
||||
}
|
||||
}
|
||||
|
|
BIN
Release/RepRapFirmware-057l-dc42.bin
Normal file
BIN
Release/RepRapFirmware-057l-dc42.bin
Normal file
Binary file not shown.
Reference in a new issue