Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-11-11 21:57:55 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-11-11 21:57:55 +0300
commit82d14c198d7b61005093b2b06457d83435a76564 (patch)
tree6c4f5e994b7e3d620b871f2a79f5ab3e1b4a2612 /src/Movement
parentb472db8b61e4b5123fe10b6450bf18c72c91ff00 (diff)
Fixed issue with extruder stopping after a tiny move
Also refactored nonlinear extrusion coce to make it more efficient
Diffstat (limited to 'src/Movement')
-rw-r--r--src/Movement/DDA.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/Movement/DDA.cpp b/src/Movement/DDA.cpp
index 7958a71b..26358f6d 100644
--- a/src/Movement/DDA.cpp
+++ b/src/Movement/DDA.cpp
@@ -1527,17 +1527,15 @@ void DDA::Prepare(SimulationMode simMode) noexcept
platform.EnableDrivers(drive, false);
const size_t extruder = LogicalDriveToExtruder(drive);
#if SUPPORT_NONLINEAR_EXTRUSION
- // Add the nonlinear extrusion correction to totalExtrusion
- if (flags.isPrintingMove)
+ // Add the nonlinear extrusion correction to totalExtrusion.
+ // If we are given a stupidly short move to execute then clocksNeeded can be zero, which leads to NaNs in this code; so we need to guard against that.
+ if (flags.isPrintingMove && clocksNeeded != 0)
{
- float a, b, limit;
- if (platform.GetExtrusionCoefficients(extruder, a, b, limit))
- {
- float& dv = directionVector[drive];
- const float averageExtrusionSpeed = (totalDistance * dv)/clocksNeeded;
- const float factor = 1.0 + min<float>((averageExtrusionSpeed * a) + (averageExtrusionSpeed * averageExtrusionSpeed * b), limit);
- dv *= factor;
- }
+ const NonlinearExtrusion& nl = platform.GetExtrusionCoefficients(extruder);
+ float& dv = directionVector[drive];
+ const float averageExtrusionSpeed = (totalDistance * dv)/clocksNeeded;
+ const float factor = 1.0 + min<float>((averageExtrusionSpeed * nl.A) + (averageExtrusionSpeed * averageExtrusionSpeed * nl.B), nl.limit);
+ dv *= factor;
}
#endif