diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-05-29 20:48:16 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-05-29 20:48:16 +0300 |
commit | 913c9d35e18c303492e784fc9c1a868d435bd6d1 (patch) | |
tree | 6262d284b7f641affa528f7675e6ad1a9e5a7c22 | |
parent | ae2081b2aad8d283fd4e032e391c1e53bcc1db6d (diff) |
Version 2.03RC4
Print Z shift in Move diagnostics
In Move diagnostics, only print bed probe heights if 3/4/5-point bed compensation is in use
M1 no longer disables drives (you can do that in sleep.g)
M0/M1 with a stop.g/sleep.g file no longer deselects the tool, it just turns off tool heaters if no H1 parameter
After grid probing, print min/max error as well as mean and std dev, also record them in the height map file
Implemented M675 (thanks wilriker)
Emit a warning if you run mesh bed probing and there is a substantial height offset
Emit a warning if you load a mesh and the Z datum has not been set by probing and there is a Z probe
M114 displays bed compensation amount at current position
Bug fix: in 2.03RC3, G10 L20 gave wrong results when a workplace coordinate offset was in use
Bug fix for Z shift if Z probe averaging mode is being used
Bug fix: M0 H1 turns heaters off there is a stop.g file
-rw-r--r-- | src/BugList.txt | 13 | ||||
-rw-r--r-- | src/GCodes/GCodes.cpp | 76 | ||||
-rw-r--r-- | src/GCodes/GCodes.h | 13 | ||||
-rw-r--r-- | src/GCodes/GCodes3.cpp | 8 | ||||
-rw-r--r-- | src/RepRap.cpp | 4 | ||||
-rw-r--r-- | src/Version.h | 6 |
6 files changed, 75 insertions, 45 deletions
diff --git a/src/BugList.txt b/src/BugList.txt index 3748dd01..592dc6b0 100644 --- a/src/BugList.txt +++ b/src/BugList.txt @@ -154,14 +154,17 @@ Done in 2.0 RC3: For 2.03RC4: - [done] Print Z shift in Move diagnostics -- [done] In Move diagnostics, only print bed probe heights if 3/4/5-point bed compensatoin is in use -- [done] Bug fix for Z shift if Z probe averaging mnode is being used -- Check behaviour of mesh probing with an offset probe +- [done] In Move diagnostics, only print bed probe heights if 3/4/5-point bed compensation is in use +- [done] Bug fix for Z shift if Z probe averaging mode is being used - [done, test]Bug fix: M0 H1 turns heaters off there is a stop.g file - [done] M1 no longer disables drives (you can do that in sleep.g) - [done] M0/M1 with a stop.g/sleep.g file no longer deselects the tool, it just turns off tool heaters if no H1 parameter -- [done, test, test height map view in DWC] After grid probing, print min/max error as well as mean and std dev, also record them in the height map file -- M675 PR +- [done, ok] After grid probing, print min/max error as well as mean and std dev, also record them in the height map file +- [done] M675 PR +- [done] Warning if you run mesh bed probing and there is a substantial height offset +- [done] Warning if you load a mesh and the Z datum has not been set by probing and there is a Z probe +- [done] Fix 2.03RC3 bug: G10 L20 gave wrong results when a workplace coordinate offset was in use +- [done] M114 displays bed compensation amount at current position Planned for 3.0: - [on hold] investigate filament file not run on initial tool change, https://forum.duet3d.com/topic/9405/first-t0-in-gcode-does-not-work/5 diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index 7f1651ef..b31b1fc9 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -1154,9 +1154,10 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) error = SaveHeightMap(gb, reply); reprap.GetMove().AccessHeightMap().ExtrapolateMissing(); reprap.GetMove().UseMesh(true); - if (fabsf(mean) >= 2 * deviation) + const float absMean = fabsf(mean); + if (absMean >= 0.05 && absMean >= 2 * deviation) { - platform.Message(WarningMessage, "Height map has a substantial Z offset. Recommend use Z-probe to re-establish Z=0 position, then re-probe the mesh.\n"); + platform.Message(WarningMessage, "the height map has a substantial Z offset. Suggest use Z-probe to establish Z=0 datum, then re-probe the mesh.\n"); } } else @@ -1259,7 +1260,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) platform.SetProbing(true); SetMoveBufferDefaults(); moveBuffer.endStopsToCheck = ZProbeActive; - moveBuffer.coords[Z_AXIS] = (GetAxisIsHomed(Z_AXIS)) + moveBuffer.coords[Z_AXIS] = (IsAxisHomed(Z_AXIS)) ? -platform.GetZProbeDiveHeight() // Z axis has been homed, so no point in going very far : -1.1 * platform.AxisTotalLength(Z_AXIS); // Z axis not homed yet, so treat this as a homing move moveBuffer.feedRate = platform.GetCurrentZProbeParameters().probeSpeed; @@ -1325,6 +1326,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) reprap.GetMove().SetZeroHeightError(moveBuffer.coords); g30zHeightErrorSum = g30zHeightError = 0; // there is no longer any height error from this probe SetAxisIsHomed(Z_AXIS); // this is only correct if the Z axis is Cartesian-like, but other architectures must be homed before probing anyway + zDatumSetByProbing = true; } } @@ -1420,6 +1422,10 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) else if (g30SValue >= -1) { error = reprap.GetMove().FinishedBedProbing(g30SValue, reply); + if (!error && reprap.GetMove().GetKinematics().SupportsAutoCalibration()) + { + zDatumSetByProbing = true; // if we successfully auto calibrated or adjusted leadscrews, we've set the Z datum by probing + } } gb.SetState(GCodeState::normal); } @@ -2208,7 +2214,7 @@ void GCodes::SaveResumeInfo(bool wasPowerFailure) const float totalOffset = currentBabyStepOffsets[axis] - GetCurrentToolOffset(axis); buf.catf(" %c%.3f", axisLetters[axis], (double)(pauseRestorePoint.moveCoords[axis] - totalOffset)); } - buf.cat('\n'); + buf.cat("\nG60 S1\n"); // save the coordinates as restore point 1 too ok = f->Write(buf.c_str()); } if (ok) @@ -3490,15 +3496,19 @@ GCodeResult GCodes::LoadHeightMap(GCodeBuffer& gb, const StringRef& reply) f->Close(); reprap.GetMove().UseMesh(!err); - if (!err) + if (err) + { + return GCodeResult::error; + } + + reply.Clear(); // get rid of the error message + if (!zDatumSetByProbing && platform.GetZProbeType() != ZProbeType::none) { - reply.Clear(); // wipe the error message - // Update the current position to allow for any bed compensation at the current XY coordinates - reprap.GetMove().GetCurrentUserPosition(moveBuffer.coords, 0, reprap.GetCurrentXAxes(), reprap.GetCurrentYAxes()); - ToolOffsetInverseTransform(moveBuffer.coords, currentUserPosition); // update user coordinates to reflect any height map offset at the current position + reply.copy("the height map was loaded when the current Z=0 datum was not determined probing. This may result in a height offset."); + return GCodeResult::warning; } - return (err) ? GCodeResult::error : GCodeResult::ok; + return GCodeResult::ok; } // Save the height map and append the success or error message to 'reply', returning true if an error occurred @@ -3549,18 +3559,6 @@ void GCodes::ClearBedMapping() // Coordinates are updated at the end of each movement, so this won't tell you where you are mid-movement. void GCodes::GetCurrentCoordinates(const StringRef& s) const { - // Get the live machine coordinates, we'll need them later - float liveCoordinates[MaxTotalDrivers]; - reprap.GetMove().LiveCoordinates(liveCoordinates, reprap.GetCurrentXAxes(), reprap.GetCurrentYAxes()); - const Tool * const currentTool = reprap.GetCurrentTool(); - if (currentTool != nullptr) - { - for (size_t i = 0; i < numVisibleAxes; ++i) - { - liveCoordinates[i] += currentTool->GetOffset(i); - } - } - // Start with the axis coordinates s.Clear(); for (size_t axis = 0; axis < numVisibleAxes; ++axis) @@ -3569,6 +3567,10 @@ void GCodes::GetCurrentCoordinates(const StringRef& s) const s.catf("%c:%.3f ", axisLetters[axis], HideNan(GetUserCoordinate(axis))); } + // Get the live machine coordinates, we'll need them later + float liveCoordinates[MaxTotalDrivers]; + reprap.GetMove().LiveCoordinates(liveCoordinates, reprap.GetCurrentXAxes(), reprap.GetCurrentYAxes()); + // Now the extruder coordinates for (size_t i = numTotalAxes; i < MaxTotalDrivers; i++) { @@ -3585,10 +3587,17 @@ void GCodes::GetCurrentCoordinates(const StringRef& s) const // Add the machine coordinates because they may be different from the user coordinates under some conditions s.cat(" Machine"); + float machineCoordinates[MaxAxes]; + ToolOffsetTransform(currentUserPosition, machineCoordinates); for (size_t axis = 0; axis < numVisibleAxes; ++axis) { - s.catf(" %.3f", HideNan(liveCoordinates[axis])); + s.catf(" %.3f", HideNan(machineCoordinates[axis])); } + + // Add the bed compensation + const float machineZ = machineCoordinates[Z_AXIS]; + reprap.GetMove().AxisAndBedTransform(machineCoordinates, reprap.GetCurrentXAxes(), reprap.GetCurrentYAxes(), true); + s.catf(" Bed comp %.3f", (double)(machineCoordinates[Z_AXIS] - machineZ)); } // Set up a file to print, but don't print it yet. @@ -4759,7 +4768,7 @@ void GCodes::RestorePosition(const RestorePoint& rp, GCodeBuffer *gb) // Convert user coordinates to head reference point coordinates, optionally allowing for X axis mapping // If the X axis is mapped to some other axes not including X, then the X coordinate of coordsOut will be left unchanged. // So make sure it is suitably initialised before calling this. -void GCodes::ToolOffsetTransform(const float coordsIn[MaxAxes], float coordsOut[MaxAxes], AxesBitmap explicitAxes) +void GCodes::ToolOffsetTransform(const float coordsIn[MaxAxes], float coordsOut[MaxAxes], AxesBitmap explicitAxes) const { const Tool * const currentTool = reprap.GetCurrentTool(); if (currentTool == nullptr) @@ -4793,7 +4802,7 @@ void GCodes::ToolOffsetTransform(const float coordsIn[MaxAxes], float coordsOut[ // Convert head reference point coordinates to user coordinates, allowing for XY axis mapping // Caution: coordsIn and coordsOut may address the same array! -void GCodes::ToolOffsetInverseTransform(const float coordsIn[MaxAxes], float coordsOut[MaxAxes]) +void GCodes::ToolOffsetInverseTransform(const float coordsIn[MaxAxes], float coordsOut[MaxAxes]) const { const Tool * const currentTool = reprap.GetCurrentTool(); if (currentTool == nullptr) @@ -4962,6 +4971,23 @@ void GCodes::SetAxisIsHomed(unsigned int axis) SetBit(axesHomed, axis); } +// Tell us that the axis is not homed +void GCodes::SetAxisNotHomed(unsigned int axis) +{ + ClearBit(axesHomed, axis); + if (axis == Z_AXIS) + { + zDatumSetByProbing = false; + } +} + +// Flag all axes as not homed +void GCodes::SetAllAxesNotHomed() +{ + axesHomed = 0; + zDatumSetByProbing = false; +} + // Write the config-override file returning true if an error occurred GCodeResult GCodes::WriteConfigOverrideFile(GCodeBuffer& gb, const StringRef& reply) const { diff --git a/src/GCodes/GCodes.h b/src/GCodes/GCodes.h index dc2ead4d..50372a0b 100644 --- a/src/GCodes/GCodes.h +++ b/src/GCodes/GCodes.h @@ -158,13 +158,11 @@ public: bool RunConfigFile(const char* fileName); // Start running the config file bool IsDaemonBusy() const; // Return true if the daemon is busy running config.g or a trigger file - bool GetAxisIsHomed(unsigned int axis) const // Has the axis been homed? + bool IsAxisHomed(unsigned int axis) const // Has the axis been homed? { return IsBitSet(axesHomed, axis); } void SetAxisIsHomed(unsigned int axis); // Tell us that the axis is now homed - void SetAxisNotHomed(unsigned int axis) // Tell us that the axis is not homed - { ClearBit(axesHomed, axis); } - void SetAllAxesNotHomed() // Flag all axes as not homed - { axesHomed = 0; } + void SetAxisNotHomed(unsigned int axis); // Tell us that the axis is not homed + void SetAllAxesNotHomed(); // Flag all axes as not homed float GetSpeedFactor() const; // Return the current speed factor #if SUPPORT_12864_LCD @@ -345,9 +343,9 @@ private: void SetMachinePosition(const float positionNow[MaxTotalDrivers], bool doBedCompensation = true); // Set the current position to be this void UpdateCurrentUserPosition(); // Get the current position from the Move class - void ToolOffsetTransform(const float coordsIn[MaxAxes], float coordsOut[MaxAxes], AxesBitmap explicitAxes = 0); + void ToolOffsetTransform(const float coordsIn[MaxAxes], float coordsOut[MaxAxes], AxesBitmap explicitAxes = 0) const; // Convert user coordinates to head reference point coordinates - void ToolOffsetInverseTransform(const float coordsIn[MaxAxes], float coordsOut[MaxAxes]); // Convert head reference point coordinates to user coordinates + void ToolOffsetInverseTransform(const float coordsIn[MaxAxes], float coordsOut[MaxAxes]) const; // Convert head reference point coordinates to user coordinates float GetCurrentToolOffset(size_t axis) const; // Get an axis offset of the current tool const char *TranslateEndStopResult(EndStopHit es); // Translate end stop result to text @@ -559,6 +557,7 @@ private: bool doingManualBedProbe; // true if we are waiting for the user to jog the nozzle until it touches the bed bool probeIsDeployed; // true if M401 has been used to deploy the probe and M402 has not yet been used t0 retract it bool hadProbingError; // true if there was an error probing the last point + bool zDatumSetByProbing; // true if the Z position was last set by probing, not by an endstop switch or by G92 uint8_t tapsDone; // how many times we tapped the current point float simulationTime; // Accumulated simulation time diff --git a/src/GCodes/GCodes3.cpp b/src/GCodes/GCodes3.cpp index b136854c..dc0f3b66 100644 --- a/src/GCodes/GCodes3.cpp +++ b/src/GCodes/GCodes3.cpp @@ -173,6 +173,10 @@ GCodeResult GCodes::SetPositions(GCodeBuffer& gb) } reprap.GetMove().SetNewPosition(moveBuffer.coords, true); axesHomed |= reprap.GetMove().GetKinematics().AxesAssumedHomed(axesIncluded); + if (IsBitSet(axesIncluded, Z_AXIS)) + { + zDatumSetByProbing -= false; + } #if SUPPORT_ROLAND if (reprap.GetRoland()->Active()) @@ -251,9 +255,7 @@ GCodeResult GCodes::GetSetWorkplaceCoordinates(GCodeBuffer& gb, const StringRef& } seen = true; } - workplaceCoordinates[cs - 1][axis] = (compute) - ? currentUserPosition[axis] - coord + workplaceCoordinates[currentCoordinateSystem][axis] - : coord; + workplaceCoordinates[cs - 1][axis] = (compute) ? currentUserPosition[axis] - coord : coord; } } diff --git a/src/RepRap.cpp b/src/RepRap.cpp index 035528c7..ac190942 100644 --- a/src/RepRap.cpp +++ b/src/RepRap.cpp @@ -850,7 +850,7 @@ OutputBuffer *RepRap::GetStatusResponse(uint8_t type, ResponseSource source) ch = '['; for (size_t axis = 0; axis < numVisibleAxes; ++axis) { - response->catf("%c%d", ch, (gCodes->GetAxisIsHomed(axis)) ? 1 : 0); + response->catf("%c%d", ch, (gCodes->IsAxisHomed(axis)) ? 1 : 0); ch = ','; } @@ -1779,7 +1779,7 @@ OutputBuffer *RepRap::GetLegacyStatusResponse(uint8_t type, int seq) ch = '['; for (size_t axis = 0; axis < numVisibleAxes; ++axis) { - response->catf("%c%d", ch, (gCodes->GetAxisIsHomed(axis)) ? 1 : 0); + response->catf("%c%d", ch, (gCodes->IsAxisHomed(axis)) ? 1 : 0); ch = ','; } response->cat(']'); diff --git a/src/Version.h b/src/Version.h index 37d16989..db3a975b 100644 --- a/src/Version.h +++ b/src/Version.h @@ -11,16 +11,16 @@ #ifndef VERSION #ifdef RTOS -# define MAIN_VERSION "2.03RC3+1" +# define MAIN_VERSION "2.03RC4" #else -# define MAIN_VERSION "1.24RC3+1" +# define MAIN_VERSION "1.24RC4" #endif # define VERSION MAIN_VERSION #endif #ifndef DATE -# define DATE "2019-05-29b1" +# define DATE "2019-05-29b4" #endif #define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman, printm3d" |